[Solved] I want to pass a unique variable ie product code or product id from database in url of a product [closed]


You can use Get Variables

like:

sitename.com/index.php?id=1234

And in the index.php something like:

<?php
    $DBuser = "XXX";
    $DBpassword = "XXX";
    $DBhost = "localhost"; 
    $DBname = "XXX";

    $mysqli = new mysqli($DBhost, $DBuser, $DBpassword, $DBname);
    if ($mysqli->connect_errno) {
        printf("Connect failed: %s\n", $mysqli->connect_error);
        exit();
    }

    if ($result=$mysqli->multi_query("SELECT * FROM productos WHERE id='".$_GET['id']."' LIMIT 1")) {
        $data = mysqli_fetch_assoc($result)
        print_r($data);
    } else
        echo "Error, id not found";

?>

2

solved I want to pass a unique variable ie product code or product id from database in url of a product [closed]