I want to have my own webpage (using PHP) display a conditional link - like this: If product id 3 is disabled, display: Sorry, this product is sold out - check back later. If product id 3 is enabled, display: Click here to order... Any ideas for this coding? Pretty simple, yes?
There may be a clever API way of doing it otherwise a manual thing could be: PHP: <?php$servername = "localhost";$username = "db_username";$password = "db_password";$dbname = "database_name";// Create connection$conn = new mysqli($servername, $username, $password, $dbname);// Check connectionif ($conn->connect_error) { die("Connection failed: " . $conn->connect_error);}$sql = "SELECT is_disabled FROM am_product WHERE product_id = '3'";$result = $conn->query($sql);if ($result->num_rows == 1) { while($row = $result->fetch_assoc()) { if ($row["is_disabled"] == 0) { echo "<a href='http://www.yoursite.org.uk/yourfile.php' >Click here to order...</a>"; } else { echo "Sorry, this product is sold out - check back later."; } }}$conn->close();?> I haven't tried it so it may need a bit of debugging.