Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Show result in table

General discussions related to php

Moderators: macek, egami, gesf

Show result in table

Postby superman » Wed Jul 02, 2003 8:05 pm

I have tried to modify this coding, but also cannot show the result,
what is the problem? The error message is "Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\phpweb/account.php on line 26"

Thank you for your help.
-------------------------------------




<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<? $Connect = mysql_connect("localhost","root","");
mysql_select_db("mw");
$result=mysql_query("select * from account");
$number_of_rows = mysql_num_rows($result);

print "<TABLE CELLSPACING=\"0\" CELLPADDING=\"0\" BORDER=\"1\">\n";
print " <TR><TD height=\"45\">Username</TD><TD>Password</TD><TD>Email</TD></TR>\n";


while ($number_of_rows = mysql_fetch_row($result)){

echo "<tr>\n";

echo "<TD>$number_of_rows["username"]"</TD>\n";
echo "<TD>$number_of_rows["password"]"</TD>\n";
echo "<TD>$number_of_rows["email"]"</TD>\n";
echo "<tr>\n";
}
mysql_close();
?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>&</td>
</tr>
</table>
</body>
</html>
superman
New php-forum User
New php-forum User
 
Posts: 36
Joined: Fri Jun 27, 2003 11:54 pm

Re: Show result in table

Postby WiZARD » Wed Jul 02, 2003 10:34 pm

Hi!
just sintax error replace at:
Code: Select all
echo "<TD>$number_of_rows['username']</TD>\n";
echo "<TD>$number_of_rows['password']</TD>\n";
echo "<TD>$number_of_rows['email']</TD>\n";
echo "<tr>\n";
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby superman » Wed Jul 02, 2003 11:58 pm

Although I follow your code, it also can't display the result.

echo "<tr>\n";
echo "<TD>$number_of_rows['username']</TD>\n";
echo "<TD>$number_of_rows['password']</TD>\n";
echo "<TD>$number_of_rows['email']</TD>\n";
echo "<tr>\n";
superman
New php-forum User
New php-forum User
 
Posts: 36
Joined: Fri Jun 27, 2003 11:54 pm

Postby daveyboy » Sat Jul 05, 2003 1:24 am

try this out for size, just copied your source, and this fixed it for me:

Code: Select all
echo "<TD>{$number_of_rows['username']}</TD>\n";
echo "<TD>{$number_of_rows['password']}</TD>\n";
echo "<TD>{$number_of_rows['email']}</TD>\n";
echo "<tr>\n";
daveyboy
New php-forum User
New php-forum User
 
Posts: 6
Joined: Sat Jul 05, 2003 12:57 am


Return to PHP General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.