php - Problem displaying query results -


i have mysql table set using phpmyadmin can view in images below:

table structure

and here populated table:

categories

the problem have when issue following query, no results returned. struggling work out why.

<?php  $db_host     = 'localhost'; $db_user     = 'root'; $db_pass     = 'root'; $db_database = 'bbg_db_2';   $dbc = mysql_connect($db_host,$db_user,$db_pass); $sdb = mysql_select_db($db_database);  $query = "select category_name, category_desc categories"; $result = mysql_query($sdb, $dbc, $query) or die (mysql_error($dbc));  while ($row = mysql_fetch_array($result)) {     $catname = $row["category_name"];    $catdesc = $row["category_desc"];     echo "<li>$catname</br><span>$catdesc</span></a></li>"; } ?> 

when issue query no error messages , no results displayed. trying list of these categories descriptions. ideas?

your parameters mysql_query wrong. results of mysql_select_db not belong there, , query should first parameter.

check out documentation every function use.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -