*scratches head*
Are you referring to query strings when you say "variables"? Query strings are like the following: let's say you have ?id=82 at the end of http://mywebsite.com/shop/buy.php. The id becomes a variable with the value of 82. In PHP, you could read query string variables using the $_GET variable. For example, if you had the URL http://mywebsite.com/shop/buy.php?id=82:
PHP Code:
<?php
echo $_GET['id'];
?>
...would print "82" on the webpage.
How to find a product: Well, since you clearly want a MySQL solution, here's a stab at it.
Let's say you have a table named `products` with product_id as the primary key. You could write somehting like:
PHP Code:
<?php
// Connect to MySQL.
$product_id = mysql_escape_string($_GET['id']);
$query = mysql_query("SELECT * FROM `products` WHERE product_id = $product_id") or die(mysql_error());
?>
And that would query the database.
As for the rest, do you mean "add a random code to another database", do you mean another table? Because that's different. If you want to add it to another database, you're going to need to disconnect and then reconnect MySQL.
Do you have any code for us to work with/
Bookmarks