MySQL_Narb Posted October 18, 2009 Share Posted October 18, 2009 Parse error: syntax error, unexpected T_ECHO in /home/a5488351/public_html/profiles.php on line 122 <?php require "global_settings.php"; ?> <title><?php echo $sitetitle; ?></title> <font face='arial' size='3'></a> <?php session_start(); ?> <center> <style> a:link { color:#24374C; text-decoration:none; } a:visited { color:#24374C; text-decoration:none; } a:active { outline: none; color:#24374C; text-decoration:none; } body {background-color:#b0c4de} div.box { width:250px; padding:10px; border:3px double #000000; margin:10px; background-color:#74AFF2; } p { border-top-style:dotted; border-right-style:solid; border-bottom-style:dotted; border-left-style:solid; } div.menu-blue { BORDER-RIGHT: #333366 1px solid; BORDER-LEFT: #6699cc 1px solid; BORDER-TOP: #6699cc 1px solid; BORDER-BOTTOM: #333366 1px solid; FONT-WEIGHT: normal; COLOR: #ffffff; BACKGROUND-COLOR: #23559C; TEXT-DECORATION: none; font-stretch : condensed; } .menu-top { BORDER-RIGHT: 1px solid #333366; BORDER-TOP: 1px solid #6699CC; FONT-WEIGHT: normal; BORDER-LEFT: 1px solid #6699CC; COLOR: #FFFFFF; BORDER-BOTTOM: 1px solid #333366; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; BACKGROUND-COLOR: #23559C; TEXT-DECORATION: none; font-stretch : condensed } </style> <center> <div class='menu-blue'> <div align="center"> <table width="600" cellspacing="1" cellpadding="5" style="background-color:#23559C"> <tr> <td style="background-color:#FFFFFF"> <div align="center"> <table border="0"> </form> </table> <center> <form action="profiles.php?username="<?php echo $name; ?> method="GET"><br /><br /> Member name:<input type='text' name='name'></form> </center> <?php $name = $_GET['name']; $connect = mysql_connect("$dbhost","$dbuser","$dbpassword") or die("Connection failed!"); mysql_select_db("$db") or die("Database fail!"); //display data $get = mysql_query("SELECT * FROM users WHERE username='$name'"); while ($row = mysql_fetch_assoc($get)) // get data $signature = $row['signature']; $posts = $row['post_count']; $query = mysql_query("SELECT * FROM users WHERE username='$name'"); $numrows = mysql_num_rows($query); if ($numrows!=1) { echo "<div class='box'><b><span style='color:red'>This user doesn't exists!</span></b></div>"; } else { if ($name =="$owner") $name = " <img src='crown_gold.gif'></img><b> $owner</b>"; if ($name =="Pie`") $name = " <img src='crown_gold.gif'></img><b> Pie`</b>"; if ($name =="Soulze") $name = " <img src='crown_gold.gif'></img><b> Soulze</b>"; if ($name =="Palace") $name = " <img src='mod_silver.gif'></img><b> Palace</b>"; if ($name =="Pkerown") $name = " <img src='mod_silver.gif'></img><b> Pkerown</b>"; if ($name =="ballin") $name = "<img src='gfx.gif'></img><span style='color:#6666FF'><b> ballin<br /></b></span>" echo "<div class='box'>This is a profile of "; echo $name; echo "<br /><br />Signature:<b> "; echo $signature; echo "<br /><br /><br />Post count:<b>."$posts."</b></div>"; } ?> Quote Link to comment Share on other sites More sharing options...
smerny Posted October 18, 2009 Share Posted October 18, 2009 while ($row = mysql_fetch_assoc($get)) // get data i'm assuming there should be an opening bracket? Quote Link to comment Share on other sites More sharing options...
smerny Posted October 18, 2009 Share Posted October 18, 2009 <form action="profiles.php?username="<?php echo $name; ?> method="GET"> this also does not look right to me, i'm assuming you're looking for something more like: <form action="profiles.php?username=<?php echo $name; ?>" method="GET"> Quote Link to comment Share on other sites More sharing options...
ldb358 Posted October 18, 2009 Share Posted October 18, 2009 On the last line: echo "<br /><br /><br />Post count:<b>."$posts."</b></div>"; Should be: echo "<br /><br /><br />Post count:<b>".$posts."</b></div>"; Quote Link to comment Share on other sites More sharing options...
MySQL_Narb Posted October 18, 2009 Author Share Posted October 18, 2009 New code with the same error. <?php require "global_settings.php"; ?> <title><?php echo $sitetitle; ?></title> <font face='arial' size='3'></a> <?php session_start(); ?> <center> <style> a:link { color:#24374C; text-decoration:none; } a:visited { color:#24374C; text-decoration:none; } a:active { outline: none; color:#24374C; text-decoration:none; } body {background-color:#b0c4de} div.box { width:250px; padding:10px; border:3px double #000000; margin:10px; background-color:#74AFF2; } p { border-top-style:dotted; border-right-style:solid; border-bottom-style:dotted; border-left-style:solid; } div.menu-blue { BORDER-RIGHT: #333366 1px solid; BORDER-LEFT: #6699cc 1px solid; BORDER-TOP: #6699cc 1px solid; BORDER-BOTTOM: #333366 1px solid; FONT-WEIGHT: normal; COLOR: #ffffff; BACKGROUND-COLOR: #23559C; TEXT-DECORATION: none; font-stretch : condensed; } .menu-top { BORDER-RIGHT: 1px solid #333366; BORDER-TOP: 1px solid #6699CC; FONT-WEIGHT: normal; BORDER-LEFT: 1px solid #6699CC; COLOR: #FFFFFF; BORDER-BOTTOM: 1px solid #333366; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; BACKGROUND-COLOR: #23559C; TEXT-DECORATION: none; font-stretch : condensed } </style> <center> <div class='menu-blue'> <div align="center"> <table width="600" cellspacing="1" cellpadding="5" style="background-color:#23559C"> <tr> <td style="background-color:#FFFFFF"> <div align="center"> <table border="0"> </form> </table> <center> <form action="profiles.php?username="<?php echo $name; ?>" method="GET"><br /><br /> Member name:<input type='text' name='name'></form> </center> <?php $name = $_GET['name']; $connect = mysql_connect("$dbhost","$dbuser","$dbpassword") or die("Connection failed!"); mysql_select_db("$db") or die("Database fail!"); //display data $get = mysql_query("SELECT * FROM users WHERE username='$name'"); while ($row = mysql_fetch_assoc($get)) // get data $signature = $row['signature']; $posts = $row['post_count']; $query = mysql_query("SELECT * FROM users WHERE username='$name'"); $numrows = mysql_num_rows($query); if ($numrows!=1) { echo "<div class='box'><b><span style='color:red'>This user doesn't exists!</span></b></div>"; } else { if ($name =="$owner") $name = " <img src='crown_gold.gif'></img><b> $owner</b>"; if ($name =="Pie`") $name = " <img src='crown_gold.gif'></img><b> Pie`</b>"; if ($name =="Soulze") $name = " <img src='crown_gold.gif'></img><b> Soulze</b>"; if ($name =="Palace") $name = " <img src='mod_silver.gif'></img><b> Palace</b>"; if ($name =="Pkerown") $name = " <img src='mod_silver.gif'></img><b> Pkerown</b>"; if ($name =="ballin") $name = "<img src='gfx.gif'></img><span style='color:#6666FF'><b> ballin<br /></b></span>" echo "<div class='box'>This is a profile of "; echo $name; echo "<br /><br />Signature:<b> "; echo $signature; echo "<br /><br /><br />Post count:<b>".$posts."</b></div>"; } ?> Quote Link to comment Share on other sites More sharing options...
smerny Posted October 18, 2009 Share Posted October 18, 2009 <form action="profiles.php?username="<?php echo $name; ?>" method="GET"> this evaluates to <form action="profiles.php?username="myname" method="GET"> you don't want the " before the <?php Quote Link to comment Share on other sites More sharing options...
smerny Posted October 18, 2009 Share Posted October 18, 2009 while ($row = mysql_fetch_assoc($get)) not sure why you are using the while? it's not really an error i guess, but theres no point $row = mysql_fetch_assoc($get) would do just fine Quote Link to comment Share on other sites More sharing options...
smerny Posted October 18, 2009 Share Posted October 18, 2009 ah, here it is if ($name =="ballin") $name = "<img src='gfx.gif'></img><span style='color:#6666FF'><b> ballin<br /></b></span>" missing a ; Quote Link to comment Share on other sites More sharing options...
MySQL_Narb Posted October 18, 2009 Author Share Posted October 18, 2009 Thanks, it's working. Any Idea on how I can get the $posts to display? It keeps echoing out as a blank. Quote Link to comment Share on other sites More sharing options...
Kaboom Posted October 18, 2009 Share Posted October 18, 2009 Thanks, it's working. Any Idea on how I can get the $posts to display? It keeps echoing out as a blank. Have it loading from a database maybe? .... Quote Link to comment Share on other sites More sharing options...
smerny Posted October 18, 2009 Share Posted October 18, 2009 he does.... $get = mysql_query("SELECT * FROM users WHERE username='$name'"); $row = mysql_fetch_assoc($get); $posts = $row['post_count']; echo "<br /><br /><br />Post count:<b>".$posts."</b></div>"; I don't see why it wouldn't work, as long as 'post_count' is a field in your users table that has a number of posts? Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted October 18, 2009 Share Posted October 18, 2009 try doing a print_r on the $row array, and post what it says Quote Link to comment 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.