Jump to content

Archived

This topic is now archived and is closed to further replies.

legohead6

**SOLVED** HELP! parse error driving me nuts!

Recommended Posts

unexpected $ sign on line 60(line 60: "?>")

even after adding a thired close brace to the end the same error is appearing
this page is a final form to order an item!

[code]<?php
SESSION_START();
if(empty($_SESSION['user'])){

echo "You have come to this page by mistake! Please <a href=http://www.zelocalz.com>Click here</a>";
exit;
}

include 'header.php';
$username="***********";
$password="***********";
$database="************";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

if($_GET['me'] == 0)
{
$form1="<p align=center>How Would You Like To Pay?<br><form method=POST><b><input type=radio name=method value=Paypal>Paypal <a href=help/paypal.php>Whats this?</a><br><br><input type=radio name=method value=Cash>Cash In The Mail</b><br><input type=submit name=submit3 value=GO></form>";
}
if(isset($_POST['submit3']))
{
$lid=$_GET['id'];
$lis="SELECT * FROM listings WHERE id='$lid'";
$result3 = mysql_query($lis) or die ("Error in query: $quer3. ".mysql_error());
while($row = mysql_fetch_row($result3))
{
$form1="<a href=home.php>Return Home</a><br>Thank You!<br><a href=invoice.php?id=$lid>View INVOICE</a><br>";
$method=$_POST['method'];
$pick1=0;
$ship1=1;
$lid=$_GET['id'];
$user=$_SESSION['user'];
$query2="INSERT INTO purchased VALUES('','$user','$lid','$ship1','$pick1','$method','$row[5]')";
$result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error());
$mem="SELECT * FROM members WHERE username='$row[5]'";
$result5 = mysql_query($mem) or die ("Error in query: $mem. ".mysql_error());
while($mem = mysql_fetch_row($result5))
{
mail($mem[3],'Item Sold',"Congratulations!, Youve Sold $row[1] To $user! Go To http://www.zelocalz.com To view Invoice!","From:zelocalz<webmaster@zelocalz.com>");

}
}
if($_GET['me'] == 1)
{
$form1="";
echo "Thankyou! <br><a href=invoice.php?id=$lid>View INVOICE</a><br>";
$pick1=1;
$ship1=0;
$pay=0;
$cash=0;
$lid=$_GET['id'];
$lis="SELECT * FROM listings WHERE id='$lid'";
$result3 = mysql_query($lis) or die ("Error in query: $query3. ".mysql_error());
while($row = mysql_fetch_row($result3))
{
$user=$_SESSION['user'];
$query2="INSERT INTO purchased VALUES('','$user','$lid','$ship1','$pick1','0','$row[5]')";
$result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error());
$uplist="UPDATE listings SET sold='1' WHERE id='$lid'";
mysql_query($uplist) or die ("Error in query: $uplist. ".mysql_error());
$mem="SELECT * FROM members WHERE username='$row[5]'";
$result5 = mysql_query($mem) or die ("Error in query: $mem. ".mysql_error());
while($mem = mysql_fetch_row($result5))
{
mail($mem[3],'Item Sold',"Congratulations!, Youve Sold $row[1] To $user! Go To http://www.zelocalz.com To view Invoice!","From:zelocalz<webmaster@zelocalz.com>");
}
}
}
echo "$form1";
?>[/code]

Share this post


Link to post
Share on other sites
} add another brace } to the bottom ok it's missing?

[code]

<?php session_start();

if(empty($_SESSION['user'])){ //<< brace open

echo "You have come to this page by mistake! Please <a href=http://www.zelocalz.com>Click here</a>";
exit;

}//<< brace closed

include 'header.php';
$username="***********";
$password="***********";
$database="************";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

if($_GET['me'] == 0){// brace oped

$form1="<p align=center>How Would You Like To Pay?<br><form method=POST><b><input type=radio name=method value=Paypal>Paypal <a href=help/paypal.php>Whats this?</a><br><br><input type=radio name=method value=Cash>Cash In The Mail</b><br><input type=submit name=submit3 value=GO></form>";

}//<< brace closed

