need help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bondoq
Forum Newbie
Posts: 2
Joined: Wed Mar 26, 2008 6:44 am

need help

Post 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>";
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: need help

Post by onion2k »

Your quotes are a bit wonky.
bondoq
Forum Newbie
Posts: 2
Joined: Wed Mar 26, 2008 6:44 am

Re: need help

Post 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>";
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: need help

Post 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.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Re: need help

Post 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>";
 
Post Reply