Re: little db help
| From: | Joe Stump | Date: | Tue, 14 Nov 2000 20:40:54 +0000 |
| Subject: | Re: little db help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25232@lists.php.net to get a copy of this message | ||
Try using @mysql_affected_rows($r);
--Joe
On Tue, Nov 14, 2000 at 02:52:30PM -0500, Jon Rosenberg wrote:
> This code returns 'Your information has been deleted from the personals
> database.' even when the database is completely empty. It works correctly
> and deletes the user's info, but it still returns and says it deleted the
> user info when I use a nonexistent username/password. I can't see why I'm
> not catching an error, or why one isn't being returned when I use the wrong
> user/pass...THanks for any ideas!
>
> Jon
>
>
> <?
>
>
> foreach ( $HTTP_POST_VARS as $key=>$value )
> {
> print "$key == $value<br>"; // for debugging use only
> }
>
> //Begin sexion on deleting user's information
>
> $delete_from_db = delete_from_db( $_uname, $_pword, $dberror );
> if ( ! $delete_from_db )
> {
> print "Error deleting: $dberror";
> exit;
> }
> else
> {
> print "Your information has been deleted from the personals database.";
> return true;
> }
> function delete_from_db ( $_uname, $_pword, &$dberror )
> {
> $user = "blah";
> $pass = "blah";
> $db = "personals";
> $db_connect = mysql_connect( "localhost", $user , $pass );
> if ( ! $db_connect )
> {
> $dberror = "Couldn't connect to delete.";
> return false;
> }
> if ( ! mysql_select_db( $db, $db_connect) )
> {
> $dberror = mysql_error();
> return false;
> }
> $db_query = "DELETE FROM gay WHERE _uname = '".$_uname."' and _pword
> =
> '".$_pword."'";
> if ( ! mysql_query( $db_query, $db_connect ) )
> {
> $dberror = mysql_error();
> return false;
> }
> return true;
> }
>
>
>
> ?>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
================================================================================
= Joe Stump joestump98@yahoo.com http://www.miester.org =
================================================================================
"Real programmers don't comment their code.
It was hard to write, it should be hard to understand."