7

Not able to link mysql database with php

view full story
linux-howto

http://stackoverflow.com – I am using mysql version Server version: 5.0.77 and php version PHP 5.1.6 (cli) (built: Nov 29 2010 16:47:37) My code is below: <?php $username="root"; $password=""; $hostname="localhost"; $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); echo "Connected to MySQL<br>"; $selected = mysql_select_db("examples",$dbhandle) or die("Could not select examples"); //execute the SQL query and return records $result = mysql_query("SELECT id, model,year FROM cars"); //fetch tha data from the database while ($row = mysql_fetch_array($result)) { (HowTos)