DELETE FROM.... Question
| From: | kenjansons at colinux dot net | Date: | Mon, 15 Jan 2001 15:50:14 +0000 |
| Subject: | DELETE FROM.... Question | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-5887@lists.php.net to get a copy of this message | ||
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....