PittsburghRed
08-08-2006, 04:43 PM
I have created a tiny database as a learning tool; I plan to use a database to store membership info gathered from a webpage form.
I am trying to print out the table:
$getrecords="SELECT * FROM Members";
$result=mysql_query($getrecords,$conn);
print "<TABLE BORDER=1>\n";
print "<TR>\n";
while ($field=mysql_fetch_field($result)){
print " <TH>$field->name</TH>\n";
}// end while
print "</TR>\n\n";
//parse and print result set
while ($row=mysql_fetch_assoc($result)){
print "<TR>\n";
foreach ($row as $col=>$val){
print " <TD>$val</TD>\n";
} // end foreach
print "</TR>\n\n";
}// end while
I get the following error meassge:
Warning: mysql_fetch_field(): supplied argument is not a valid MySQL result resource in /home/endteach/public_html/database.php on line 21
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/endteach/public_html/database.php on line 27
Are these invalid functions in MySql? In the version on my server? Or is something else wrong that provokes this error response?
I am trying to print out the table:
$getrecords="SELECT * FROM Members";
$result=mysql_query($getrecords,$conn);
print "<TABLE BORDER=1>\n";
print "<TR>\n";
while ($field=mysql_fetch_field($result)){
print " <TH>$field->name</TH>\n";
}// end while
print "</TR>\n\n";
//parse and print result set
while ($row=mysql_fetch_assoc($result)){
print "<TR>\n";
foreach ($row as $col=>$val){
print " <TD>$val</TD>\n";
} // end foreach
print "</TR>\n\n";
}// end while
I get the following error meassge:
Warning: mysql_fetch_field(): supplied argument is not a valid MySQL result resource in /home/endteach/public_html/database.php on line 21
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/endteach/public_html/database.php on line 27
Are these invalid functions in MySql? In the version on my server? Or is something else wrong that provokes this error response?