Guest Posted November 23, 2002 Posted November 23, 2002 need a little help with a simple code that would do this, The user submits a form supplying their order id it is passed to form.php as $order_id I have a table named orders_products that contains their orders_id and the products_id that they ordered. Then I have a table named products_description that contains a field named products_lister_url that contains a url to a page for the product they ordered and the products_id right now form.php validates the orderer by email_address and orders_id I need it to ,based on the order id to get the products_id from the first table store it in a variable and using that variable get the products_lister_url based on that variable and put it into a variable so that it can be called on in html body via a php call. does that make any sense, here is what got so far <?php include('includes/application_top.php'); #################Get Products_id to assign page redirect after validation############################## $sql = mysql_query("select products_id From orders_products WHERE orders_id = '$order_id'"); $result = mysql_query($sql); $sql2 = mysql_query("select products_lister_url FROM products_description WHERE products_id = '$result'"); $result2 = mysql_query($sql2); #################Get oder id and lister email address for validation ################################# $result = mysql_query("select orders_id, customers_email_address From orders WHERE orders_id = '$order_id' AND customers_email_address = '$lister_email'"); $number = mysql_num_rows($result); if($number) { echo "Thank You! You Are Whom You Say You Are!!<br>Please Continue"; } else { echo "your info is incorrect"; } ?> <HTML> <HEAD> <TITLE>Test this script.</TITLE> </HEAD> <BODY> <br><br><?php echo $result2; ?> </BODY> </HTML> Quote
Guest Posted November 23, 2002 Posted November 23, 2002 $query = "SELECT orders_id, products_id FROM orders_products WHERE orders_id = '$order_id'"; $result = mysql_query($query) or die ("Couldn't axecute query."); while ($row = mysql_fetch_array($result)) { $products_id = $row['products_id']; echo "$products_id"; } $query = "SELECT products_lister_url FROM products_description WHERE products_id = '$products_id'"; $result1 = mysql_query($query) or die ("Couldn't axecute query."); while ($row = mysql_fetch_array($result1)) { $products_lister_url = $row['products_lister_url']; echo "$products_lister_url"; } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.