Re: Prepared statements

From: Date: Sun, 05 Mar 2006 08:31:10 +0000
Subject: Re: Prepared statements
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-231467@lists.php.net to get a copy of this message
> MySQL returns "Column 'auction_house' cannot be null". > Here're some parts of my code: > > --- code --- > > $update = $this->sql->stmt_init(); > $update->prepare("UPDATE auctions SET name=?, auction_house=?, link=?, > prize=?, runtime=?, bids=?, picture=? WHERE link=?"); > $update->bind_param("sisdsiss", $auction_parts["name"], > $auction_house["id"], $auction_parts["link"], > $auction_parts["prize"], > $auction_parts["runtime"], $auction_parts["bids"], > $auction_parts["picture"], $auction_parts["link"]); > > $insert = $this->sql->stmt_init(); > $insert->prepare("INSERT INTO auctions (auction_house, name, link, > prize, runtime, bids, picture) VALUES (?, ?, ?, ?, ?, ?, ?)"); > $insert->bind_param("issdsis", $auction_house["id"], > $auction_parts["name"], $auction_parts["link"], > $auction_parts["prize"], > $auction_parts["runtime"], $auction_parts["bids"], > $auction_parts["picture"]); > > --- /code --- > > after this, there's the loop, in which I do either $update->execute(); > or $insert->execute(); - the $update->execute(); runs without problems > but the $insert->execute runs into the described problem. So at some point the $auction_parts['id'] is empty. As you go into the loop, print out the $auction_house["id"], then work backwards... -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#231467) next »