RE: [PHP-DB] DELETE FROM.... Question

2001-01-16 Thread Rubanowicz, Lisa

http://hotwired.lycos.com/webmonkey/99/21/index3a_page6.html?tw=programming
If you go to this page it has all "Add", "Edit" and "Delete" all in one
script.  I got it working last night. Up to this I had been able to do the
Add and Delete but not the Edit, so this has it all .  Great for beginners
and has a full tutorial previous to this script.
All the best
Lisa

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 15, 2001 3:50 PM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



RE: [PHP-DB] DELETE FROM.... Question

2001-01-15 Thread Alarion

doh, you need to include the database as well:

int mysql_db_query (string database, string query [, int link_identifier])

so mysql_db_query("databasename", "delete from foo where bar = $foobar");

try that

Sean


-Original Message-
From: Ken Jansons [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 15, 2001 7:18 PM
To: [EMAIL PROTECTED]
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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 15, 2001 3:50 PM
> To: [EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAI

Re: [PHP-DB] DELETE FROM.... Question

2001-01-15 Thread Ken Jansons

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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, January 15, 2001 3:50 PM
> > To: [EMAIL PROTECTED]
> > 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!!
> |
> >
>
+--+---+-

Re: [PHP-DB] DELETE FROM.... Question

2001-01-15 Thread Ken Jansons

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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 15, 2001 3:50 PM
> To: [EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] DELETE FROM.... Question

2001-01-15 Thread Alarion

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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 15, 2001 3:50 PM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]