[PHP] php mysql_num_rows problem
Hi list, I have a class to perform my tasks to bd, among than there's this function function executa($sql="") { if($sql == "") { $this->resultado = 0; $this->numrows = 0; $this->row = -1; } $this->resultado = mysql_query($sql,$this->conexao->id); $this->numrows = mysql_num_rows($this->resultado); } everything works fine, except when I tri to insert a record. It inserts, but give an error "Warning: Supplied argument is not a valid MySQL result resource in /home/restricted/home/papagaiodigital/public_html/recrutamento/includes/clas sesql.inc on line 22" line 22 is "$this->numrows = mysql_num_rows($this->resultado);" what's the problem?? Thank's n advance Rodrigo Peres -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php mysql_num_rows problem
with insert, update and delete you must use mysql_affected_rows() - Original Message - From: "Rodrigo Peres" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 4:58 PM Subject: [PHP] php mysql_num_rows problem > Hi list, > > I have a class to perform my tasks to bd, among than there's this function > > function executa($sql="") { > if($sql == "") { > $this->resultado = 0; > $this->numrows = 0; > $this->row = -1; > } > $this->resultado = mysql_query($sql,$this->conexao->id); > $this->numrows = mysql_num_rows($this->resultado); > } > everything works fine, except when I tri to insert a record. It inserts, but > give an error > > "Warning: Supplied argument is not a valid MySQL result resource in > /home/restricted/home/papagaiodigital/public_html/recrutamento/includes/clas > sesql.inc on line 22" > > line 22 is "$this->numrows = mysql_num_rows($this->resultado);" > > what's the problem?? > > Thank's n advance > > Rodrigo Peres > -- > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php mysql_num_rows problem
with insert, update and delete you must use mysql_affected_rows() http://www.php.net/manual/en/function.mysql-affected-rows.php - Original Message - From: "Rodrigo Peres" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 4:58 PM Subject: [PHP] php mysql_num_rows problem > Hi list, > > I have a class to perform my tasks to bd, among than there's this function > > function executa($sql="") { > if($sql == "") { > $this->resultado = 0; > $this->numrows = 0; > $this->row = -1; > } > $this->resultado = mysql_query($sql,$this->conexao->id); > $this->numrows = mysql_num_rows($this->resultado); > } > everything works fine, except when I tri to insert a record. It inserts, but > give an error > > "Warning: Supplied argument is not a valid MySQL result resource in > /home/restricted/home/papagaiodigital/public_html/recrutamento/includes/clas > sesql.inc on line 22" > > line 22 is "$this->numrows = mysql_num_rows($this->resultado);" > > what's the problem?? > > Thank's n advance > > Rodrigo Peres > -- > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php