kena1921 Posted July 18, 2007 Share Posted July 18, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/60530-phpmysql-data-traffic/ Share on other sites More sharing options...
MadTechie Posted July 18, 2007 Share Posted July 18, 2007 Code seams ok.. you say each page runs a query, are their more then 1 query ? are you running the same query more than once per page .. we really need some more info.. Quote Link to comment https://forums.phpfreaks.com/topic/60530-phpmysql-data-traffic/#findComment-301098 Share on other sites More sharing options...
AndyB Posted July 18, 2007 Share Posted July 18, 2007 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). Quote Link to comment https://forums.phpfreaks.com/topic/60530-phpmysql-data-traffic/#findComment-301123 Share on other sites More sharing options...
kena1921 Posted July 18, 2007 Author Share Posted July 18, 2007 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?? Quote Link to comment https://forums.phpfreaks.com/topic/60530-phpmysql-data-traffic/#findComment-301135 Share on other sites More sharing options...
AndyB Posted July 18, 2007 Share Posted July 18, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/60530-phpmysql-data-traffic/#findComment-301469 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.