Jump to content

syntax help


fosh387

Recommended Posts

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>

 

Link to comment
Share on other sites

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/>";

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.