Hello! OK, if its for the internet see if you have mysql and phpmyadmin now if you do... do this
not dbname is your own db name
create database dbname;
once you do this we need to set and create a table in side of the database like so
create table products(
id int not null auto_increment primary key,
product_name varchar(30),
product_des varchar(255),
added datetime);
that would create it now just to insert data into your database
INSERT INTO products set
product_name = "PRODUCT NAME GOES HERE",
product_des = "Product Description Goes Here",
added = NOW();
ok that would do the insert of the data, now to get data maybe by clicking info just create a product page such as
product.php
and of course where your products are listed
now in the page where the products are listed you need to set the URL or LINK to where you send them to view the product in a type of GET tag such as...
Nike Shoes
That would of course put Nike Shoes on the Screen, now to get that pid that was sent in your product.php
you need to get the data like so
Now the reason we get pid is because it follows the question mark and is what is = the product name
$pname = $_GET['pid'];
?>
ok now we need to connect and set db values
$dbhost = "localhost"; //It usally is set to local host
$dbuser = "user"; // the user set to ur db
$dbpass = "pass"; // the user of the db pass
$dbname = "databasename"; of course is the databasename
// ok now to connect to the db
mysql_connect("$dbhost","$dbuser","$dbpass");
// now to select the db :-)
mysql_select_db("$dbname") or die("Could Not Connect");
// OK now to get the data
//First set the query
$query = "SELECT * FROM products where product_name =
'$pname'";
// Now to echo it OUT!!!
while( $info = mysql_fetch_array($query))
{
echo "
$info['product_name'] |
$info['product_des']";
//Thats baiscily it WHEW Longest answer EVER
?>
use excel best thing to use
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...
|