Jump to content

PHP/mySQL data traffic


kena1921

Recommended Posts

Hi

 

I have some issues re a number of PHP/mySQL pages I have written and the amount of traffic that they are generating.  The pages are on an internal (citrix) network and are assessed via a datacard.  However the amount of data that is being moved is huge and I don’t understand why.

 

I am reasonable proficient in PHP and understand the principles of server side code but I could do with some clarification on the traffic issues.

 

Each page has to display data generated by a query.  In some instances records are updated or even created. Below is a sample of the code I’m using (to populate a list box).

 

----------------------------------

<?php

 

// open connection

 

$con = @mysql_connect("localhost","root","") or die("Connection to mySQL failed");

 

mysql_select_db("myDB",$con) or die("Cannot Connect to db");

 

//build sql statement

$sqlArea = "select * from tab_areas order by AREName";

 

//execute sql

$resArea = mysql_query($sqlArea) or die(mysql_error());;

 

//run loop to get row values and build into option statement

while ($row=mysql_fetch_array($resArea)) {

 

$area=$row["AREName"];

$areaID = $row["AREArea_ID"];

 

$option_area.="<OPTION VALUE=".$areaID.">".$area."</option>\n";

 

}

 

mysql_close($con)

 

?>

 

…html

 

<select name="area">

        <?php echo $option_area;?>

</select> 

----------------------------------

 

So in the above example, if the table size of tab_areas is 16384kb does this mean that the amount of data that will be moved from the server to the browser, after the query is run, will be 16384kb plus the size of the page?

 

All help gratefully received

 

Link to comment
Share on other sites

So in the above example, if the table size of tab_areas is 16384kb does this mean that the amount of data that will be moved from the server to the browser, after the query is run, will be 16384kb plus the size of the page?

 

No. The amount of data moved from the server to the browser is the html output (of the script).

Link to comment
Share on other sites

So then the data would simply be the size of the page as, of course, the all of the data generated by any queries is written into the html (obvuious when you think about it!)

 

So how does it work wuth data going the other way ie data entered onto the page by the user that is then saved to the database??

Link to comment
Share on other sites

So how does it work wuth data going the other way ie data entered onto the page by the user that is then saved to the database??

 

The traffic back is whatever gets sent. If it's from a form with 2 variables it's less than from a form with a zillion variables.  HTTP couldn't care less what happens to the data when it arrives at the server, e.g. whether it goes to a database or not.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.