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>";
need help
Moderator: General Moderators
Re: need help
Your quotes are a bit wonky.
Re: need help
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>";
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
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
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>";