strujillo Posted August 10, 2008 Share Posted August 10, 2008 please help i cant figure out where the heck this is coming from im about to go crazy here...*cry cry* <? //This code checks to make sure they are logged in BEFORE they can access the webpage session_start(); if(!isset($_SESSION['myusername'])){ //If he is not logged in, go to index.php header("location:index.php"); }else{ //If he is logged in do nothing and go on to the rest of the code. } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Send Status</title> </head> <body> <?php //Includes header file include("header.php"); ?> <div id="Mbody"> <?php //declares database variables $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="abhs"; // Database name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sendto=$_POST['sendto']; //inserts the data into the database. ERROR IS PRODUCED HERE FOR SOME REASON??? HERE IS WHAT THE ERROR SAYS. //Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\abhs\send_success.php on line 43 $sql='INSERT INTO `abhs`.`messages` (`to` ,`from` ,`subject` ,`message` ) VALUES ( '$_POST['sendto']'; '$_SESSION['myusername']', '$_POST['subject']', '$_POST['message']' )'; $result=mysql_query($sql); if($result){ echo "Successful<BR>"; echo "<a href=members_home.php>View your topic</a>"; } else { echo "ERROR"; } ?> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
Zane Posted August 10, 2008 Share Posted August 10, 2008 usually unexpected T_VARIABLE means that you forgot a semicolon wherever you started a variable at...... that error code should tell you a line number above that line number......you probably forgot the semicolon or put one where there shouldn't have been Quote Link to comment Share on other sites More sharing options...
ratcateme Posted August 10, 2008 Share Posted August 10, 2008 look at my post on you other post WITH THE SAME EXACT PROBLEM DON'T POST TWICE Scott. Quote Link to comment Share on other sites More sharing options...
strujillo Posted August 10, 2008 Author Share Posted August 10, 2008 look at my post on you other post WITH THE SAME EXACT PROBLEM DON'T POST TWICE Scott. JEEZ, sorry scott, lol. ok so i did what you told me to but it fixed the parse error. but no for some reason it doesnt put the information INTO the database. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted August 10, 2008 Share Posted August 10, 2008 after $_POST['sendto'] you have a ';' which will cause a mysql error fix that and change your query to this $result=mysql_query($sql) ot die(mysql_error()); Scott. 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.