Re: DELETE FROM.... Question

From: Date: Tue, 16 Jan 2001 00:35:41 +0000
Subject: Re: DELETE FROM.... Question
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-5890@lists.php.net to get a copy of this message
I'm sorry for bugging everyone, I just created a new PHP script, and used the following code: mysql_query ("DELETE FROM events WHERE event_id = $event_id"); And it worked! I must've have something wrong in the original script. -Ken ----- Original Message ----- From: "Ken Jansons" <kenjansons@colinux.net> To: <php-db@lists.php.net> Sent: Monday, January 15, 2001 5:17 PM Subject: Re: [PHP-DB] DELETE FROM.... Question > I tried that code, but now it gives me the following error: > Warning: Wrong parameter count for mysql_db_query() in > /usr/bus/events/delete.php on line 29 > > when I send delete.php?event_id=5 > (Which is a valid value for the event_id field)..... Any more ideas anyone? > and line 29 is that code that I put in, and it doesn't delete it still..... > > Thanks for the help so far, I appreciate it! > > -Ken > > ----- Original Message ----- > From: "Alarion" <alarion@planetunreal.com> > To: <kenjansons@colinux.net>; <php-db@lists.php.net> > Sent: Monday, January 15, 2001 4:57 PM > Subject: RE: [PHP-DB] DELETE FROM.... Question > > > > Try: > > mysql_db_query ("DELETE FROM events WHERE event_id = " . $event_id); > > > > I have had better luck with "mysql_db_query". > > > > Sean > > > > -----Original Message----- > > From: kenjansons@colinux.net [mailto:kenjansons@colinux.net] > > Sent: Monday, January 15, 2001 3:50 PM > > To: php-db@lists.php.net > > Subject: [PHP-DB] DELETE FROM.... Question > > > > > > Hello, I am new to the list, so please bear with me! I am creating a > > database system that will use PHP4 and MySQL 3.22. I've got things working > > excellent now... I can add, list, and modify records from the PHP scripts > I > > have created, but I can't delete them. I can do them manually by going > into > > MySQL and issuing the appropriate commands, but not through the PHP > script.. > > > > Here is the main part of the PHP script: > > mysql_query ("DELETE FROM events WHERE event_id = '$event_id'"); > > > > and I have the $variables pre, defined, and the mysql_include and > > use_databse, and all that jazz in an include.inc, which I have set to use > at > > the top of the script. > > I have also tried mysql_db_query, and nothing seems to work. > > > > The database is called domains, and the table is called events, and the ID > > is the event_id field. > > > > If anyone knows of any good places relevant to this problem, I would > greatly > > appreciate it if they could e-mail me links to them, or maybe some sample > > code on how to delete records. > > > > > > Here is some more info, if it helps: > > > > > > When I delete it manually, it deletes, but through the script it does not. > > > > Any help would be greatly appreciated! > > ----- > > ./mysql -u root -p > > Enter password: > > Welcome to the MySQL monitor. Commands end with ; or \g. > > Your MySQL connection id is 44 to server version: 3.22.32 > > > > Type 'help' for help. > > > > mysql> use domains; > > Reading table information for completion of table and column names > > You can turn off this feature to get a quicker startup with -A > > > > Database changed > > mysql> describe events; > > +-----------+--------------+------+-----+---------+----------------+ > > | Field | Type | Null | Key | Default | Extra | > > +-----------+--------------+------+-----+---------+----------------+ > > | event_id | int(11) | | PRI | 0 | auto_increment | > > | domain_id | varchar(25) | YES | | NULL | | > > | date | varchar(20) | YES | | NULL | | > > | time | varchar(10) | YES | | NULL | | > > | logger | varchar(10) | YES | | NULL | | > > | event | varchar(255) | YES | | NULL | | > > +-----------+--------------+------+-----+---------+----------------+ > > 6 rows in set (0.06 sec) > > > > mysql> SELECT * FROM events WHERE (event_id = '9'); > > > +----------+-----------+---------------+---------+--------+----------------+ > > | event_id | domain_id | date | time | logger | event > | > > > +----------+-----------+---------------+---------+--------+----------------+ > > | 9 | 1 | Jan. 14, 2001 | 5:53 PM | kj | NEW TEST!!!!!! > | > > > +----------+-----------+---------------+---------+--------+----------------+ > > 1 row in set (0.00 sec) > > > > mysql> DELETE FROM events WHERE (event_id = '9'); > > Query OK, 1 row affected (0.04 sec) > > > > > > and poof, the record is gone.... > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > > For additional commands, e-mail: php-db-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > > For additional commands, e-mail: php-db-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.db (#5890) next »