Jump to content


Photo

I have a heavy script ?


  • Please log in to reply
9 replies to this topic

#1 qwe010

qwe010
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 25 September 2006 - 02:01 AM

hi all

I have a heavy script

I think that the reason this code



$Phpar=mysql_query("SELECT * FROM prog_script ") or die (mysql_error() );

while($M=mysql_fetch_array($Phpar)){

$file_name=$M["file_name"];

$ID=$M["ID"];

$file_wsf=$M["file_wsf"];

$file_size=$M["file_size"];

$file_ex=$M["file_ex"];

$file2=$M["file2"];

echo"<div align='center'>

  <center>

  <table border='1' cellspacing='1' width='100%' id='AutoNumber1' height='35'>

    <tr>

      <td width='16%' align='center' height='1'><span lang='en-us'>

      <font face='Tahoma' size='2' color='#800000'>$file_name</font></span></td>

      <td width='38%' align='center' height='1'><span lang='en-us'>

      <font face='Tahoma' size='2' color='#008080'>$file_wsf</font></span></td>

      <td width='10%' align='center' height='1'><span lang='en-us'>

      <font face='Tahoma' size='2' color='#000080'>$file_size</font></span></td>

      <td width='15%' align='center' height='1'><a href='$file_ex'>

      <img border='0' src='$file_ex' alt='ÇÖÛØ Úáì ÇáÕæÑÉ áÊßÈíÑåÇ' width='108' height='60'></a></td>

      <td width='11%' align='center' height='1'>

      <a href='download.php?file=http://{$HTTP_HOST}{$REQUEST_URI}$file2'>

      <img border='0' src='img/links.gif' width='20' height='20'></a></td>

      <td width='10%' align='center' height='1'><span lang='en-us'><font face='tahoma' size='2' font color='#ff0000' ><b><S CRIPT language='JavaScript' src='download.php?downloads=http://{$HTTP_HOST}{$REQUEST_URI}$file2'></S CRIPT></span></td>

    </tr>



How i can change it ?

please


#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 25 September 2006 - 02:13 AM

Well put it down before you hurt your back! :P

Seriously though... do you have a question / problem what is it?

#3 qwe010

qwe010
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 25 September 2006 - 02:38 AM

When I open page takes a very long time    Show mistakes sometimes   

And sometimes don't works      The number of loading times

#4 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 25 September 2006 - 03:44 AM

How many records does the query retrieve?

#5 qwe010

qwe010
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 26 September 2006 - 01:50 AM

10

$maxresults = 10;

Why? What is the difference?

#6 qwe010

qwe010
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 26 September 2006 - 01:13 PM

up .......

#7 steveclondon

steveclondon
  • Members
  • PipPipPip
  • Advanced Member
  • 161 posts

Posted 26 September 2006 - 01:20 PM

don't see why it would be taking along time. looks ok to me. I take it you only have 10 records in the table as there is no where clause in the query.

You say that sometimes it doesn't work, what is the error you get

#8 qwe010

qwe010
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 26 September 2006 - 02:05 PM

my be Because i use this functions

<?php



$version="v1.0";

if(phpversion() >= "4.2.0"){

	if(is_array($_SERVER)){

		extract($_SERVER, EXTR_PREFIX_SAME, "server");

	}

	if(is_array($_GET)){

		extract($_GET, EXTR_PREFIX_SAME, "get");

	}

	if(is_array($_POST)){

		extract($_POST, EXTR_PREFIX_SAME, "post");

	}

	if(is_array($_COOKIE)){

		extract($_COOKIE, EXTR_PREFIX_SAME, "cookie");

	}

	if(is_array($_FILES)){

		extract($_FILES, EXTR_PREFIX_SAME, "file");

	}

	if(is_array($_ENV)){

		extract($_ENV, EXTR_PREFIX_SAME, "env");

	}

	if(is_array($_REQUEST)){

		extract($_REQUEST, EXTR_PREFIX_SAME, "request");

	}

	if(is_array($_SESSION)){

		extract($_SESSION, EXTR_PREFIX_SAME, "session");

	}

}

class Mysql {

	var $mysql_username;

	var $mysql_password;

	var $mysql_db;

	var $mysql_host;

	var $result_id;

	var $link_id;

	var $dbconnect;

	var $num_rows;

	var $query_count=0;

	

	function Connect() {

		require("config.php");

	$this->mysql_username=$mysql_username;

	$this->mysql_password=$mysql_password;

	$this->mysql_db=$mysql_db;

	$this->mysql_host=$mysql_host;

		$this->link_id=mysql_connect($this->mysql_host,$this->mysql_username,$this->mysql_password);

			if (!$this->link_id) {

			echo "Unable to connect to mysql server";

		}

		$this->dbconnect=mysql_select_db($mysql_db);

			if (!$this->dbconnect) {

			echo "Unable to select database";

		}

		return $this->link_id;

	}

	function Query($sql) {

		$this->result_id=mysql_query($sql) or die(mysql_error());

		$this->query_count++;

		return $this->result_id;

		return $this->query_count;

	}

	function Num_rows() {

		$this->num_rows=mysql_num_rows($this->result_id);

		return $this->num_rows;

	}

	function Free_result() {

		mysql_free_result($this->result_id);

	}

	function Close() {

		mysql_close($this->link_id);

	}

}

	function Naif()

	{

	

}



?>


#9 qwe010

qwe010
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 26 September 2006 - 10:50 PM

up.............

#10 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 26 September 2006 - 11:26 PM

up.............


If you want to provide more useful information, by all means do so. Bumping a thread isn't really helpful. If someone can work out how/if you can be helped, they'll find the thread.

This sounds more like a crapTM web host than a scripting problem given what you've explained.
Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users