EagleAmerican Posted July 22, 2007 Share Posted July 22, 2007 Hi and much thanks to whomever can help me with my problem. I've tried it for hours to get it myself but just can't. So here goes: Error Message when trying to go to page: Parse error: parse error, unexpected T_VARIABLE, expecting ',' or ';' in /home/www/blah.blah/add_parasite.php on line 66 PHP lines causing problem: if (isset($_POST['parasitename'])) { $parasitename = $_POST['parasitename']; $parasitefrom = $_POST['parasitefrom']; $parasitegenre = $_POST['parasitegenre']; $parasitedescription = $_POST['parasitedescription']; $parasitetechinfo = $_POST['parasitetechinfo']; $sql = "INSERT INTO parasite SET parasitename='$parasitename', parasitefrom='$parasitefrom', parasitegenre='$parasitegenre', parasitedescription='$parasitedescription', parasitetechinfo='$parasitetechinfo', parasitedateadded=CURDATE()"; if (@mysql_query($sql)) { echo '<p>The parasite '$parasitename' has been added.</p>'; } else { echo '<p>Error adding submitted parasite: ' . mysql_error() . '</p>'; } } Thanks, Adam Quote Link to comment Share on other sites More sharing options...
Hypnos Posted July 22, 2007 Share Posted July 22, 2007 You were using single quotes inside of single quotes. Next time please point out what line is 66. <?php if (isset($_POST['parasitename'])) { $parasitename = $_POST['parasitename']; $parasitefrom = $_POST['parasitefrom']; $parasitegenre = $_POST['parasitegenre']; $parasitedescription = $_POST['parasitedescription']; $parasitetechinfo = $_POST['parasitetechinfo']; $sql = "INSERT INTO parasite SET parasitename='$parasitename', parasitefrom='$parasitefrom', parasitegenre='$parasitegenre', parasitedescription='$parasitedescription', parasitetechinfo='$parasitetechinfo', parasitedateadded=CURDATE()"; if (@mysql_query($sql)) { echo "<p>The parasite '$parasitename' has been added.</p>"; } else { echo '<p>Error adding submitted parasite: ' . mysql_error() . '</p>'; } } Quote Link to comment Share on other sites More sharing options...
EagleAmerican Posted July 22, 2007 Author Share Posted July 22, 2007 Hi and thanks so much for your help. That part works now. However now I can't get it to list all of the parasites in the database. The message I get is: Parasite list: Error performing query1: Here's the coding where the problem occurs: echo '<p>Parasite list:</p>'; $name = @mysql_query('SELECT parasitename FROM parasite'); if (!$result) { exit('<p>Error performing query1: ' . mysql_error() . '</p>'); } $from = @mysql_query('SELECT parasitefrom FROM parasite'); if (!$result) { exit('<p>Error performing query2: ' . mysql_error() . '</p>'); } $genre = @mysql_query('SELECT parasitegenre FROM parasite'); if (!$result) { exit('<p>Error performing query3: ' . mysql_error() . '</p>'); } $description = @mysql_query('SELECT parasitedescription FROM parasite'); if (!$result) { exit('<p>Error performing query4: ' . mysql_error() . '</p>'); } $techinfo = @mysql_query('SELECT parasitetechinfo FROM parasite'); if (!$result) { exit('<p>Error performing query5: ' . mysql_error() . '</p>'); } And the MySQL is structured like this: Full Texts id parasitename parasitefrom parasitegenre parasitedescription parasitetechinfo parasiteadddate Edit Delete 1 Test.Blah Unknown Unknown This is a Test Parasite. Test Parasite. 0000-00-00 Quote Link to comment Share on other sites More sharing options...
Hypnos Posted July 22, 2007 Share Posted July 22, 2007 Your result variables aren't consistant. <?php $name = @mysql_query('SELECT parasitename FROM parasite'); if (!$result) { exit('<p>Error performing query1: ' . mysql_error() . '</p>'); } Should be: <?php $name = @mysql_query('SELECT parasitename FROM parasite'); if (!$name) { exit('<p>Error performing query1: ' . mysql_error() . '</p>'); } Notice how the var used in the IF statement is now the same as the one used in mysql_query? That's how it's suppose to be. Quote Link to comment Share on other sites More sharing options...
EagleAmerican Posted July 22, 2007 Author Share Posted July 22, 2007 Ohh.. thank you so much. This is very deeply appreciated and I am so glad I found this wonderful place. This is my first PHP site and I'm doing it for a friend and this has help so much. Thanks, Adam 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.