Re: delete ONLY the actice user´s posts from mysql
| From: | Joao Prado Maia | Date: | Wed, 06 Sep 2000 17:55:17 +0000 |
| Subject: | Re: delete ONLY the actice user´s posts from mysql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-15565@lists.php.net to get a copy of this message | ||
On Wed, 6 Sep 2000, Helmut Ott wrote:
> line 100: $active_user_id = mysqlquery("mydatabase","SELECT id FROM user WHERE
> user_name='$username' AND password='$password'");
>
> // next I use the id from user to select all posts of this user
> // the table posts of course has a field user_id
>
> line 101: $result = mysqlquery("mydatabase","DELETE FROM posts WHERE id=$par AND
> user_id == $active_user_id");
>
> line 102: $num = mysql_numrows($result);
> /*
> Simply wont work
> I GET AN ERROR MESSAGE FOR THE LINE 102 THOUGH THERE ARE RECORDS IN THE DATABASE
> */
Well, for starters, the function is mysql_num_rows(), not
mysql_numrows(). And quoting from the manual :
"mysql_num_rows() returns the number of rows in a result set. This command
is only valid for SELECT statements. To retrieve the number of rows
returned from a INSERT, UPDATE or DELETE, use mysql_affected_rows()."
http://www.php.net/manual/function.mysql-num-rows.php
Regards,
Joao
--
Joao Prado Maia
Web Developer
Kefta.com, Inc