Forum Moderators: coopster

Message Too Old, No Replies

Parse error: syntax error, unexpected T STRING

problem with if statement i guess

         

haroon

6:25 pm on Apr 25, 2008 (gmt 0)

10+ Year Member



Hello Sir,
its my very first post over here as i found this forum a helping and dedicated to solve the most common problems in php..

Lets get to the error...

heres my code...

<?php

include(config.php);

$Date1=$_POST['Date1'];
$Date2=$_POST['Date2'];
$Date3=$_POST['Date3'];
$News1=$_POST['News1'];
$News2=$_POST['News2'];
$News3=$_POST['News3'];

$sql="INSERT INTO $tbl_name(Date1, News1, Date2, News2, Date3, News3)VALUES('$Date1', '$News1', '$Date2', '$News2', '$Date3', '$News3');

$result=mysql_query($sql);

if ($result)
{
echo "successfull";
}
else
{
echo "ERROR";
}

mysql_close();

?>

ERROR IS :
Parse error: syntax error, unexpected T_STRING in insertnews.php on line 19

can anyone please solve my problem
i ll b very thankfull to you.

henry0

6:48 pm on Apr 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$sql="INSERT INTO $tbl_name(Date1, News1, Date2, News2, Date3, News3)VALUES('$Date1', '$News1', '$Date2', '$News2', '$Date3', '$News3');

haroon, wellcome to WebmasterWorld!

You start a double quote in: $sql="INSERT
but do not close that statement (missing a double quote at end of statement).

haroon

6:34 pm on May 5, 2008 (gmt 0)

10+ Year Member



hey thn#*$!xx henry ...
well i was soo quick to post but i realize after posting that problem is in sql statement.. but thnxx newayy....
nice forum ;)

haroon

6:37 pm on May 5, 2008 (gmt 0)

10+ Year Member



could u please guide me how to add a new field in table from a php page ?
i want user to add or delete fields so he can add or modify the data from mysql.

jatar_k

6:52 pm on May 5, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you would have to use alter table [dev.mysql.com] statements