From Free Knowledge Base- The DUCK Project: information for everyone
161 bytes added,
01:39, 21 June 2007 The following lines were added (+) and removed (-):
________________________________________________________________________________________________== Connecting to a MySQL database from PHP (basic example) ==== Connecting to a MySQL database from PHP (simple example) == mysql_connect($db_hostname, $db_username, $db_password) or die("Could not connect"); <nowiki>mysql_connect($db_hostname, $db_username, $db_password) or die("Could not connect");</nowiki> <nowiki></nowiki> mysql_select_db($db_database); <nowiki>mysql_select_db($db_database);</nowiki> <nowiki></nowiki> $result = mysql_query($Query); <nowiki>$result = mysql_query($Query);</nowiki> <nowiki></nowiki> for ($i = 0; $i < mysql_num_rows($result); $i++) { <nowiki>for ($i = 0; $i < mysql_num_rows($result); $i++) {</nowiki> $row_array = mysql_fetch_row($result); <nowiki> $row_array = mysql_fetch_row($result);</nowiki> echo ("<P>" . $row_array[1] . "</P>"); <nowiki> echo ("<P>" . $row_array[1] . "</P>");</nowiki> } <nowiki>}</nowiki>