Re: Where do I start



George Mills wrote:
will.beard@xxxxxxxxxx wrote:

Hi all I want to be able to write a database driven website. Is there
any software or books for beginners that anyone can recommend. I am mac
based using OS X 10.3.6

Beginner? How beginner? Do you have a server you can test your php on? Do you have a database? Have you every written a program? If so what language(s)? Why a database driven website? Why php? What database would you like to use? How's the weather? Single user or multiple user? Need security? Do you know HTML? What editor do you use? How much money have you got? What is your timeframe? Will lunch be provided? Did you get the memo? No?!? That's ok, neither did I. :)

George

Here is everything you need to know. Glad to help.

(This is for mysql. If you need a different database go to http://www.php.net/manual/en/funcref.php and find the reference for the database you need.)

From:
http://www.php.net/manual/en/ref.mysql.php
(Sorry, I did not see a link to this section of the page so I reprinted it.)
Examples

This simple example shows how to connect, execute a query, print resulting rows and disconnect from a MySQL database.

Example 1. MySQL extension overview example
<?php
// Connecting, selecting database
$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('my_database') or die('Could not select database');

// Performing SQL query
$query = 'SELECT * FROM my_table';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";

// Free resultset
mysql_free_result($result);

// Closing connection
mysql_close($link);
?>
.



Relevant Pages

  • gzip: stdout: Broken pipe
    ... I am experiencing a weird issue with dbi while connecting to mysql ... system and feed the existence of chapter information to mysql database. ... gzip: compressed data not read from a terminal. ...
    (perl.dbi.users)
  • Re: Creating a database with MySQLTcl
    ... MySQL uses the database mysql as it's system database. ... Connecting to a db server doesn't require a database name, ...
    (comp.lang.tcl)
  • Re: Where do I start
    ... How beginner? ... Do you have a server you can test your php on? ... Why a database driven website? ... Do you know HTML? ...
    (php.general)
  • Re: Where do I start
    ... How beginner? ... Do you have a server you can test your php on? ... Why a database driven website? ... Do you know HTML? ...
    (php.general)
  • Re: Query 2 MySQL databases in 1 statement
    ... My concern is, when connecting to MySQL (or sending a query), I only ... the database you specify when connecting to mysql ...
    (comp.lang.php)