//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
//select a database to work with
$selected = mysql_select_db("$dbname",$dbhandle)
or die("Could not select $dbname");
//execute the SQL query and return records
$result = mysql_query("SELECT orders_id FROM orders WHERE
customers_id='1'");
Now this gets 2-3 rows, or more specifcly 2-3 cells from orders_id.
Id like to pass those 2-3 cells into another mysql connection, because it needs to take those 2-3 cells and do a query like so(lets say i pass the 2-3 cells to $cells):
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
//select a database to work with
$selected = mysql_select_db("$dbname",$dbhandle)
or die("Could not select $dbname");
//execute the SQL query and return records
$result = mysql_query("SELECT * FROM orders_products WHERE
orders_id='$cells'");
//fetch tha data from the database
while ($row = mysql_fetch_array($result)) {
echo "Product Name: ".$row{'products_name'};
}
Im not sure how to set the 2-3 cells to a variable since its an array, and i dont know how to recieve it into another mysql database connection.
Any help please?
thanks
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
//select a database to work with
$selected = mysql_select_db("$dbname",$dbhandle)
or die("Could not select $dbname");
//execute the SQL query and return records
$result = mysql_query("SELECT orders_id FROM orders WHERE
customers_id='1'");
Now this gets 2-3 rows, or more specifcly 2-3 cells from orders_id.
Id like to pass those 2-3 cells into another mysql connection, because it needs to take those 2-3 cells and do a query like so(lets say i pass the 2-3 cells to $cells):
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
//select a database to work with
$selected = mysql_select_db("$dbname",$dbhandle)
or die("Could not select $dbname");
//execute the SQL query and return records
$result = mysql_query("SELECT * FROM orders_products WHERE
orders_id='$cells'");
//fetch tha data from the database
while ($row = mysql_fetch_array($result)) {
echo "Product Name: ".$row{'products_name'};
}
Im not sure how to set the 2-3 cells to a variable since its an array, and i dont know how to recieve it into another mysql database connection.
Any help please?
thanks