some error, please help?
Posted: Fri Apr 04, 2008 2:56 am
please help me, an error appear when i try to make a connection with my database,
connected to localhost via TCP/IP
Warning: mysqli::query() [function.mysqli-query]: Couldn't fetch mysqli in C:\wamp\www\GNSolutions\List.php on line 19
Fatal error: Call to a member function fetch_row() on a non-object in C:\wamp\www\GNSolutions\List.php on line 20
this is my code:
Thanks
connected to localhost via TCP/IP
Warning: mysqli::query() [function.mysqli-query]: Couldn't fetch mysqli in C:\wamp\www\GNSolutions\List.php on line 19
Fatal error: Call to a member function fetch_row() on a non-object in C:\wamp\www\GNSolutions\List.php on line 20
this is my code:
please help, SALAMAT PO,<?php
$conn = mysqli_connect("localhost","root","sa","gnsolutions");
if (empty($conn)) { die("mysqli_connect failed: " . mysqli_connect_error()); }
print "connected to " . mysqli_get_host_info ($conn) . "\n";
mysqli_close ($conn);
$result = $conn->query("SELECT productName FROM product");
while ($row = $result->fetch_row()) {
print $row[0] . "<br>\n";
}
$result->free();
$conn->close();
Thanks