Custom Search
 


<?
$db_host 
"localhost"
$db_name "northwind"
$db_user "root"
$db_pass "your_password"

$db_link mysql_connect($db_host$db_user$db_pass) or die("Could not connect to database server"); 
mysql_select_db($db_name$db_link) or die("Could not select database"); 

// Here we select all records from categories table. 
$sql "select CategoryID, CategoryName from categories"
$result mysql_query($sql$db_link); 

// Loop thru the record set and concatenate a TR string for HTML table. 
while($row mysql_fetch_array($resultMYSQL_ASSOC)) 

    
$cat_id $row["CategoryID"]; 
    
$cat_name $row["CategoryName"]; 
     
    
$tr .= "<tr><td>"$cat_id"</td>"
        
"<td>"$cat_name"</td></tr>"

?> 

<p> 
<table cellpadding=2 cellspacing=0 border=1> 
<tr> 
    <th><strong>Category ID</strong></th> 
    <th><strong>Category Name</strong></th> 
</tr> 
<?=$tr?> 
</table></p>

Copyright © 2024 GeeksEngine.com. All Rights Reserved.

This website is hosted by HostGator.

No portion may be reproduced without my written permission. Software and hardware names mentioned on this site are registered trademarks of their respective companies. Should any right be infringed, it is totally unintentional. Drop me an email and I will promptly and gladly rectify it.

 
Home | Feedback | Terms of Use | Privacy Policy