Page 1 of 1

need help

Posted: Wed Mar 26, 2008 6:46 am
by bondoq
hi all

i am new in php and mysql programing ,so i want help to check this code i got this error
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or
the code is :
echo "<tr><td>" '<a href="login.php?sid='.$d['spot_id'].'" </td><td> ".$d['name']."</a> <br> . "</td></tr>";

Re: need help

Posted: Wed Mar 26, 2008 7:17 am
by onion2k
Your quotes are a bit wonky.

Re: need help

Posted: Wed Mar 26, 2008 7:59 am
by bondoq
thanks

but what shall i do ?
the code is

echo "<table>";

while($d=mysql_fetch_array($data)) {
//echo "<tr><td>". $data['name'] . "</td><td>" . $row['position'] . "</td></tr>";
echo " <tr><td> '<a href="login.php?sid='.$d['spot_id'].' </td><td>". $d['name']."</a> <br> . "</td></tr>";
}

echo "</table>";

Re: need help

Posted: Wed Mar 26, 2008 10:24 am
by onion2k
Spend some time looking at them and working out what the problem is? Experiment with a few changes to see what happens? Read the manual? There's lots of ways to approach your problem. They're all better than me just fixing the code for you. You won't learn anything that way.

Re: need help

Posted: Wed Mar 26, 2008 12:52 pm
by hawleyjr
Using syntax highlighting (*hint*hint) may help your problem. See the difference?

Code: Select all

 
echo "<table>";
 
while($d=mysql_fetch_array($data)) {
//echo "<tr><td>". $data['name'] . "</td><td>" . $row['position'] . "</td></tr>";
echo " <tr><td> '<a href="login.php?sid='.$d['spot_id'].' </td><td>". $d['name']."</a> <br> . "</td></tr>";
}
 
echo "</table>";
 

Code: Select all

 
echo "<table>";
 
while($d=mysql_fetch_array($data)) {
//echo "<tr><td>". $data['name'] . "</td><td>" . $row['position'] . "</td></tr>";
echo '<tr><td><a href="login.php?sid='.$d['spot_id'].' </td><td>'. $d['name'].'</a> <br></td></tr>';
}
 
echo "</table>";