Skip to content
Advertisement

Return One Row from MySQL

Amateur question, but something I’ve been wondering about. What is the PHP for selecting one row from a MySQL query? AKA you’re picking something by unique ID (you know there’s only one row that matches your request) and want to get only that value. Do you still have to use a while loop and mysql_fetch_row?

JavaScript

Advertisement

Answer

Add limit 0,1 and for PHP 7 use mysqli

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement