Page 1 of 1

[SOLVED] cant find the parse error.

Posted: Tue Dec 09, 2003 10:50 am
by jive
hello folks,

I seem to have a parse error somewhere but can't find it:

Code: Select all

<?php
//connect to the database
include ('connect.php');


$typeID = $_GET['typeID'];



$typelist = mysql_query("SELECT ID, type, FROM ac_type WHERE ID='$typeID'");

$actype = mysql_fetch_array($typelist);
$typeID = $actype['ID'];
$type = $actype['type'];


?>
Please delete new chapter:

<form name="deleteactype" method="post" action="<?=$_SERVER['PHP_SELF']>">

<input type="text" name="type" value="<?=$type?>" size="50" maxlength="100"> <!-- line 22 here --> 
<input type="hidden" name="typeID" value="<?=$typeID?>">
<p>
<input type="submit" value="submit" name="delete_actype">

</form>


<?php

if (isset($_POST['delete_actype'])) {
$typeID = $_POST['typeID'];

$ok1 = @mysql_query("DELETE FROM ac_description WHERE actype_ID='$typeID'");
$ok2 = @mysql_query("DELETE FROM ac_type WHERE ID='$typeID'");

if($ok1 and $ok2) {
echo('Your aircraft type has been deleted');
}
else {
echo('error deleting aircraft' . mysql_error());
}
}
?>
heres the error I'm getting:

Parse error: parse error, expecting `','' or `';'' in /home/ectaviat/public_html/aircraftsales/actype_del.php on line 22

?>

Posted: Tue Dec 09, 2003 10:53 am
by microthick
$typelist = mysql_query("SELECT ID, type, FROM ac_type WHERE ID='$typeID'");

Remove the comma after "type" in the select statement.

Posted: Tue Dec 09, 2003 10:53 am
by Weirdan

Code: Select all

<form name="deleteactype" method="post" action="<?=$_SERVER['PHP_SELF']>">
should be:

Code: Select all

<form name="deleteactype" method="post" action="<?=$_SERVER['PHP_SELF'];?>">
Also you need to remove a comma before the FROM in this query:

Code: Select all

$typelist = mysql_query("SELECT ID, type, FROM ac_type WHERE ID='$typeID'");
should be:

Code: Select all

$typelist = mysql_query("SELECT ID, type FROM ac_type WHERE ID='$typeID'");

Posted: Tue Dec 09, 2003 10:54 am
by aquila125
<?=$_SERVER['PHP_SELF']>

you forgot the closing question mark...

Posted: Tue Dec 09, 2003 10:55 am
by Weirdan
microthick wrote:$typelist = mysql_query("SELECT ID, type, FROM ac_type WHERE ID='$typeID'");

Remove the comma after "type" in the select statement.
Yeah, I noticed it too. But he is getting parse error. SQL errors wouldn't produce it.

Posted: Tue Dec 09, 2003 11:10 am
by m3mn0n
Not a parse error but; your form is of the POST method, and your script is looking for a GET variable.

And you might want to [php_man]trim[/php_man]() the incoming text variable before you query the DB for an exact match. :)

Posted: Tue Dec 09, 2003 11:22 am
by microthick
Weirdan wrote:
microthick wrote:$typelist = mysql_query("SELECT ID, type, FROM ac_type WHERE ID='$typeID'");

Remove the comma after "type" in the select statement.
Yeah, I noticed it too. But he is getting parse error. SQL errors wouldn't produce it.
Ahh, close enough. An error is an error :P

Posted: Tue Dec 09, 2003 6:35 pm
by jive
Thanks folks, problem resolved! :D