Re: Too fast web page for mysql database
On 25 Oct, 10:50, "K." <halinaciern...@poczta.onet.pl> wrote:
> Uzytkownik "Captain Paralytic" <paul_laut...@yahoo.com> napisal w wiadomoscinews:1193302856.982034.302570@y42g2000hs y.googlegroups.com...
>
> > On 25 Oct, 09:47, "K." <halinaciern...@poczta.onet.pl> wrote:
> >> > Are you testing the response from the statements you are using to
> >> > update the database?
>
> >> No I am testing the statements I am using to insert data into the
> >> database.
>
> >> M.
>
> > I mean in your code, to you check the return from the statements used
> > to update the database? Then you will see if there was a problem with
> > the update!
>
> I have such code. I have made a mistake, I make update and insert, but I am
> interested in the table banner_view_history,
> where I store data about banners` views. My function returns nothing. I do
> "OPTIMIZE TABLE banner_view_history" and
> "OPTIMIZE TABLE banner_items" and I think that problem disappeared. But Iam
> not sure for 100%.
>
> function UpdateBannerCount($id) {
> $this->_clearDBError();
> if(!$this->_connect()) {
> return false;
> }
> $sql = "SELECT id_banner_locations FROM
> ".$this->dbconfig["prefix"]."banner_items WHERE id_banner_items=".$id;
>
> $resultat = @mysql_query($sql);
> $assoc = @mysql_fetch_assoc($resultat);
>
> $this->query = "UPDATE ".$this->dbconfig["prefix"]."banner_items bi SET
> banner_view_count = banner_view_count+1 WHERE id_banner_items=".$id;
> $this->result = @mysql_query($this->query);
>
> $data = array(
> "referer" => isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:"",
> "useragent" =>
> isset($_SERVER["HTTP_USER_AGENT"])?$_SERVER["HTTP_USER_AGENT"]:"",
> "cookies_name"
> =>(isset($_COOKIE['test_cookie'])?$_COOKIE['test_cookie']:$_SESSION["test_c*ookie_session"]),
> "view_date" => date("Y-m-d H:i:s"),
> "id_banner_locations"=>$assoc["id_banner_locations"],
> "id_banner_items" => $id
> );
> $this->addElement($this->dbconfig["prefix"]."banner_view_history", $data);
>
> }
>
> Marcin
What do you mean "my function returns nothing"?
I cannot see anywhere in this code where you check for the success of
any of your database updates or an error messages returned.
|