I have a database and i like to search multiple primary keys separated by comas and display the respective rows in the next page . For example i have a table with 5 rows and the primary keys are like 1,2,3,4,5. Now in my search text-box if I type 1,2,3 it should display the first 3 columns in the next page. I am a beginner to php , so i don't now whether it is possible .I have done the search for a single key and it is working fine.
use IN:
SELECT * FROM your_table WHERE id IN (1,2,4,6,88);
Your textbox contains a string with comma separated values?
If so, you should be fine using the IN word like the previous answer, but comming from a PHP form:
LEAVING SECURITY AS AN OBVIOUS @TODO
$keys = $_POST['keys'];
$query = 'SELECT * FROM table WHERE id IN (' . $keys . ')';
$result = $whatever_object_you_using_for_database->query($query);
Would be great if you could uptade your question with the code you've tried, even the HTML code