Jump to content

Random 'array' Echo


Swarfega

Recommended Posts

Hey.

 

 

I've just setup the Comment-Part of my custom-scripted Foto Album system, and it's working properly, apart from one issue which I simply cannot find in the while loop. Either it's something easy and I'm missing it or there's something hidden that I can't find.

 

 

When I mean "Random 'Array' Echo" I don't mean an actual Array Printing data, what I mean is that the word 'Array' itself is printed.

 

 

Here's what happens without a comment:

 

http://i.imgur.com/NNbFy.png

 

 

Here's what happens with a comment:

 

http://i.imgur.com/16mbM.png

 

 

And here's the code processing the Data:

 

$sql = "SELECT * FROM imagecomments WHERE imageid='".$_GET['imageid']."' AND targetid='".$_GET['targetid']."' ORDER BY UNIX_TIMESTAMP(timehappen) DESC LIMIT ".$min.", ".$limit;
$query = mysql_query( $sql );
$rows = mysql_num_rows( $query );

while($row = mysql_fetch_array($query))
{

$data .= "<tr>";
if($durp == 0) {
$data .= "<td class='cellone'><img src='".$row['profilepic']."' ></td>";
} else {
$data .= "<td class='celltwo'><img src='".$row['profilepic']."' ></td>";
}
if($row['connected'] == "online") {
if($durp == 0) {
$data .= "<td class='cellone' style='max-width: 600px; overflow:auto; word-wrap:break-word;'><img src='online.png' width='5' height='5'> <a href='profile.php?uid=".$row['uid']."'>" . ucfirst($row['sender']) . "</a> - <font color='green'>". $row['timehappen'] . "</font> <br/> ".$row['message']."</td>";
$durp = 1;
} else {
$data .= "<td class='celltwo' style='max-width: 600px; overflow:auto; word-wrap:break-word;'><img src='online.png' width='5' height='5'> <a href='profile.php?uid=".$row['uid']."'>" . ucfirst($row['sender']) . "</a> - <font color='green'>". $row['timehappen'] . "</font> <br/> ".$row['message']."</td>";
$durp = 0;
}
} else {
if($durp == 0) {
$data .= "<td class='cellone' style='max-width: 600px; overflow:auto; word-wrap:break-word;'><img src='offline.png' width='5' height='5'> <a href='profile.php?uid=".$row['uid']."'>" . ucfirst($row['sender']) . "</a> - <font color='red'>". $row['timehappen'] . "</font> <br/> ".$row['message']."</td>";
$durp = 1;
} else {
$data .= "<td class='celltwo' style='max-width: 600px; overflow:auto; word-wrap:break-word;'><img src='offline.png' width='5' height='5'> <a href='profile.php?uid=".$row['uid']."'>" . ucfirst($row['sender']) . "</a> - <font color='red'>". $row['timehappen'] . "</font> <br/> ".$row['message']."</td>";
$durp = 0;
}
}
$data .= "</tr>";
}

echo $table1_start . $table_start . $data . $table_end . $table1_end;

 

 

I know the code itself is very sloppy, but I tend to fix that after everything's already working properly, which currently it is not. I have spent hell of a lot of time trying to find out why it's printing the 'Array' Text/String, but I can't find it. It's evidentally in the $data value but I can't find where.

 

 

Edit: I'm also using the same Data-Printing system for the User-Individual Guestbooks & the Chat System, and they all work properly, apart from this 'Array' echoing.

Link to comment
https://forums.phpfreaks.com/topic/272549-random-array-echo/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.