fosh387 Posted May 1, 2010 Share Posted May 1, 2010 keep getting syntax error but i cant findit any help would be great <div id="left"> <?php $me = $_SESSION["gatekeeper"]; $conn = mysql_connect("localhost", "FoshRachel", "chAcre8E"); mysql_select_db("FoshRachel"); $result = mysql_query("SELECT firstname FROM Users WHERE username='$me'"); $row = mysql_fetch_array($result); $result3 = mysql_query("SELECT * FROM Users WHERE username='$me'"); $row3 = mysql_fetch_array($result3); echo "<p>"; echo " <h3>Welcome to profile page of $row3[username]</h3><br/>"; echo "<b>Name: </b>$row3[firstname]<br/>"; echo "<b>Birthday:</b>" . $row3[day] . "/" . $row3[month] . "/" . $row3[year] . "<br/>"; echo "<b>School: </b>$row3[school]<br/>"; echo "<b>Interests: </b>$row3[interests]<br/>"; echo "</p>"; $result2 = mysql_query("SELECT friend FROM friends WHERE username='$me'"); echo "<b>These are your Friends:</b><br/>"; while ($row2 = mysql_fetch_array($result2)) if(mysql_num_rows($result2)==0) { echo " No Friends listed"; } else { echo "$row2[friend]echo "<form method=post action=http://www.solent.edward.ac.uk/~FoshRachel/dissertation/otherprofile.php?friend=$row2[friend]><input name=Profile View input type=submit value=Go></form>";<br/>"; } mysql_close($conn); } ?> </div> <div id="right"> <form method="post" action="addmessage.php"> <table cellpadding="6" cellspacing="0"> <tr> <td>Name :</td> <td><input type="text" name="firstname" /></td> </tr> <tr> <td valign="top">Message :</td> <td><textarea name="message" cols="30" rows="6"></textarea></td> </tr> <tr> <td> </td> <td> <input type="submit" name="submit" value="Add Message" /> <input type="reset" name="reset" value="Clear Message" /> </td> </tr> </table> </form> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/200377-syntax-help/ Share on other sites More sharing options...
Alex Posted May 1, 2010 Share Posted May 1, 2010 It would be nice if you could post the error so we can see where it's occurring.. You should also use php tags next time. edit: Does this look right to you? echo "$row2[friend]echo "<form method=post action=http://www.solent.edward.ac.uk/~FoshRachel/dissertation/otherprofile.php?friend=$row2[friend]><input name=Profile View input type=submit value=Go></form>";<br/>"; You can't combine two echos like that. echo "$row2[friend]<form method=post action=http://www.solent.edward.ac.uk/~FoshRachel/dissertation/otherprofile.php?friend=$row2[friend]><input name=Profile View input type=submit value=Go></form><br/>"; Quote Link to comment https://forums.phpfreaks.com/topic/200377-syntax-help/#findComment-1051557 Share on other sites More sharing options...
947740 Posted May 1, 2010 Share Posted May 1, 2010 The first thing I noticed - you can't echo arrays with out { } around them. I.E. whenever you access $row['somevalue'] in a string you need it to be {$row['somevalue']}. Quote Link to comment https://forums.phpfreaks.com/topic/200377-syntax-help/#findComment-1051560 Share on other sites More sharing options...
Alex Posted May 1, 2010 Share Posted May 1, 2010 The first thing I noticed - you can't echo arrays with out { } around them. I.E. whenever you access $row['somevalue'] in a string you need it to be {$row['somevalue']}. If you're inside of double quotes you can use echo array values like that as long as you don't use single quotes around the keys. Quote Link to comment https://forums.phpfreaks.com/topic/200377-syntax-help/#findComment-1051561 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.