while not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

while not working

Post 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>";
 
}
 
Last edited by Benjamin on Sat Sep 05, 2009 3:48 am, edited 1 time in total.
Reason: Changed code type from text to php.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: while not working

Post 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.
stratbeans
Forum Newbie
Posts: 12
Joined: Sat Aug 29, 2009 2:23 am

Re: while not working

Post 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.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: while not working

Post by Benjamin »

Where is function rdate() defined? Have you reviewed your error logs?
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

Re: while not working

Post 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
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

Re: while not working

Post by m2babaey »

It seems the problem is the function rdate
I deleted it and it worked
very strange
Post Reply