Hi! I'm trying to get my PHP webpage to pull data from my database into a table. I keep getting:
"mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource"
switch (show_files){ // Switch statement to display only certain records//
case ($_GET["next"] == NULL): // Displays items 1-10//
$connect = mysql_connect("localhost", "mayonaka","182007","grocery"); // connect to database//
if (!$connect){
echo "<p> The database server is not available!";} //If the database cannot connect display message//
$rownum=1;
echo '<table cellspacing="0" cellpadding="2" border="1">';
$txtquery= "SELECT vchrNAME, fltPRICE FROM catalog WHERE intID = '1'";
$result= mysql_query($txtquery);
while ($row=mysql_fetch_assoc($result)) {
echo '<tr><td>'.$row[0].'</td><td>'.$row[1].'</td><td>'.$row[2].'</td></tr>';
}
echo '</table>';
Thanks!
Thanks guys! and don't worry, those weren't my real user name database info.. lol I'm not that crazy I promise!
"mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource"
switch (show_files){ // Switch statement to display only certain records//
case ($_GET["next"] == NULL): // Displays items 1-10//
$connect = mysql_connect("localhost", "mayonaka","182007","grocery"); // connect to database//
if (!$connect){
echo "<p> The database server is not available!";} //If the database cannot connect display message//
$rownum=1;
echo '<table cellspacing="0" cellpadding="2" border="1">';
$txtquery= "SELECT vchrNAME, fltPRICE FROM catalog WHERE intID = '1'";
$result= mysql_query($txtquery);
while ($row=mysql_fetch_assoc($result)) {
echo '<tr><td>'.$row[0].'</td><td>'.$row[1].'</td><td>'.$row[2].'</td></tr>';
}
echo '</table>';
Thanks!
Thanks guys! and don't worry, those weren't my real user name database info.. lol I'm not that crazy I promise!