nonaguy
June 12th, 2008, 07:34 PM
We know how to do a PHP MySQL query:
An example:
<?php
$username="";
$password="";
$database="archives";
$id=$_GET['id'];
mysql_connect("dataserver.archives.org:3306",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM doctype WHERE ID='$id'";
$result=mysql_query($query);
mysql_close();
?>
As you can see this puts the results of the query into a variable: $query. What I would like to know is, if it's possible, to run another MySQL query against that variable.
An example:
<?php
$username="";
$password="";
$database="archives";
$id=$_GET['id'];
mysql_connect("dataserver.archives.org:3306",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM doctype WHERE ID='$id'";
$result=mysql_query($query);
mysql_close();
?>
As you can see this puts the results of the query into a variable: $query. What I would like to know is, if it's possible, to run another MySQL query against that variable.