NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page MySQL Timeout

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
2 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 09-02-2005, 07:59 AM THREAD STARTER               #1 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




MySQL Timeout


When I try to put all the data in my database in a table on my site it gets about 25 and a third records complete but then it runs out of time, my host has a 30 second SQL timeout, is there any way to re-open the connection and continue from the last complete record, heres the php:

PHP Code:
    $username="--not gonna post--";
    
$password="--not gonna post--";
    
$database="myfile";
    
$host="mysql5.streamline.net";
    
    
mysql_connect($host,$username,$password);
    @
mysql_select_db($database);
    
$query="SELECT * FROM myfile_visitors";
    
$result=mysql_query($query);
    
    
$num=mysql_numrows($result);
    
    
$nonetscapes 0;
    
$nomsies 0;
    
$nolynxs 0;
    
$nooperas 0;
    
$nowebtvs 0;
    
$nokonqerors 0;
    
$nobots 0;
    
$noothers 0;
    
$nopeople 0;
    
$percentnetscapes 0;
    
$percentmsies 0;
    
$percentlynxs 0;
    
$percentoperas 0;
    
$percentwebtvs 0;
    
$percentkonqerors 0;
    
$percentbots 0;
    
$percentothers 0;
    
$visitors mysql_numrows($result);
    
    echo 
"<b><center>Database Output</center></b><br><br>";
    echo 
"<p>  </p><p>   </p><p class = style7><b><u>Individual Statistics</u></b>";
    
    
mysql_close();
    
    echo 
"<div align=\"center\"><table width=\"200\" border=\"2\">
    <tr>"
;    
    
$i=0;
    while (
$i $num) {
    
    
$ip=mysql_result($result,$i,"ip");
    
$agent=mysql_result($result,$i,"agent");
    
$referer=mysql_result($result,$i,"referrer");
    
    if(
$referer == ""){ $referer " - - none - - "; }
    if(
$agent == "Netscape"){ $nonetscapes ++; }
    if(
$agent == "MSIE"){ $nomsies ++; }
    if(
$agent == "Lynx"){ $nolynxs ++; }
    if(
$agent == "Opera"){ $nooperas ++; }
    if(
$agent == "WebTV"){ $nowebtvs ++; }
    if(
$agent == "Konqueror"){ $nokonqerors ++; }
    if(
$agent == "Bot"){ $nobots ++; }
    if(
$agent == "Other"){ $noothers ++; }
    
    echo 
"<td>".$ip."</td>";
    echo 
"<td>".$agent."</td>";
    echo 
"<td>".$referer."</td>";
    echo 
"<td> <a href = \"http://www.myfileminder.com/Admin/AdminStats2a.php?uname=Admin&pword=Sysop&field01=".$ip."&field02=".$agent."&field03=".$referer."\">Update</a></td>";
    echo 
"</tr>
  <tr>"
;
    
$i++;
    }
    echo 
"</tr>
  </table>
</div>"
;
$percentnetscapes $nonetscapes $visitors 100;
$percentmsies $nomsies $visitors 100;
$percentlynxs $nolynxs $visitors 100;
$percentoperas $nooperas $visitors 100;
$percentwebtvs $nowebtvs $visitors 100;
$percentkonqerers $nokonqerors $visitors 100;
$percentbots $nobots $visitors 100;
$percentothers $noothers $visitors 100;

echo 
"<p class = style7><b><u>Overall Statistics</u></b>";
echo 
"<p class = style7>Total Visitors: " $visitors;
????: NamePros.com http://www.namepros.com/programming/120478-mysql-timeout.html
echo 
"<p class = style7><br>--------------------";
echo 
"<p class = style7>Netscape Users: " $nonetscapes;
echo 
"<br>MSIE Users: " $nomsies;
echo 
"<br>Lynx Users: " $nolynxs;
echo 
"<br>Opera Users: " $nooperas;
echo 
"<br>WebTV Users: " $nowebtvs;
echo 
"<br>Konqueror Users: " $nokonqerors;
echo 
"<br>Automated Bots: " $nobots;
echo 
"<br>Other: " $noothers;
echo 
"<p class = style7><br>--------------------";
echo 
"<p class = style7>Percentage of Netscape Users: " $percentnetscapes;
echo 
"<br>Percentage of MSIE Users: " $percentmsies;
echo 
"<br>Percentage of Lynx Users: " $percentlynxs;
echo 
"<br>Percentage of Opera Users: " $percentoperas;
echo 
"<br>Percentage of WebTV Users: " $percentwebtvs;
????: NamePros.com http://www.namepros.com/showthread.php?t=120478
echo 
"<br>Percentage of Konqueror Users: " $percentkonqerors;
echo 
"<br>Percentage of Automated Bots: " $percentbots;
echo 
"<br>Percentage of Others: " $percentothers


when it runs out of time is there a way to re-open the connection and continue the script?
Barrucadu is offline  
Old 09-02-2005, 08:06 AM   #2 (permalink)
Senior Member
 
dgaussin's Avatar
Join Date: May 2004
Location: France
Posts: 1,226
dgaussin is a splendid one to beholddgaussin is a splendid one to beholddgaussin is a splendid one to beholddgaussin is a splendid one to beholddgaussin is a splendid one to beholddgaussin is a splendid one to beholddgaussin is a splendid one to beholddgaussin is a splendid one to behold
 




How many results do you have with this query ? I can't believe your query takes +30 seconds to be executed...
dgaussin is offline  
Old 09-02-2005, 08:10 AM THREAD STARTER               #3 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




On phpmyadmin it takes 0.0017 seconds for the same query.. 55 rows, my server must just be incredibly slow then...

i'll contact them
Barrucadu is offline  
Old 09-02-2005, 08:14 AM   #4 (permalink)
Senior Member
 
