dimanche 26 juin 2016

Php Select Statement works with id as record selector but will not work if I use a different column as a selector

Php Select Statement works with id(with unique values) as record selector but will not work if I use a different column(with unique values) as a selector

THIS WORKS

$Idart = "4";
$sql2 = "SELECT * FROM articles where id in ({$Idart})";
$results2 = $conn->query($sql2);
$row2 = $results2->fetch_assoc();

THIS DOES NOT WORK

$Idart = "5-6142-8906-6641";
$sql2 = "SELECT * FROM articles where IDStamp in ({$Idart})";
$results2 = $conn->query($sql2);
$row2 = $results2->fetch_assoc();

I've tried a variety of different things with MYSQL including deleting "id" column and making "IDStamp" the primary key. Any thoughts appreciated.

Aucun commentaire:

Enregistrer un commentaire