I need to make a query (mysql database) for get the content of a specific texarea field. For do that I use the follow query:
SELECT mytextareacolumn FROM my_table WHERE user_id = [user_id]
Using this query allow me to get the full content of the texarea for each of my users but my goal was to get only the first 200 character and not the full text. Somebody told me is possible to do something using the SQL functions such as SUBSTR but I don't know how to include this function in my query.
I'm not a coder just a poor newbie.
Anybody can suggest me something please?
just use substring function in you query, it will look like:
SELECT SUBSTRING(mytextarea,1,200) as `mytextarea` FROM `my_table` WHERE `user_id`=[user_id]
It should be something like that, but I'm not 100% sure
Sorry, i dont know how to edit the post, but I have made a wrong there, it should be:
SELECT SUBSTRING(mytextarea,1,200) FROM `my_table` WHERE `user_id`=[user_id]
sorry guy I forget to thank you
Yes now all is fine for me. In my case the following query do the job:
SELECT SUBSTRING(`myfieldname`,1,200) FROM `mytable` WHERE `user_id` = '[user_id]'
all the best