PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > Too fast web page for mysql database
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Too fast web page for mysql database

Réponse
 
LinkBack Outils de la discussion
Vieux 24/10/2007, 20h14   #1
MZ
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Too fast web page for mysql database

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

  Réponse avec citation
Vieux 25/10/2007, 07h55   #2
K.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Too fast web page for mysql database


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


  Réponse avec citation
Vieux 25/10/2007, 10h39   #3
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Too fast web page for mysql database

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?

  Réponse avec citation
Vieux 25/10/2007, 10h47   #4
K.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Too fast web page for mysql database

> 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.


  Réponse avec citation
Vieux 25/10/2007, 11h00   #5
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Too fast web page for mysql database

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!

  Réponse avec citation
Vieux 25/10/2007, 11h50   #6
K.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Too fast web page for mysql database


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


  Réponse avec citation
Vieux 25/10/2007, 12h07   #7
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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"]:"",
> "_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.

  Réponse avec citation
Vieux 25/10/2007, 13h45   #8
K.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Too fast web page for mysql database


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


  Réponse avec citation
Vieux 25/10/2007, 14h21   #9
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Too fast web page for mysql database

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.

  Réponse avec citation
Vieux 25/10/2007, 14h28   #10
K.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Too fast web page for mysql database

> <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.


  Réponse avec citation
Vieux 25/10/2007, 15h14   #11
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Too fast web page for mysql database

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.

  Réponse avec citation
Vieux 25/10/2007, 15h15   #12
K.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Too fast web page for mysql database

> 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.


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h07.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,27971 seconds with 20 queries