Forum Moderators: coopster

Message Too Old, No Replies

Parse error: parse error, unexpected T_STRING, expecting ',' or ';'

parse error

         

shamilton712

11:11 pm on Jun 5, 2004 (gmt 0)



receive Parse error: parse error, unexpected T_STRING, expecting ',' or ';' on line 30

<?php
if ($submit == "click"){
PutEnv("ORACLE_SID=Banking");
$conn = OCILogon("user","pass");
if($conn == false){
echo OCIError($conn)."<BR>";
exit;
}
$query = "update customer set streetaddress = '$address', state = '$state', city = '$city', zip ='zip' where social = '108901234'";
$cursor = OCIParse ($conn, $query);
if ($cursor == false){
echo OCIError($cursor)."<BR>";
exit;
}
$result = OCIExecute($cursor);
if ($result ==false){
echo OCIError($cursor)."<BR>";
exit;
}
OCICommit($conn);
OCILogoff($conn);
}
else{
echo "<html>";
echo "<head>";
echo "<title>some title</title>";
echo "</head>";
echo "<body>";
echo "<form method ="post" action= "updatecustomer.php">";
echo "<p><strong>Street Address:</strong><input type ="text" name ="address" maxlength= 40>";
echo "<p><strong>City:</strong><input type ="text" name="city" maxlength= 15>";
echo "<p><strong>State:</strong><input type = "text" name="state" maxlength = 2>";
echo "<p><strong>Zip:</strong><input type = "text" name="zip" maxlength = 5>";
echo "<input type ="submit" name= "submit" value = "click"><input type= "reset" value= "Clear">";
echo "</form>";
echo "</body>";
echo "</html>";
}
?>

these are lines 29 and 30
echo "<body>";
echo "<form method ="post" action= "updatecustomer.php">";

Please Help Thanks

[edited by: jatar_k at 5:00 am (utc) on June 6, 2004]
[edit reason] removed specifics [/edit]

ikbenhet1

11:27 pm on Jun 5, 2004 (gmt 0)

10+ Year Member



replace line 30 with: echo "<form method =\"post\" action= \"updatecustomer.php\">";

but then you will get parse error on line 31.

you need yo replace all " with \" like above in the echo's exept the first and the last "

ps. you put zip in stead of $zip in the update above

carneddau

11:30 pm on Jun 5, 2004 (gmt 0)

10+ Year Member



Hi,

You need to escape quotes in the string you are echoing:

echo "<form method ="post" action= "updatecustomer.php">";

should be:

echo "<form method=\"post\" action= \"updatecustomer.php\">";

Rather than escaping all of the quotes in that html chunk you can switch out of php like so:

<?php

your code here

else{
?>
<html>
<head>
<title>Wachovia Bank-Sean's Bank</title>
</head>
<?php
}
?>

Hope that helps

zendak

12:07 pm on Jun 7, 2004 (gmt 0)

10+ Year Member



Another option would be to use single quotes for the "outer" quotes that surround the echo string and double quotes for the html attributes etc. That way you don't have to escape the double quotes all the time.

Example:


echo '<form method ="post" action= "updatecustomer.php">';

The drawback is that within single-quoted strings, PHP doesn't interpret variables. So

$number = 5;
echo 'My number is $number.';

will produce
My number is $number.

whereas

$number = 5;
echo "My number is $number.";

will produce
My number is 5.

So it depends on the overall situation what's more efficient.