T_CONSTANT_ENCAPSED_STRING error
Posted by: manishrathi (173.239.181.---)
Date: October 17, 2012 11:41PM

I am using wamp server on windows 7 home premium

I am getting following error while running this script

"Parse error: syntax error, unexpected '"Error connecting to database"' (T_CONSTANT_ENCAPSED_STRING) in C:\wamp\www\abductionmail.php on line 34"

<html>
<head>
</head>

<body>
<?php
$fname = $_POST['firstname'];
$lname = $_POST['lastname'];
$email = $_POST['emailid'];
$when = $_POST['happenedon'];
$howlong = $_POST['gonefor'];
$whosaw = $_POST['seenby'];
$description = $_POST['describe'];
$what = $_POST['whatdidtheydo'];

$add = $_POST['anythingtoadd'];

echo "Your first name is ".$fname."<br />";
echo "Your last name is ".$lname."<br />";
echo "Your email is ".$email."<br />";
echo "Your dog is gone since ".$when."<br />";
echo "Your dog is gone for ".$howlong."<br />";
echo "Your dog was seen by ".$whosaw."<br />";
echo "Your dog looked ".$description."<br />";
echo "They ".$what."<br /><br />";
echo "Thanks for Reporting Abduction" ;

$to = "jigneshjsoni@gmail.com";
$sub = "New Abduction Report" ;
$msg = "We received new report for dog abduction from ".$fname." ".$lname ;

mail($to, $sub, $msg) ;
echo "report is sent" ;

$connect = mysqli_connect("localhost", "root", "", "phptest", ) or die "Error connecting to database";
$query1 = "insert into gwar (firstname, lastname, whenithappened, howlong, description, whattheydid,".
"didyousee, email) values ($fname, $lname, $when, $howlong, $description, $what, $email)";

mysqli_query($connect, $query1);

$query2 = "select * from gwar" ;

$result = mysqli_query($connect, $query2);

echo $result;

while(mysqli_fetch_array()){
$arr = mysqli_fetch_array();
echo $arr ;
}
?>
</body>
</html>

What can this be due to ?




I FIGURED OUT, WHATS WRONG AND I HAVE CORRECTED IT. I HAVE ANOTHER ISSUE NOW, WHICH IS IN SEPARATE THREAD



Edited 1 time(s). Last edit at 10/18/2012 12:37AM by manishrathi.

Options: ReplyQuote
Re: T_CONSTANT_ENCAPSED_STRING error
Posted by: RiggsFolly (---.as13285.net)
Date: October 19, 2012 10:49AM

manishrathi,

Sorry but this is not a site for help with basic PHP coding but there are other sites you can find.

Options: ReplyQuote


Sorry, only registered users may post in this forum.