if(isset($_POST['submit3'])){ //<< brace open
$lid=$_GET['id'];
$lis="SELECT * FROM listings WHERE id='$lid'";
$result3 = mysql_query($lis) or die ("Error in query: $quer3. ".mysql_error());
while($row = mysql_fetch_row($result3)){//<< brace open
$form1="<a href=home.php>Return Home</a><br>Thank You!<br><a href=invoice.php?id=$lid>View INVOICE</a><br>";
$method=$_POST['method'];
$pick1=0;
$ship1=1;
$lid=$_GET['id'];
$user=$_SESSION['user'];
$query2="INSERT INTO purchased VALUES('','$user','$lid','$ship1','$pick1','$method','$row[5]')";
$result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error());
$mem="SELECT * FROM members WHERE username='$row[5]'";
$result5 = mysql_query($mem) or die ("Error in query: $mem. ".mysql_error());
while($mem = mysql_fetch_row($result5)){
mail($mem[3],'Item Sold',"Congratulations!, Youve Sold $row[1] To $user! Go To http://www.zelocalz.com To view Invoice!","From:zelocalz<webmaster@zelocalz.com>");

} //<< brace closed
}//<< brace closed

if($_GET['me'] == 1){//<<brace open
$form1="";
echo "Thankyou! <br><a href=invoice.php?id=$lid>View INVOICE</a><br>";
$pick1=1;
$ship1=0;
$pay=0;
$cash=0;
$lid=$_GET['id'];
$lis="SELECT * FROM listings WHERE id='$lid'";

$result3 = mysql_query($lis) or die ("Error in query: $query3. ".mysql_error());

while($row = mysql_fetch_row($result3)){//<< brace open
$user=$_SESSION['user'];
$query2="INSERT INTO purchased VALUES('','$user','$lid','$ship1','$pick1','0','$row[5]')";
$result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error());
$uplist="UPDATE listings SET sold='1' WHERE id='$lid'";
mysql_query($uplist) or die ("Error in query: $uplist. ".mysql_error());
$mem="SELECT * FROM members WHERE username='$row[5]'";
$result5 = mysql_query($mem) or die ("Error in query: $mem. ".mysql_error());

while($mem = mysql_fetch_row($result5)){//<<brace open

mail($mem[3],'Item Sold',"Congratulations!, Youve Sold $row[1] To $user! Go To http://www.zelocalz.com To view Invoice!","From:zelocalz<webmaster@zelocalz.com>");
}//<<brace closed
}//<<brace closed
}//<<brace now closed but wasnt there 1 min ago.
echo "$form1";
?>
[/code]

Share this post


Link to post
Share on other sites
An error like that is usually caused by mis-matched curly braces or an unterminated string.

Please edit your above post to:
[list]
[*]Change the case of your opening "<?PHP" to "<?php"
[*]Indent your code correctly, which will make unbalanced curly braces much easier to find.
[/list]

Ken

Share this post


Link to post
Share on other sites
its not a curly brace prob i have tryed adding then on at the end and it still shows the error just another line down..

Share this post


Link to post
Share on other sites
I found two missing curly brackets, see comments in code
[code]
<?php
SESSION_START();
if(empty($_SESSION['user'])){
echo "You have come to this page by mistake! Please <a href=http://www.zelocalz.com>Click here</a>";
exit;
}
include 'header.php';
$username="***********";
$password="***********";
$database="************";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

if($_GET['me'] == 0){
$form1="<p align=center>How Would You Like To Pay?<br><form method=POST><b><input type=radio name=method value=Paypal>Paypal <a href=help/paypal.php>Whats this?</a><br><br><input type=radio name=method value=Cash>Cash In The Mail</b><br><input type=submit name=submit3 value=GO></form>";
}
if(isset($_POST['submit3'])){
$lid=$_GET['id'];
$lis="SELECT * FROM listings WHERE id='$lid'";
$result3 = mysql_query($lis) or die ("Error in query: $quer3. ".mysql_error());
while($row = mysql_fetch_row($result3)){
$form1="<a href=home.php>Return Home</a><br>Thank You!<br><a href=invoice.php?id=$lid>View INVOICE</a><br>";
$method=$_POST['method'];
$pick1=0;
$ship1=1;
$lid=$_GET['id'];
$user=$_SESSION['user'];
$query2="INSERT INTO purchased VALUES('','$user','$lid','$ship1','$pick1','$method','$row[5]')";
$result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error());
$mem="SELECT * FROM members WHERE username='$row[5]'";
$result5 = mysql_query($mem) or die ("Error in query: $mem. ".mysql_error());
while($mem = mysql_fetch_row($result5)){
mail($mem[3],'Item Sold',"Congratulations!, Youve Sold $row[1] To $user! Go To http://www.zelocalz.com To view Invoice!","From:zelocalz<webmaster@zelocalz.com>");

}
}
} // <-----######################## } WAS  MISSING #############################
if($_GET['me'] == 1){
$form1="";
echo "Thankyou! <br><a href=invoice.php?id=$lid>View INVOICE</a><br>";
$pick1=1;
$ship1=0;
$pay=0;
$cash=0;
$lid=$_GET['id'];
$lis="SELECT * FROM listings WHERE id='$lid'";
$result3 = mysql_query($lis) or die ("Error in query: $query3. ".mysql_error());
while($row = mysql_fetch_row($result3)){
$user=$_SESSION['user'];
$query2="INSERT INTO purchased VALUES('','$user','$lid','$ship1','$pick1','0','$row[5]')";
$result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error());
$uplist="UPDATE listings SET sold='1' WHERE id='$lid'";
mysql_query($uplist) or die ("Error in query: $uplist. ".mysql_error());
$mem="SELECT * FROM members WHERE username='$row[5]'";
$result5 = mysql_query($mem) or die ("Error in query: $mem. ".mysql_error());
while($mem = mysql_fetch_row($result5)){
mail($mem[3],'Item Sold',"Congratulations!, Youve Sold $row[1] To $user! Go To http://www.zelocalz.com To view Invoice!","From:zelocalz<webmaster@zelocalz.com>");
}
}
} // <-----######################## } WAS  MISSING #############################
echo "$form1";
?>
[/code]

