Page 1 of 1

while not working

Posted: Sat Sep 05, 2009 2:20 am
by m2babaey
Hi
I have a while loop for displaying database rows
It works in all servers but not in one of the servers (that we need)
No data is displayed. database connection is ok just while loops are not working on that host
How can I fix it if I don't want to change host?
This is the code:

Code: Select all

while($row=mysql_fetch_object($rows)){
$id=$row->id;
$name=$row->rname;
$location=$row->rloc;
$date=rdate($row->date,'');
 
$link="../interview.php?id=".$id;
$name="<a href='$link'>$name</a>";
 
$dellink="interview.php?view=all&delete=".$id;
$delete="<a href='$dellink'>Delete</a>";
 
$editlink="editinterview.php?edit=".$id;
$edit="<a href='$editlink'>Edit</a>";
 
 echo "<tr><td><b> $name    </b></td><td>$location  </td><td>$date  </td><td>$edit  </td><td>$delete  </td></tr>";
 
}
 
also tried

Code: Select all

 
while($row=mysql_fetch_assoc($rows)){
 
$id=$row['id'];
$name=$row['rname'];
$location=$row['rloc'];
$date=rdate($row['date'],'');
$link="../interview.php?id=".$id;
$name="<a href='$link'>$name</a>";
 
$dellink="interview.php?view=all&delete=".$id;
$delete="<a href='$dellink'>Delete</a>";
 
$editlink="editinterview.php?edit=".$id;
$edit="<a href='$editlink'>Edit</a>";
 
 echo "<tr><td><b> $name    </b></td><td>$location  </td><td>$date  </td><td>$edit  </td><td>$delete  </td></tr>";
 
}
 

Re: while not working

Posted: Sat Sep 05, 2009 2:58 am
by requinix
You sure that the databases are the same? Have the same data?

Scatter some var_dumps in your code and see if you can't figure out what variables are causing the problem.

Re: while not working

Posted: Sat Sep 05, 2009 3:11 am
by stratbeans
Provide more information by adding few debug like print_r and please mention what is actually coming.
Can you provide your log file for more detail.

Re: while not working

Posted: Sat Sep 05, 2009 3:50 am
by Benjamin
Where is function rdate() defined? Have you reviewed your error logs?

Re: while not working

Posted: Sat Sep 05, 2009 3:59 am
by m2babaey
function rdate is to change 2009-08-15 to 15-08-2009 and is in function.php included in the page
Where is my error log? I don't see any in admin directory

Re: while not working

Posted: Sat Sep 05, 2009 4:05 am
by m2babaey
It seems the problem is the function rdate
I deleted it and it worked
very strange