-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi everyone
I have what I think is a very simple function, but I'm getting double entries in my database? I think my php is okay but I'll post how I call this function at the end. It's probably something stupid but I can't see it! /* update, insert or edit */ function update() { $settings=new settings; if($this->id) { $qry="UPDATE news SET title = "; $qry.="'$this->title', text = '$this->text' "; $qry.="WHERE id = '$this->id' "; print("1"); } else { $qry="INSERT INTO news "; $qry.="VALUES (NULL, NULL, '$this->title', '$this->text')"; print("2"); } $link=mysql_connect($settings->host, $settings->user, $settings->pass); if(!$link) { return FALSE; } $db=mysql_select_db($settings->db); if(!($result=mysql_query($qry))) { print("3"); return FALSE; } print("4"); return TRUE; } heres what I do: $new=new news(); $news->set_title($title); $news->set_text($text); $news->update(); it prints out '2' and '4' but leaves to identical records in the db? Many thanks... - -- Nick Wilson // www.explodingnet.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE9CIp0HpvrrTa6L5oRAgmJAJ9Vn6gfnPNVpPnurzTejgDXrKXQDgCdFopw FVqUcS+nyaFxIUUzoNdRF3Q= =v9y6 -----END PGP SIGNATURE----- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php