I would recomend getting a free php editor that will highlight syntax for you - a good and easy one is PHP Editor on http://www.mpsoftware.dk/ (http://www.mpsoftware.dk/downloads.php)

Share this post


Link to post
Share on other sites
IT needed 2 more braces..hmm i wonder how i missed that! Thanks for the help ITS solved know!

Share this post


Link to post
Share on other sites
[code]
<?php
SESSION_START();
if(empty($_SESSION['user'])){
echo "You have come to this page by mistake! Please <a href=http://www.zelocalz.com>Click here</a>";
exit;
}
include ('header.php');
$username="***********";
$password="***********";
$database="************";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

if($_GET['me'] == 0){
$form1="<p align=center>How Would You Like To Pay?<br>
<form method=POST><b>
<input type=radio name=method value=Paypal>Paypal <a href=help/paypal.php>Whats this?</a>
<br><br>
<input type=radio name=method value=Cash>Cash In The Mail</b>
<br>
<input type=submit name=submit3 value=GO></form>";
}
if(isset($_POST['submit3'])){
$lid=$_GET['id'];
$lis="SELECT * FROM listings WHERE id='$lid'";
$result3 = mysql_query($lis) or die ("Error in query: $quer3. ".mysql_error());
while($row = mysql_fetch_row($result3)){
$form1="<a href=home.php>Return Home</a>
<br>Thank You!<br><a href=invoice.php?id=$lid>View INVOICE</a>
<br>";
$method=$_POST['method'];
$pick1='0';
$ship1='1';
$lid=$_GET['id'];
$user=$_SESSION['user'];
$query2="INSERT INTO purchased VALUES('','$user','$lid','$ship1','$pick1','$method','$row[5]')";
$result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error());
$mem="SELECT * FROM members WHERE username='$row[5]'";
$result5 = mysql_query($mem) or die ("Error in query: $mem. ".mysql_error());
while($mem = mysql_fetch_row($result5)){
mail($mem[3],'Item Sold',"Congratulations!, Youve Sold $row[1] To $user! Go To http://www.zelocalz.com To view Invoice!","From:zelocalz<webmaster@zelocalz.com>");

};
};
if($_GET['me'] == 1){
$form1="";
echo "Thankyou! <br><a href=invoice.php?id=$lid>View INVOICE</a><br>";
$pick1='0';
$ship1='0';
$pay='0';
$cash='0';
$lid=$_GET['id'];
$lis="SELECT * FROM listings WHERE id='$lid'";
$result3 = mysql_query($lis) or die ("Error in query: $query3. ".mysql_error());
while($row = mysql_fetch_row($result3)){
$user=$_SESSION['user'];
$query2="INSERT INTO purchased VALUES('','$user','$lid','$ship1','$pick1','0','$row[5]')";
$result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error());
$uplist="UPDATE listings SET sold='1' WHERE id='$lid'";
mysql_query($uplist) or die ("Error in query: $uplist. ".mysql_error());
$mem="SELECT * FROM members WHERE username='$row[5]'";
$result5 = mysql_query($mem) or die ("Error in query: $mem. ".mysql_error());
while($mem = mysql_fetch_row($result5)){
mail($mem[3],'Item Sold',"Congratulations! You have sold $row[1] To $user! Go To http://www.zelocalz.com To view Invoice!","From:zelocalz<webmaster@zelocalz.com>");
}
}
}
}
echo "$form1";
?>
[/code]

more organized code if you want :P

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.