Revision: 5607
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 18, 2008 23:13 by mswallace
Initial Code
<?php //create db connection $connection = mysql_connect("localhost", "user", "password"); if(!$connection) { die("Database connection failed:" . mysql_error()); } // select a dtabase to use $db_select = mysql_select_db("database name", $connection); if(!$db_select) { die("Database selection failed:" . mysql_error()); } ?> <body> $result = mysql_query("SELECT * FROM tablename", $connection); while ($row = mysql_fetch_array($result)) { echo $row["rownamehere"]." ".$row["rownamehere"]."<br/>"; } ?> </body> <?php mysql_close($connection); ?>
Initial URL
Initial Description
Initial Title
PHP connecting and query MySQL DB
Initial Tags
mysql, database, php, query
Initial Language
PHP