kiacovin71
New Member
- Messages
- 1
- Reaction score
- 0
- Points
- 0
this code:
<html>
<head>
<title>php</title>
</head>
<body>
<h1>Show Database </h1>
<?
//make the database connection
$conn = mysql_connect("localhost", "clocky_time", "********");
mysql_select_db("clocky_clock", $conn);
//create a query
$sql = "SELECT * FROM clock_clock";
$result = mysql_query($sql, $conn);
print "<table border = 1>\n";
//get field names
print "<tr>\n";
while ($field = mysql_fetch_field($result)){
print " <th>$field->name</th>\n";
} // end while
print "</tr>\n\n";
//get row data as an associative array
while ($row = mysql_fetch_assoc($result)){
print "<tr>\n";
//look at each field
foreach ($row as $col=>$val){
print " <td>$val</td>\n";
} // end foreach
print "</tr>\n\n";
}// end while
print "</table>\n";
?>
</body>
</html>
which I changed from some code that works on my friends godaddy account is giving me the error:
"Show Database
Warning: mysql_fetch_field(): supplied argument is not a valid MySQL result resource in /home/clocky/public_html/showalldata.php on line 20
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/clocky/public_html/showalldata.php on line 26
"
Any ideas? Besides that I really like x10hosting
<html>
<head>
<title>php</title>
</head>
<body>
<h1>Show Database </h1>
<?
//make the database connection
$conn = mysql_connect("localhost", "clocky_time", "********");
mysql_select_db("clocky_clock", $conn);
//create a query
$sql = "SELECT * FROM clock_clock";
$result = mysql_query($sql, $conn);
print "<table border = 1>\n";
//get field names
print "<tr>\n";
while ($field = mysql_fetch_field($result)){
print " <th>$field->name</th>\n";
} // end while
print "</tr>\n\n";
//get row data as an associative array
while ($row = mysql_fetch_assoc($result)){
print "<tr>\n";
//look at each field
foreach ($row as $col=>$val){
print " <td>$val</td>\n";
} // end foreach
print "</tr>\n\n";
}// end while
print "</table>\n";
?>
</body>
</html>
which I changed from some code that works on my friends godaddy account is giving me the error:
"Show Database
Warning: mysql_fetch_field(): supplied argument is not a valid MySQL result resource in /home/clocky/public_html/showalldata.php on line 20
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/clocky/public_html/showalldata.php on line 26
"
Any ideas? Besides that I really like x10hosting
Last edited by a moderator: