Prob displaying results in table.

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Alicia
New php-forum User
New php-forum User
Posts: 94
Joined: Sun Sep 21, 2003 5:30 pm

Prob displaying results in table.

Postby Alicia » Sun Sep 21, 2003 7:28 pm

Can somebody help me to check my code. Before i add the table (html code), the php coding works just fine. It can display all the results i want. But after i added the php code into the table i designed in dreamweaver, it does not display any result. Did i miss something in my code so it does not display any results ?

Please advise.


<table border="0" width="539">
<? while ($row = mysql_fetch_array ($result)) ?>
<? { ?>
<tr>
<td width="96">
<p>Company:</p>
</td>
<td width="427" colspan="3">
<p><?echo $row["c_name"];?></p>
</td>
</tr>
<tr>
<td width="96">
<p>Address:</p>
</td>
<td width="427" colspan="3">
<p>
<? echo $row["c_street1"];?>
<? echo " ";?>
<? echo $row["c_street2"];?>
<? echo " ";?>
<? echo $row["c_street3"];?>
<? echo " ";?>
<? echo $row["c_city"];?>
<? echo " ";?>
<? echo $row["c_state"];?>
<? echo " ";?>
<? echo $row["c_zip_code"];?>
<? echo " $country";?></p>
</td>
</tr>
<tr>
<td width="96" height="21">
<p>Phone no:</p>
</td>
<td width="123" height="21">
<p>
<?echo $row["c_phone_country"];?>
<?echo $row["c_phone_area"];?>
<?echo "-";?>
<?echo $row["c_phone_no"];?></p>
</td>
<td width="52" height="21">
<p>Fax no:</p>
</td>
<td width="240" height="21">
<p>
<? echo $row["c_fax_country"]; ?>
<? echo $row["c_fax_area"]; ?>
<? echo "-";?>
<? echo $row["c_fax_no"];?>
</p>
</td>
</tr>
<? if ( $row["url"]!="") ?>
<? { ?>
<tr>
<td width="96" height="4">
<p>URL:</p>
</td>
<td width="181" height="4" colspan="2">
<p> <? echo $row["url"]; ?> </p>
</td>
<td width="240" height="4">
<p> </p>
</td>
</tr>
<? } ?>

<? } ?>
</table>

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Error

Postby ruturajv » Sun Sep 21, 2003 10:03 pm

Can you please display what is the actual result that you are able to see.
Otherwise the code looks ok, please check the table fields are correctly named in the $row['field'], alternatively try usin mysql_fetch_assoc()

User avatar
pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Postby pootergeist » Mon Sep 22, 2003 2:44 am

if you are not getting data out then I'd guess that the mysql query is returning nowt - you could test with

<? while ($row = mysql_fetch_array ($result)) ?>
<? { ?>
<tr><td colspan="4"><pre>
<? print_r($row); ?>
</pre></td></tr>
etc etc


Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot] and 3 guests