I want to select only unique values with php/mysql.
I can do it with many line, but I forget how to do it without while… 🙂
Thanks a lot.
Here is the code that I want to do without while.
$request_1m = "SELECT date1, date2 from mytable";
$result_1m = mysql_query($request_1m,$db);
while($row = mysql_fetch_array($result_1m))
{
/* Get the data from the query result */
$date1_1m = $row["date1"];
$date2_1m = $row["date2"];
}
I’m not sure I understand your question, but here’s what I think you want to do :
Note that this will only get the first row from the result set (just as if you LIMIT 1)