|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello!
I am not an admin of my database, but I care of this database. I have a web page which inserts records into the mysql database about history of just viewed banners. I have written a script which let my page display banners in order. Every reloading web page should make different banner display. That`s why I store history of every banner of every section and I display banner which were viewed the oldest time ago. I don`t know why my mysql database sometimes don`t insert data into the database and that`s why my web page shows every time the same banner. If I leave my database for a few minutes and then reload the page, there are records added into the database. In the past I took care of MS Access databases and there was something as compacting. What should I do make my mysql database response quicker? How can I compact my database and should I do this during working hours when many people use my web page? Is it needed to do it i.e. at night where fewer people look into my web page? Please me, I really apprieciete your efforts. Thank you Marcin |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
U¿ytkownik "MZ" <marcinzmyslowski@poczta.onet.pl> napisa³ w wiadomo¶ci news:ffo21o$m9d$1@news.onet.pl... > Hello! > > I am not an admin of my database, but I care of this database. > I have a web page which inserts records into the mysql database about > history of just viewed banners. > I have written a script which let my page display banners in order. Every > reloading web page should make different banner display. That`s why I > store history of every banner of every section and I display banner which > were viewed the oldest time ago. > I don`t know why my mysql database sometimes don`t insert data into the > database and that`s why my web page shows every time the same banner. If I > leave my database for a few minutes and then reload the page, there are > records added into the database. > > In the past I took care of MS Access databases and there was something as > compacting. What should I do make my mysql database response quicker? How > can I compact my database and should I do this during working hours when > many people use my web page? Is it needed to do it i.e. at night where > fewer people look into my web page? > > Please me, I really apprieciete your efforts. > Thank you > Marcin OPTIMIZE TABLE name_table |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On 24 Oct, 19:14, "MZ" <marcinzmyslow...@poczta.onet.pl> wrote:
> Hello! > > I am not an admin of my database, but I care of this database. > I have a web page which inserts records into the mysql database about history of > just viewed banners. > I have written a script which let my page display banners in order. Every > reloading web page should make different banner display. That`s why I store > history of every banner of every section and I display banner which were viewed > the oldest time ago. > I don`t know why my mysql database sometimes don`t insert data into the database > and that`s why my web page shows every time the same banner. If I leave my > database for a few minutes and then reload the page, there are records added > into the database. > > In the past I took care of MS Access databases and there was something as > compacting. What should I do make my mysql database response quicker? How can I > compact my database and should I do this during working hours when many people > use my web page? Is it needed to do it i.e. at night where fewer people look > into my web page? > > Please me, I really apprieciete your efforts. > Thank you > Marcin Are you testing the response from the statements you are using to update the database? |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
> 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. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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! |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
Uzytkownik "Captain Paralytic" <paul_lautman@yahoo.com> napisal w wiadomosci news:1193302856.982034.302570@y42g2000hsy.googlegr oups.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 I am 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"]:"", "_name" =>(isset($_['test_'])?$_['test_']:$_SESSION["test__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 |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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"]:"", > "_name" > =>(isset($_['test_'])?$_['test_']:$_SESSION["test_cookie_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. |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
Uzytkownik "Captain Paralytic" <paul_lautman@yahoo.com> napisal w wiadomosci news:1193306848.856496.56120@57g2000hsv.googlegrou ps.com... 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 I > am > 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"]:"", > "_name" > =>(isset($_['test_'])?$_['test_']:$_SESSION["test_cookie_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. ----------------------------------- I mean that I don`t have such code function name_function { //operations on database ..... return $result; } by writing "my function returns nothing". I don`t want to return anything because I use javascript SWFObject class to display flash banners and I call URL i.e. banner.php?id=22. banner.php file contains two things: 1) the above function update and insert into the database - to increase the number of banner (id=22) views and add visit trace into the banner_view_history table. 2) return needed data about the flash banner to make it display on the page <script type="text/javascript"> // <![CDATA[ var so = new SWFObject("banner.php?id=22", "fl_top22_f", "770", "100", "7", "#ffffff"); so.addVariable("quality", "high"); so.addVariable("clickTag", "bannerclick.php%3Fid%3D22"); so.write("fl_top"+22); // ]]> </script> Marcin |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
On 25 Oct, 12:45, "K." <halinaciern...@poczta.onet.pl> wrote:
> Uzytkownik "Captain Paralytic" <paul_laut...@yahoo.com> napisal w wiadomoscinews:1193306848.856496.56120@57g2000hsv. googlegroups.com... > 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. Ido > > "OPTIMIZE TABLE banner_view_history" and > > "OPTIMIZE TABLE banner_items" and I think that problem disappeared. ButI > > am > > 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 biSET > > 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"]:"", > > "_name" > > =>(isset($_['test_'])?$_['test_']:$_SESSION["test_cookie_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. > > ----------------------------------- > I mean that I don`t have such code > > function name_function > { > //operations on database > .... > return $result; > > } > > by writing "my function returns nothing". > > I don`t want to return anything because I use javascript SWFObject classto > display flash banners and I call URL i.e. banner.php?id=22. > banner.php file contains two things: > 1) the above function update and insert into the database - to increase the > number of banner (id=22) views > and add visit trace into the banner_view_history table. > 2) return needed data about the flash banner to make it display on the page > > <script type="text/javascript"> > // <![CDATA[ > var so = new SWFObject("banner.php?id=22", "fl_top22_f", "770", "100", > "7", "#ffffff"); > so.addVariable("quality", "high"); > so.addVariable("clickTag", "bannerclick.php%3Fid%3D22"); > so.write("fl_top"+22); > // ]]> > </script> > > Marcin- Hide quoted text - > > - Show quoted text - So write any errors to a log file. Then you can see what's happening. You don't have to output them to the browser. |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
> <script type="text/javascript">
> // <![CDATA[ > var so = new SWFObject("banner.php?id=22", "fl_top22_f", > "770", "100", > "7", "#ffffff"); > so.addVariable("quality", "high"); > so.addVariable("clickTag", "bannerclick.php%3Fid%3D22"); > so.write("fl_top"+22); > // ]]> > </script> > > Marcin- Hide quoted text - > > - Show quoted text - So write any errors to a log file. Then you can see what's happening. You don't have to output them to the browser. OK but what about the speed of inserts into database. I do not think that`s the problem of errors while inserting or updating the data, because data during every reloading the page are the same and the only difference is that view_date is changing. M. |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
On 25 Oct, 13:28, "K." <halinaciern...@poczta.onet.pl> wrote:
> > <script type="text/javascript"> > > // <![CDATA[ > > var so = new SWFObject("banner.php?id=22", "fl_top22_f", > > "770", "100", > > "7", "#ffffff"); > > so.addVariable("quality", "high"); > > so.addVariable("clickTag", "bannerclick.php%3Fid%3D22"); > > so.write("fl_top"+22); > > // ]]> > > </script> > > > Marcin- Hide quoted text - > > > - Show quoted text - > > So write any errors to a log file. Then you can see what's happening. > You don't have to output them to the browser. > > OK but what about the speed of inserts into database. I do not think that`s > the problem of > errors while inserting or updating the data, because data during every > reloading the page > are the same and the only difference is that view_date is changing. > > M. You are guessing that "speed" is the problem. You have no evidence as to what the problem is. Outputting the results of your update operations gives you evidence of what is happening. |
|
|
|
#12 |
|
Messages: n/a
Hébergeur: |
> You are guessing that "speed" is the problem. You have no evidence as
> to what the problem is. Outputting the results of your update > operations gives you evidence of what is happening. > OK Thank you Wish you a nice evening M. |
|
![]() |
| Outils de la discussion | |
|
|