Recent Topics

1 Dec 12, 2005 18:27    

I have the following table:

echo '<TABLE >';
echo '<TR valign=top>';
	echo '<TD width=25 bgcolor="#C0C0C0">';
	echo '<div class="wpmd">';
		echo '<div align=center> #</div>';
	echo '</div>';
	echo '</TD>';

		echo '<TD width=202 bgcolor="#C0C0C0">';
		echo '<div class="wpmd">';
			echo '<div align=center> Location</div>';
		echo '</div>';
		echo '</TD>';

			echo '<TD width=60 bgcolor="#C0C0C0">';
			echo '<div class="wpmd">';
				echo '<div align=center>Time</div>';
			echo '</div>';
			echo '</TD>';
			
				echo '<TD width=244 bgcolor="#C0C0C0">';
				echo '<div class="wpmd">';
					echo '<div align=center>Latest Activity</div>';
			echo '</div>';
			echo '</TD>';
	
$tot=0;
while ($EM = mysql_fetch_array($getEM)) {
$tot++;
$cID=strtolower(geoip_country_code_by_addr($gi,"$EM[totIP]"));
$cName=geoip_country_name_by_addr($gi, "$EM[totIP]");
$file=explode ("/",$EM[file]);
$num=count($file)-1;
if ($cID=="") { 
	echo '<TR valign=top>';
		echo '<TD width=25 bgcolor="#C0C0C0">';
		echo '<div class="wpmd">';
		echo '<div align=center><BR>';
		echo '2'; 
		echo '</div>';
		echo '</div>';
echo '</TD>';
echo '<TD width=202 bgcolor="#C0C0C0">';
	echo '<div class="wpmd">';
			echo '<div align=center><BR>';
			
			if ($cID=="") {
			echo '<img class="flag" src="http://www.alkhater.net/blog/addOns/visitors/flags/a1.gif" alt="flag" title=" Unkown " />';
			
			} else { 
				echo '<img class="flag" src="http://www.alkhater.net/blog/addOns/visitors/flags/'.$cID.'.gif" alt="flag"/>';
$cName ;
			}
		echo '</div>';
		echo '</div>';
		echo '</TD>';

			echo '<TD width=60 bgcolor="#C0C0C0">';
			echo '<div class="wpmd">';
				echo '<div align=center><BR>';
				if ($EM[4]=="2144444444") {
					$time=5; 
					echo "new"; 
				} else {
					$time=round(($EM[3]-$EM[4])/60);
					echo $time;
				} 
			echo '</div>';
			echo '</div>';
			echo '</TD>';

					echo '<TD width=244 bgcolor="#C0C0C0">';
					echo '<div class="wpmd">';
						echo '<div align=center><BR>';

						if ($file[$num]=="index.php") {
							echo '<a class="ext" href="http://www.alkhater.net'.$EM[file].'" title=" go there ">Browsing the Main Page</a><br />';  
						} else { 
						if ($file[$num]=="") {
							echo '<a class="ext" href="http://www.alkhater.net/index.php'.$EM[file].'" title=" look at the entry list ">Browsing by Month</a><br />';
						} else {
							$title=str_replace("_"," ",$file[$num]);
							echo '<a class="ext" href="http://www.alkhater.net/index.php'.$EM[file].'" title=" go to entry: '.ucwords(strtolower($title)).' ">'.ucwords(strtolower($title)).'</a><br />'; 
						}
					}
											
					echo '</div>';
					echo '</div>';
					echo '</TD>';
				


} }


echo '</TABLE>';

When I run it, the first row for the title shows ok.

But nothing inside the while loop.

I looked the page source trying of anything is echoed and find the same thing. Here is the line in the page source:


<br /><br /><TABLE >
<TR valign=top>
<TD width=25 bgcolor="#C0C0C0"><div class="wpmd"><div align=center> #</div></div></TD>
<TD width=202 bgcolor="#C0C0C0"><div class="wpmd"><div align=center> Location</div></div></TD>
<TD width=60 bgcolor="#C0C0C0"><div class="wpmd"><div align=center>Time</div></div></TD>
<TD width=244 bgcolor="#C0C0C0"><div class="wpmd"><div align=center>Latest Activity</div></div></TD></TABLE>

Any idea :!:

Thanks all,[/code]

2 Dec 12, 2005 19:11

Try changing this :-
mysql_fetch_array($getEM)

to this :-
$DB->get_results($getEM, ARRAY_A)

If that doesn't work then echo $getEM, and print_r($EM)

¥

3 Dec 13, 2005 09:21

Thanks for the reply.

I used the statement you had suggested but did not work.
You see the code works fine without using table.

Please visit my Arabic blog see it without the table.
and my English blog with the table.

The MySQL statementt in both are the same.

If I echo $getEM; before the table I get this: "Resource id #5"

If I echo $getEM; inside the table for the first <TD> I get this: Nothing.

I noticed that echoing even a constant will not show.

Khalid,

4 Dec 13, 2005 11:10

Try this :-



while ($EM = mysql_fetch_array($getEM)) {
$tot++;
$cID=strtolower(geoip_country_code_by_addr($gi,"$EM[totIP]"));
$cName=geoip_country_name_by_addr($gi, "$EM[totIP]");
$file=explode ("/",$EM[file]);
$num=count($file)-1;

echo '$tot : '.$tot.'<br />';
echo '$cID : '.$cID.'<br />';
echo '$cName : '.$cName.'<br />';
echo '$file : '.$file.'<br />';
echo '$num : '.$num.'<br />';
echo '$EM[totIP] : '.$EM['totip'].'<br />';

¥

5 Dec 14, 2005 14:42

:lol:

The problem was this line:

if ($cID=="") {

I changed it to this and it worked.

if ($cID !="") {

Thanks to all who replied.

Khalid


Form is loading...