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 QuestionsHow do I find second highest value from a table?
how do i upload an image to database?
I'm creating a table to store clients' info via PHP; can I make an inquiry field where the client can enter comments about their inquiry?
How do I connect to mySQL from PHP?
First of all I'm new to php n' mySql . So I just can't figure out what's the wrong in my code. I'm using WAMP and I've created a db named "Try" and in that there is a table named "test". this is my php code and it dosen't give me a