How do I find the longest value in my mysql table?
So you probably know that the LENGTH() function applied to a fieldname will return the length of that field.
So then all you need is the relevant query to find the length of the longest item in a field like so:
$q = mysql_query("SELECT LENGTH(firstname) AS thelength FROM myfriends ORDER BY thelength DESC LIMIT 1");
$longestname = mysql_result($q,0,0);
echo "The longest first name is $longestname letters long!";
More mysql PHP QuestionsWhat is difference between mysql_fetch_array and mysql_fetch_object?
Why does this code not work? Returns this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND ClaimNo = AND UserName = john' at line 2
I tried to do query,but it didnt work i receive an error message arning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in
how will use a mysql_query to get a single4 person list? With example.
Welcome by regersteration form First name: last name: