Okay i have this so far -----------------------------------------------
<?php $conn = mysql_connect("localhost", "", ""); mysql_select_db("ERIC",$conn); $sql = "SELECT * FROM rocket"; $result = mysql_query($sql, $conn) or die(mysql_error()); while ($newArray = mysql_fetch_array($result)) { $partno = $newArray['PARTNO']; $description = $newArray['DESCRIPTION']; $comment = $newArray['COMMENT']; } ?> ----------------------------------------------------------- How do i make it so if i type http://localhost/test.php?partno=5r&description=copper Cheers if you can help out! "Justin Patrin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Eric Holmstrom wrote: > > > Hi there > > > > I have a database called "Eric" and table name called "Rocket'. > > > > Table consists of three values. > > PARTNO | DESCRIPTION | COMMENT > > > > So far if i want to show copper headgaskets from the 5r field i put this > > string into the php script (along with the rest of the html/php code) > > > > $sql = "SELECT * FROM rocket WHERE partno like '5r%' AND description like > > 'COPPER HEADGASKET%'"; > > > > The problem is there is 1000s of different querys i want to run and dont > > want to make a page for each query. So what im trying to ask is how do i run > > a query to display the results (like http://www.domain.com/query.php?"the > > query i want to run" rather then link to a .php/html file with the query > > inside of it.) > > The short answer is to use a GET variable for this. > > http://example.com/script.php?sql=SELECT... > > You have to remember to url encode the SQL, though (see urlencode()). > You can access it like this: > > $_GET['sql'] > > The longer answer is to use a package such as DB_DataObject_FormBuilder > (http://pear.php.net/package/DB_DataObject_FormBuilder) to generate this > stuff for you. It will take some setup, but once you're used to it, it > can make this kind of app happen real quick. > > -- > paperCrane <Justin Patrin> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php