i have been teaching myself how to create a shopping cart with php, html and msql database through some tutorials the problem i have now is the msql code i need to use to display the products from the database..
i will appreciate your guidance

thanx

Get all your products
SELECT * from products_table

if you need single product, get by id
SELECT * FROM products_table WHERE id = '$id'

If you have categories and use index id's
SELECT * FROM products_table WHERE category_id = '$cat_id'

you can use a foreach loop to get all the records from your query and loop through and display the results:

If you are using procedureal style code with out html 
foreach($results as $result){
    echo $result['product_name'];
    echo $result['product_description'];
    echo $result['product_price'];
}


Using object orientented style with html
foreach($results as $result){
    echo '<p>' . $result->product_name . '</p>';
    echo '<p>' . $result->product_description . '</p>';
    echo '<p>' . $result->product_price . '</p>';
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.