You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
I'm trying to write a bit of code and if possible I want to generalise the search query.
I have this query at the moment:
$query = "SELECT * FROM Table_Article WHERE Article_ID='$Article_ID_Value'";
Which is fine if $Article_ID_Value="1" or "2" or "1500" but if I want to get a full list * this isn't working.. possibly because MySQL is looking for "*" in the Article_ID column and not returning me all (*) the result
I'm not an expert on MySQL, but try a LIKE query instead of an = query.
$query = "SELECT * FROM Table_Article WHERE Article_ID LIKE '$Article_ID_Value'";
Then the wildcard you want for all records is % not *