dgaussin's Avatar
Join Date: May 2004
Location: France
Posts: 1,226
dgaussin is a splendid one to beholddgaussin is a splendid one to beholddgaussin is a splendid one to beholddgaussin is a splendid one to beholddgaussin is a splendid one to beholddgaussin is a splendid one to beholddgaussin is a splendid one to beholddgaussin is a splendid one to behold
 




phpmyadmin is just a php script like yours. Maybe a php problem rather... Try to remove the mysql_close or put it at the end, or try to remove some php code and just display the rows number to check if query is correctly executed.
dgaussin is offline  
Old 09-02-2005, 08:20 AM THREAD STARTER               #5 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




PHP Code:
    $username="--not gonna post--";
    
$password="--not gonna post--";
    
$database="myfile";
    
$host="mysql5.streamline.net";
    
    
$nonetscapes 0;
    
$nomsies 0;
    
$nolynxs 0;
    
$nooperas 0;
    
$nowebtvs 0;
    
$nokonqerors 0;
    
$nobots 0;
    
$noothers 0;
    
$nopeople 0;
    
$percentnetscapes 0;
    
$percentmsies 0;
    
$percentlynxs 0;
    
$percentoperas 0;
    
$percentwebtvs 0;
    
$percentkonqerors 0;
    
$percentbots 0;
    
$percentothers 0;
    
    echo 
"<b><center>Database Output</center></b><br><br>";
    echo 
"<p>  </p><p>   </p><p class = style7><b><u>Individual Statistics</u></b>";

    
mysql_connect($host,$username,$password);
    @
mysql_select_db($database);
    
$query="SELECT * FROM myfile_visitors";
    
$result=mysql_query($query);
    
$num=mysql_numrows($result);
    
$visitors $num;
    
mysql_close();
    
    echo 
"<div align=\"center\"><table width=\"200\" border=\"2\">
    <tr>"
;    
    
$i=0;
    while (
$i $num) {
    
    
$ip=mysql_result($result,$i,"ip");
    
$agent=mysql_result($result,$i,"agent");
    
$referer=mysql_result($result,$i,"referrer");
    
    if(
$referer == ""){ $referer " - - none - - "; }
    if(
$agent == "Netscape"){ $nonetscapes ++; }
    if(
$agent == "MSIE"){ $nomsies ++; }
    if(
$agent == "Lynx"){ $nolynxs ++; }
    if(
$agent == "Opera"){ $nooperas ++; }
    if(
$agent == "WebTV"){ $nowebtvs ++; }
    if(
$agent == "Konqueror"){ $nokonqerors ++; }
    if(
$agent == "Bot"){ $nobots ++; }
    if(
$agent == "Other"){ $noothers ++; }
    
    echo 
"<td>".$ip."</td>";
    echo 
"<td>".$agent."</td>";
    echo 
"<td>".$referer."</td>";
    echo 
"<td> <a href = \"http://www.myfileminder.com/Admin/AdminStats2a.php?uname=Admin&pword=Sysop&field01=".$ip."&field02=".$agent."&field03=".$referer."\">Update</a></td>";
    echo 
"</tr>
  <tr>"
;
    
$i++;
    }
    echo 
"</tr>
  </table>
</div>"
;
$percentnetscapes $nonetscapes $visitors 100;
$percentmsies $nomsies $visitors 100;
$percentlynxs $nolynxs $visitors 100;
$percentoperas $nooperas $visitors 100;
$percentwebtvs $nowebtvs $visitors 100;
$percentkonqerers $nokonqerors $visitors 100;
$percentbots $nobots $visitors 100;
$percentothers $noothers $visitors 100;

echo 
"<p class = style7><b><u>Overall Statistics</u></b>";
echo 
"<p class = style7>Total Visitors: " $visitors;
????: NamePros.com http://www.namepros.com/showthread.php?t=120478
echo 
"<p class = style7><br>--------------------";
echo 
"<p class = style7>Netscape Users: " $nonetscapes;
echo 
"<br>MSIE Users: " $nomsies;
echo 
"<br>Lynx Users: " $nolynxs;
echo 
"<br>Opera Users: " $nooperas;
echo 
"<br>WebTV Users: " $nowebtvs;
echo 
"<br>Konqueror Users: " $nokonqerors;
echo 
"<br>Automated Bots: " $nobots;
echo 
"<br>Other: " $noothers;
echo 
"<p class = style7><br>--------------------";
echo 
"<p class = style7>Percentage of Netscape Users: " $percentnetscapes;
echo 
"<br>Percentage of MSIE Users: " $percentmsies;
echo 
"<br>Percentage of Lynx Users: " $percentlynxs;
echo 
"<br>Percentage of Opera Users: " $percentoperas;
????: NamePros.com http://www.namepros.com/showthread.php?t=120478
echo 
"<br>Percentage of WebTV Users: " $percentwebtvs;
echo 
"<br>Percentage of Konqueror Users: " $percentkonqerors;
echo 
"<br>Percentage of Automated Bots: " $percentbots;
echo 
"<br>Percentage of Others: " $percentothers
all I had to do was re-arrange the script..
Barrucadu is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOWTO: Install the Apache Web Server, Perl, PHP, and MySQL on Windows deadserious Webmaster Tutorials 96 05-27-2007 01:24 PM
Tutorial: How to Install Apache2 MySQL and PHP on Windows deadserious Webmaster Tutorials 35 09-21-2005 09:46 PM
Tutorial: Getting Started With MySQL (The Basics) deadserious Webmaster Tutorials 3 04-18-2004 01:17 PM
importing data in MYsql shakim Programming 6 08-01-2003 03:46 PM

 
All times are GMT -7. The time now is 12:13 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger