PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
jive
Forum Newbie
Posts: 20 Joined: Thu May 23, 2002 1:34 pm
Contact:
Post
by jive » Tue Dec 09, 2003 10:50 am
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
?>
microthick
Forum Regular
Posts: 543 Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC
Post
by microthick » Tue Dec 09, 2003 10:53 am
$typelist = mysql_query("SELECT ID, type, FROM ac_type WHERE ID='$typeID'");
Remove the comma after "type" in the select statement.
Weirdan
Moderator
Posts: 5978 Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine
Post
by Weirdan » Tue Dec 09, 2003 10:53 am
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'");
aquila125
Forum Commoner
Posts: 96 Joined: Tue Dec 09, 2003 10:39 am
Location: Belgium
Post
by aquila125 » Tue Dec 09, 2003 10:54 am
<?=$_SERVER['PHP_SELF']>
you forgot the closing question mark...
Weirdan
Moderator
Posts: 5978 Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine
Post
by Weirdan » Tue Dec 09, 2003 10:55 am
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.
m3mn0n
PHP Evangelist
Posts: 3548 Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada
Post
by m3mn0n » Tue Dec 09, 2003 11:10 am
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.
microthick
Forum Regular
Posts: 543 Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC
Post
by microthick » Tue Dec 09, 2003 11:22 am
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
jive
Forum Newbie
Posts: 20 Joined: Thu May 23, 2002 1:34 pm
Contact:
Post
by jive » Tue Dec 09, 2003 6:35 pm
Thanks folks, problem resolved!