cant get results
Posted: Wed Aug 10, 2005 5:13 am
I am trying to run the following code but i cant get any results. I have done a code dump but nothing is being returned. Why is this happening?
If i do $num_results it returns 15 rows which is correct
If i run the code on my pc it works but when i upload this to my host it does not work.
code]
object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { }
If i do $num_results it returns 15 rows which is correct
If i run the code on my pc it works but when i upload this to my host it does not work.
Code: Select all
<?php
// Connect to database using the new and improved mysqli
$dbLink = new mysqli('localhost', 'user', 'password', 'database');
if(!$dbLink) {echo 'connection error';}
//query db system
$query ="select * from tbl_debug";
$result = $dbLink->query($query);
//test to see if results were returned
$num_results=$result->num_rows;
$count=1;
if ($num_results > 0) {
for($i=0; $i <$num_results; $i++) {
$row=$result->fetch_assoc();
echo 'Title row: '.$row['debug_Title'];
echo $count;
$count++;
}
}
echo 'test script ';
// garbage collection
if ($result <> null) {
$result->free();
$dbLink->close();
}
?>code]
object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { } object(mysqli_result)#2 (0) { }