Greetings, guys and gals,
I'm pretty green with PHP and MySQL, however, using code I found here and in the manual pages here, I have managed to successfully implement a very simple process for a frameset page chooser.
To see what I mean, you may look at it on
http://warburton.comwww2.dsvr.co.uk/mhm/
The main menu page directs users to a subsequent page which is a frameset, and depending on which menu item the user chose depends on which page is loaded into the lower frame in the frameset.
That I want to do is find out actually what MySQL and PHP are doing here to see if I'm not hitting my database too many times to get the results.
The code I've used is as follows:
<?php
mysql_connect (localhost, myuser,mypass);
mysql_select_db (agency);
$query = "SELECT url FROM MHM WHERE pageid = '$pageid' ";
$result = mysql_query($query);
$urlreturned=mysql_result($result,0,"url");
?>
<frameset rows="103,396" cols="*" frameborder="yes" border="1" framespacing="0" scrolling=no>
<frame src="topframe.html">
<frame src="
<? print $urlreturned;?>
" name="mainpane">
</frameset>
All the links to this include a pageid reference "frames.php3?pageid=1" etc.
Now this works fine, you can see that from the working site.
What I want to know is this:
Am I hitting my database more than once for a query resultset, once in each of these?:
$result = mysql_query($query);
$urlreturned=mysql_result($result,0,"url");
Are there any easier ways to do this (I appreciate this is very simple right now)?
Thanks, and hopefully, this will be useful to others who need to do this too.
Richard