Ik ben bezig met php en mysql maar er schijnt nog iets fout te zitten in de code?
dit is de code
kan iemand mij vertellen wat er mis is
PHP:
Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource in C:\Users\jeroen\Desktop\PHP 5\usb webserver\root\landen.php on line 20
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\Users\jeroen\Desktop\PHP 5\usb webserver\root\landen.php on line 22
dit is de code
PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Cities and countries</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="HAPedit 3.1">
</head>
<body bgcolor="#FFFFFF">
<?php
$hostname = "localhost";
$username = "root";
$password = "usbw";
$db = "VOORBEELD";
$global_dbh = mysql_connect($hostname, $username, $password);
mysql_select_db($db, $global_dbh);
function display_db_table($tablename, $connection){
$querystring = "SELECT * FROM $tablename";
$result_id = mysql_query($querystring, $connection);
$column_count = mysql_num_fields($result_id);
print("<TABLE BORDER = 1>\n");
while ($row = mysql_fetch_row($result_id)){
print ("<TR ALIGN=LEFT VALIGN=TOP>");
for ($column_num = 0;
$column_num < $column_count;
$column_num++)
print ("<TD>$row[$column_num]</TD>\n");
print ("</TR>\n");
}
print ("</TABLE>\n");
}
?>
<TABLE><TR><TD>
<?php
display_db_table("country", $global_dbh); ?>
</TD><TD>
<?php
display_db_table("city", $global_dbh); ?>
</TD></TR></TABLE>
</body>
</html>
kan iemand mij vertellen wat er mis is