Jump to content


Photo

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


  • Please log in to reply
8 replies to this topic

#1 legohead6

legohead6
  • Members
  • PipPipPip
  • Advanced Member
  • 434 posts

Posted 07 October 2006 - 04:56 PM

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!

<?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";
?>

"Syntax error" .. WHERE THE **** IS IT?!

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 07 October 2006 - 04:58 PM

} add another brace } to the bottom ok it's missing?


<?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";
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 07 October 2006 - 05:02 PM

An error like that is usually caused by mis-matched curly braces or an unterminated string.

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

Ken

#4 legohead6

legohead6
  • Members
  • PipPipPip
  • Advanced Member
  • 434 posts

Posted 07 October 2006 - 05:04 PM

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..
"Syntax error" .. WHERE THE **** IS IT?!

#5 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 07 October 2006 - 05:11 PM

I found two missing curly brackets, see comments in 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";
?>

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)

#6 legohead6

legohead6
  • Members
  • PipPipPip
  • Advanced Member
  • 434 posts

Posted 07 October 2006 - 05:11 PM

IT needed 2 more braces..hmm i wonder how i missed that! Thanks for the help ITS solved know!
"Syntax error" .. WHERE THE **** IS IT?!

#7 marcus

marcus
  • Members
  • PipPipPip
  • Advanced Member
  • 1,842 posts
  • LocationRochester, NY

Posted 07 October 2006 - 05:12 PM

<?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";
?>

more organized code if you want :P

#8 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 07 October 2006 - 05:12 PM

dam i missed that.

well spotted.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#9 legohead6

legohead6
  • Members
  • PipPipPip
  • Advanced Member
  • 434 posts

Posted 07 October 2006 - 06:56 PM

thanks... i need to start organising my code i guess
"Syntax error" .. WHERE THE **** IS IT?!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users