Powerballs
Powerballs

Reputation: 45

Reading $_GET after clicking the href image. How to display other data?

<?php
include ('adoption_1.php');

if(isset($_GET['animal_ID'])){
    $aID = intval($_GET['animal_ID']);

    $result = $conn->prepare("SELECT * FROM adoption where a_id = ?, Abreed= ?, AAnimalName= ?");
    $result->bind_param('iss', $aID, $Abreed, $AAnimalName);
    $result->execute();

    $AAnimalName = ($_GET['AAnimalName']);
    $Abreed = ($_GET['Abreed']);

    echo $aID. $Abreed. $AAnimalName;

}else{

    echo "animal id not set";
    //exit or redirect back
}

?>

LINKING IMAGE

I want to show more information of each pet shown in the image. New to prepared statements. I guess i did something wrong with the query. $aID is working on the display when clicked. How to show other information such as $AAnimalName and $Abreed

Upvotes: 0

Views: 30

Answers (1)

Funk Forty Niner
Funk Forty Niner

Reputation: 74217

SELECT * FROM adoption where a_id = ?, Abreed= ?, AAnimalName= ? is incorrect syntax.

RTM's

The WHERE clause uses AND - OR as separators, not commas as does UPDATE.

Upvotes: 1

Related Questions