Re: [PHP] Best way to read first 20 characters of a string?
Thank you everyone, I REALLY appreciate it. Sorry my head isn't in place today and I couldn't think. Chris On Wed, Dec 2, 2009 at 10:18 AM, Devendra Jadhav wrote: > mysql substr function > http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substr > > On Wed, Dec 2, 2009 at 8:41 PM, Chris Payne > wrote: >> >> Hi everyone, >> >> I'm pulling data from a mysql database, but need only the first 20 >> characters of each string for a short description, what is the best >> method to just grab the first 20 characters from a string regardless >> of whether they are letters or numbers? >> >> Chris >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > > > -- > Devendra Jadhav > दà¥à¤µà¥à¤à¤¦à¥à¤° à¤à¤¾à¤§à¤µ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to read first 20 characters of a string?
mysql substr function http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substr On Wed, Dec 2, 2009 at 8:41 PM, Chris Payne wrote: > Hi everyone, > > I'm pulling data from a mysql database, but need only the first 20 > characters of each string for a short description, what is the best > method to just grab the first 20 characters from a string regardless > of whether they are letters or numbers? > > Chris > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Devendra Jadhav दà¥à¤µà¥à¤à¤¦à¥à¤° à¤à¤¾à¤§à¤µ
Re: [PHP] Best way to read first 20 characters of a string?
Not exaclty a php thingie but well ;) Sql: Select left(column, 20) as c from table. Or you can do it with âselect substr(columnname, 0,20)â. See the mysql manual. Dunno which of the two is faster, but i think âleftâ is. Majk - Original Message - From: oxygene...@gmail.com To: php-general@lists.php.net Sent: Wed Dec 02 16:11:55 2009 Subject: [PHP] Best way to read first 20 characters of a string? Hi everyone, I'm pulling data from a mysql database, but need only the first 20 characters of each string for a short description, what is the best method to just grab the first 20 characters from a string regardless of whether they are letters or numbers? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to read first 20 characters of a string?
On Wed, Dec 2, 2009 at 10:11, Chris Payne wrote: > Hi everyone, > > I'm pulling data from a mysql database, but need only the first 20 > characters of each string for a short description, what is the best > method to just grab the first 20 characters from a string regardless > of whether they are letters or numbers? -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Looking for hosting or dedicated servers? Ask me how we can fit your budget! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best way to read first 20 characters of a string?
Hi everyone, I'm pulling data from a mysql database, but need only the first 20 characters of each string for a short description, what is the best method to just grab the first 20 characters from a string regardless of whether they are letters or numbers? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php