frostyhorse Posted August 28, 2009 Share Posted August 28, 2009 <? session_name('usersession'); session_start(); ?> <html> <head> <title>Equine Revolution's Equine Registry</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <center> <table id="main"> <tr><td> <p><h1>Register A Horse</h1> <? if(!isset($peacock)) { include('menu2.php'); include('loginform.php'); exit(); } else { include('menu1.php'); echo " <p> <form action="insert.php" method="post"> Name: <input type="text" name="name" /> <br> Age: <input type="text" name="age" /> <br> Breed: <input type="text" name="breed" /> <br> Color: <input type="text" name="color" /> <br> Height: <input type="text" name="height" /> <br> Gender: <input type="text" name="gender" /> <br> Sire: <input type="text" name="sire" /> <br> Sire's Sire: <input type="text" name="siresire" /> <br> Sire's Dam: <input type="text" name="siredam" /> <br> Dam: <input type="text" name="dam" /> <br> Dam's Sire: <input type="text" name="damsire" /> <br> Dam's Dam: <input type="text" name="damdam" /> <br> Owner: <input type="text" name="owner" /> <br> Origins: <input type="text" name="origins" /> <br> Type: <input type="text" name="type" /> <br> <input type="submit" /> </form> </p>; } ?> <p> <? include('foot.php'); ?> </p> </td></tr> <tr><td></td></tr> </table> </center> </body> </html> Error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/www/erregistry.awardspace.us/register.php on line 31 Quote Link to comment Share on other sites More sharing options...
ReKoNiZe Posted August 28, 2009 Share Posted August 28, 2009 <? session_name('usersession'); session_start(); ?> <html> <head> <title>Equine Revolution's Equine Registry</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <center> <table id="main"> <tr><td> <p><h1>Register A Horse</h1> <? if(!isset($peacock)) { include('menu2.php'); include('loginform.php'); exit(); } else { include('menu1.php'); echo ' <p> <form action="insert.php" method="post"> Name: <input type="text" name="name" /> <br> Age: <input type="text" name="age" /> <br> Breed: <input type="text" name="breed" /> <br> Color: <input type="text" name="color" /> <br> Height: <input type="text" name="height" /> <br> Gender: <input type="text" name="gender" /> <br> Sire: <input type="text" name="sire" /> <br> Sire's Sire: <input type="text" name="siresire" /> <br> Sire's Dam: <input type="text" name="siredam" /> <br> Dam: <input type="text" name="dam" /> <br> Dam's Sire: <input type="text" name="damsire" /> <br> Dam's Dam: <input type="text" name="damdam" /> <br> Owner: <input type="text" name="owner" /> <br> Origins: <input type="text" name="origins" /> <br> Type: <input type="text" name="type" /> <br> <input type="submit" /> </form> </p>'; } ?> <p> <? include('foot.php'); ?> </p> </td></tr> <tr><td></td></tr> </table> </center> </body> </html> You were using echo with double-quotations and then using double-quotations for all of your form/html stuff. You also did not end your echo. Copy the code above, changed echo " to echo ' and also put the last ' before your semicolon. Quote Link to comment Share on other sites More sharing options...
Maq Posted August 28, 2009 Share Posted August 28, 2009 In your giant echo statement you should be using single quotes for the HTML attributes, as the first double quote is interpreted as the echo termination expecting a semi-colon. Quote Link to comment Share on other sites More sharing options...
frostyhorse Posted August 28, 2009 Author Share Posted August 28, 2009 Here is the updated code that I fixed: <? session_name('usersession'); session_start(); ?> <html> <head> <title>Equine Revolution's Equine Registry</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <center> <table id="main"> <tr><td> <p><h1>Register A Horse</h1> <? if(!isset($peacock)) { include('menu2.php'); include('loginform.php'); exit(); } else { include('menu1.php'); echo ' <p> <form action='insert.php' method='post'> Name: <input type='text' name='name' /> <br> Age: <input type='text' name='age' /> <br> Breed: <input type='text' name='breed' /> <br> Color: <input type='text' name='color' /> <br> Height: <input type='text' name='height' /> <br> Gender: <input type='text' name='gender' /> <br> Sire: <input type='text' name='sire' /> <br> Sire's Sire: <input type='text' name='siresire' /> <br> Sire's Dam: <input type='text' name='siredam' /> <br> Dam: <input type='text' name='dam' /> <br> Dam's Sire: <input type='text' name='damsire' /> <br> Dam's Dam: <input type='text' name='damdam' /> <br> Owner: <input type='text' name='owner' /> <br> Origins: <input type='text' name='origins' /> <br> Type: <input type='text' name='type' /> <br> <input type='submit' /> </form> </p>'; } ?> <p> <? include('foot.php'); ?> </p> </td></tr> <tr><td></td></tr> </table> </center> </body> </html> And I'm still getting the same error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/www/erregistry.awardspace.us/register.php on line 31 Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 28, 2009 Share Posted August 28, 2009 Look at ReKoNiZe's post that will fix your error. Quote Link to comment Share on other sites More sharing options...
ReKoNiZe Posted August 28, 2009 Share Posted August 28, 2009 When you use echo, you have to use either single quotes or double quotes. So Echo 'Hello' or echo "Hello". Take the follow sentence for example. John said, "Hello, my name is John". You would use echo with single quotes. echo ' John said, "Hello, my name is John".'; If you used double quotes, you would be ending the end of the echo. Hope that makes sense:) Quote Link to comment Share on other sites More sharing options...
Maq Posted August 28, 2009 Share Posted August 28, 2009 Note that variables will not interpolate in single quoted strings. Quote Link to comment Share on other sites More sharing options...
frostyhorse Posted August 28, 2009 Author Share Posted August 28, 2009 I copied and pasted ReKoNiZe's code and that didn't fix the problem. The same error, this time on line 39. Quote Link to comment Share on other sites More sharing options...
ReKoNiZe Posted August 28, 2009 Share Posted August 28, 2009 You have Sire's, just like I was explaining earlier, you need to escape those. So for the Sire's and Dam's, do Sire\'s and Dam\'s. Quote Link to comment Share on other sites More sharing options...
frostyhorse Posted August 28, 2009 Author Share Posted August 28, 2009 Ok, I removed the ' from Sire's and now it's working Thanks. I also have this page: <? session_name('usersession'); session_start(); include ('db1.php'); $query = "SELECT * FROM registry WHERE owner='$user' ORDER BY id "; $result = mysql_query($query) or die(mysql_error()); ?> <html> <head> <title>Equine Revolution's Equine Registry</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <center> <table id="main"> <tr><td> <p><h1>My Horses</h1> <br> <? if(!isset($peacock)) { include('menu2.php'); include('loginform.php'); exit(); } else { include('menu1.php'); echo '<br> <? while($row= mysql_fetch_array($result)) { $id = $row[id]; $name = $row[name]; $age = $row[age]; $breed = $row[breed]; $color = $row[color]; $gender = $row[gender]; ?> <? echo $id ?> <a href= 'view.php?id=<? echo $id ?>'><? echo $name ?> </a> <? echo $age ?> <? echo $color ?> <? echo $breed ?> <? echo $gender ?> <br> <?}?> '} ?> </p> <p> <? include('foot.php'); ?> </p> </td></tr> <tr><td></td></tr> </table> </center> </body> </html> and it comes up with the same Parse error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/www/erregistry.awardspace.us/myhorses.php on line 49 Quote Link to comment Share on other sites More sharing options...
ReKoNiZe Posted August 28, 2009 Share Posted August 28, 2009 Change all of this: else { include('menu1.php'); echo '<br> <? while($row= mysql_fetch_array($result)) { $id = $row[id]; $name = $row[name]; $age = $row[age]; $breed = $row[breed]; $color = $row[color]; $gender = $row[gender]; ?> <? echo $id ?> <a href= 'view.php?id=<? echo $id ?>'><? echo $name ?> </a> <? echo $age ?> <? echo $color ?> <? echo $breed ?> <? echo $gender ?> <br> <?}?> '} ?> to this: else { include('menu1.php'); echo '<br /'; while($row= mysql_fetch_array($result)) { $id = $row[id]; $name = $row[name]; $age = $row[age]; $breed = $row[breed]; $color = $row[color]; $gender = $row[gender]; echo $id . "<a href='view.php?id=$id'>$name</a><br />"; echo $age . "<br />"; echo $color . "<br />"; echo $breed . "<br />"; echo $gender . "<br> />"; } ?> Quote Link to comment Share on other sites More sharing options...
frostyhorse Posted August 28, 2009 Author Share Posted August 28, 2009 OK. I changed it to that but I noticed breaks after each line. I want it to be one continue line, with a break at the end, after the "gender" only. So it now reads: <? session_name('usersession'); session_start(); include ('db1.php'); $query = "SELECT * FROM registry WHERE owner='$user' ORDER BY id "; $result = mysql_query($query) or die(mysql_error()); ?> <html> <head> <title>Equine Revolution's Equine Registry</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <center> <table id="main"> <tr><td> <p><h1>My Horses</h1> <br> <? if(!isset($peacock)) { include('menu2.php'); include('loginform.php'); exit(); } else { include('menu1.php'); echo '<br /'; while($row= mysql_fetch_array($result)) { $id = $row[id]; $name = $row[name]; $age = $row[age]; $breed = $row[breed]; $color = $row[color]; $gender = $row[gender]; echo $id . "<a href='view.php?id=$id'>$name</a><br />"; echo $age . "<br />"; echo $color . "<br />"; echo $breed . "<br />"; echo $gender . "<br> />"; } ?> </p> <p> <? include('foot.php'); ?> </p> </td></tr> <tr><td></td></tr> </table> </center> </body> </html> and I get an unexpected $end error on line 70. Parse error: syntax error, unexpected $end in /home/www/erregistry.awardspace.us/myhorses.php on line 70 Quote Link to comment Share on other sites More sharing options...
ReKoNiZe Posted August 28, 2009 Share Posted August 28, 2009 Go ahead and take the breaks out then and for each variable just do echo $variable1 . $variable2 . $variable3 and so forth. I see no issue on line 70. I would make sure you dont have an extra line at the end of your code. Quote Link to comment Share on other sites More sharing options...
frostyhorse Posted August 28, 2009 Author Share Posted August 28, 2009 I removed this part "<br> />"; and now the error has changed from the unexpected ending to: Parse error: syntax error, unexpected T_ECHO in /home/www/erregistry.awardspace.us/myhorses.php on line 49. >.< Quote Link to comment Share on other sites More sharing options...
ReKoNiZe Posted August 28, 2009 Share Posted August 28, 2009 Grab from $id down to $gender and use this instead: echo $id . "<a href='view.php?id=$id'>$name</a>" . $age . $color . $breed . $gender . "<br> />"; Quote Link to comment Share on other sites More sharing options...
frostyhorse Posted August 28, 2009 Author Share Posted August 28, 2009 <? session_name('usersession'); session_start(); include ('db1.php'); $query = "SELECT * FROM registry WHERE owner='$user' ORDER BY id "; $result = mysql_query($query) or die(mysql_error()); ?> <html> <head> <title>Equine Revolution's Equine Registry</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <center> <table id="main"> <tr><td> <p><h1>My Horses</h1> <br> <? if(!isset($peacock)) { include('menu2.php'); include('loginform.php'); exit(); } else { include('menu1.php'); echo '<br />'; while($row= mysql_fetch_array($result)) { $id = $row[id]; $name = $row[name]; $age = $row[age]; $breed = $row[breed]; $color = $row[color]; $gender = $row[gender]; echo $id . "<a href='view.php?id=$id'>$name</a>" . $age . $color . $breed . $gender . "<br> />"; } ?> </p> <p> <? include('foot.php'); ?> </p> </td></tr> <tr><td></td></tr> </table> </center> </body> </html> That's the newest version of the code. I put it in and it says 'unexpected $end on line 65'. I counted down. There is no line 65. Quote Link to comment Share on other sites More sharing options...
Maq Posted August 28, 2009 Share Posted August 28, 2009 You never terminate your last 'else' statement. (and yes there is 65 lines) Quote Link to comment Share on other sites More sharing options...
ReKoNiZe Posted August 28, 2009 Share Posted August 28, 2009 Line 48, you need another bracket. echo $id . "<a href='view.php?id=$id'>$name</a>" . $age . $color . $breed . $gender . "<br> />"; } needs to be: echo $id . "<a href='view.php?id=$id'>$name</a>" . $age . $color . $breed . $gender . "<br> />"; } } You were missing a closing bracket from your else statement. 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.