Re: Re: PHP and MySQL bug

From: Date: Tue, 07 Jan 2003 19:55:32 +0000
Subject: Re: Re: PHP and MySQL bug
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-130723@lists.php.net to get a copy of this message
@mysql_select_db("be"); // this doesn't fail, because only the second (UPDATE) query fails. The first query (SELECT) is done! ----- Original Message ----- From: "Marek Kilimajer" <kilimajer@webglobe.sk> To: "Nuno Lopes" <nunoplopes@clix.pt> Cc: "MySQL List" <mysql@lists.mysql.com>; <php-general@lists.php.net> Sent: Tuesday, January 07, 2003 5:06 PM Subject: Re: [PHP] Re: PHP and MySQL bug > @mysql_select_db("be"); -- this failed > do echo mysql_error(); to see what went wrong > > > > Nuno Lopes wrote: > > >I done a echo of Mysql_error and it returned: > >'Nenhum banco de dados foi selecionado' > > > >(I have the mysql server in portuguese, but the translation is something > >like 'no db was selected') > > > > > >----- Original Message ----- > >From: "David Freeman" <dfreeman@outbackqld.net.au> > >To: <php-general@lists.php.net> > >Sent: Sunday, January 05, 2003 10:29 PM > >Subject: RE: [PHP] Re: PHP and MySQL bug > > > > > > > > > >> > @MYSQL_QUERY("UPDATE d SET h='$h' WHERE id='$id'"); > >> > // this > >> > query doesn't work!!!! > >> > >>Personally, I'd call it bad programming practice to do a database update > >>and not check to see if it worked or not. In this case, how are you > >>determining that the query did not work? Are you manually checking the > >>database? You don't have anything in your code to check the status of > >>this query. > >> > >>Perhaps this might get you somewhere: > >> > >>$qid = @mysql_query("UPDATE d SET h = '$h' WHERE id = > >>'$id'"); > >> > >>if (isset($qid) && mysql_affected_rows() == 1) > >>{ > >> echo "query executed"; > >>} else { > >> echo "query failed: " . mysql_error(); > >>} > >> > >>At least this way you might get some indication of where the problem is. > >> > >>CYA, Dave

« previous php.general (#130723) next »