Date: 11/26/05 (Computer Geeks) Keywords: php, programming, mysql, browser, html, database, asp, sql I've done plenty of ASP.NET programming but this is my first foray into the wonderful land of PHP and I've got a question about how often you hit the database in a normal page load... basically I have tags like: $database = mysql_connect("localhost", "your_database_user_id", "your_database_password"); mysql_select_db("your_database_name", $database); switch($type){ case 'thumbnail': header("Content-type: image/jpeg"); // act as a jpg file to browser $query = "SELECT thumbnail FROM your_table WHERE id = $id"; $result = mysql_query($query, $database); $row = mysql_fetch_array($result); $jpg = $row["thumbnail"]; echo $jpg; break; case 'address': header("Content-type: text/html"); // act as an html file to browser $query = "SELECT address FROM your_table WHERE id = $id"; $result = mysql_query($query, $database); $row = mysql_fetch_array($result); $address = $row["address"]; echo $address; break; } Now if I understand this correctly, anytime the parser hits a Source: http://www.livejournal.com/community/computergeeks/824527.html
|