Re: [PHP-DB] limiting field extraction to 40 characters

2002-12-12 Thread Peter Beckman
$1 is a bad variable.  You can't have variables that start with a number.

Try $a or $foo or $bar.

On Thu, 12 Dec 2002, mike karthauser wrote:

> If i try the below in my query i get no results.
>
> Ideally i would like to do this (not valid sql)
>
>  printf("\n");
> while ($myrow = mysql_fetch_array($result)) {
>
> $l=$myrow['coursecode'];
> ?> selected="selected"':"";?>> }
> printf("\n");
> ?>
>
>
> on 11/12/02 5:26 pm, Peter Beckman at [EMAIL PROTECTED] wrote:
>
> > LEFT(str,len)
> > Returns the leftmost len characters from the string str:
> >
> > mysql> SELECT LEFT('foobarbar', 5);
> > -> 'fooba'
> >
> > This function is multi-byte safe.
> >
> >
> > select left(coursecode,40) from courses
>
>
>
> > On Wed, 11 Dec 2002, mike karthauser wrote:
> >
> >> I am using
> >>
> >>  >> printf("\n");
> >> while ($myrow = mysql_fetch_array($result)) {
> >>
> >> $l=$myrow['coursecode'];
> >> ?> >> selected="selected"':"";?>> >> }
> >> printf("\n");
> >> ?>
> >>
> >> to generate a html . Unfortunately a few of my course titles
> >> are really long and this effects the rendering of the 
> >> making it ultra wide.
> >>
> >> Is there a way i can print only the first 40 characters of the title - even
> >> though the full title lives in the db still (it is used throughout the
> >> site)?
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] limiting field extraction to 40 characters

2002-12-12 Thread mike karthauser
If i try the below in my query i get no results.

Ideally i would like to do this (not valid sql)

\n");
while ($myrow = mysql_fetch_array($result)) {

$l=$myrow['coursecode'];
?>>\n");
?>


on 11/12/02 5:26 pm, Peter Beckman at [EMAIL PROTECTED] wrote:

> LEFT(str,len)
> Returns the leftmost len characters from the string str:
> 
> mysql> SELECT LEFT('foobarbar', 5);
> -> 'fooba'
> 
> This function is multi-byte safe.
> 
> 
> select left(coursecode,40) from courses



> On Wed, 11 Dec 2002, mike karthauser wrote:
> 
>> I am using
>> 
>> > printf("\n");
>> while ($myrow = mysql_fetch_array($result)) {
>> 
>> $l=$myrow['coursecode'];
>> ?>> selected="selected"':"";?>>> }
>> printf("\n");
>> ?>
>> 
>> to generate a html . Unfortunately a few of my course titles
>> are really long and this effects the rendering of the 
>> making it ultra wide.
>> 
>> Is there a way i can print only the first 40 characters of the title - even
>> though the full title lives in the db still (it is used throughout the
>> site)?


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] limiting field extraction to 40 characters

2002-12-11 Thread Peter Beckman
LEFT(str,len)
Returns the leftmost len characters from the string str:

mysql> SELECT LEFT('foobarbar', 5);
-> 'fooba'

This function is multi-byte safe.


select left(coursecode,40) from courses

Peter

On Wed, 11 Dec 2002, mike karthauser wrote:

> I am using
>
>  printf("\n");
> while ($myrow = mysql_fetch_array($result)) {
>
> $l=$myrow['coursecode'];
> ?> selected="selected"':"";?>> }
> printf("\n");
> ?>
>
> to generate a html . Unfortunately a few of my course titles
> are really long and this effects the rendering of the 
> making it ultra wide.
>
> Is there a way i can print only the first 40 characters of the title - even
> though the full title lives in the db still (it is used throughout the
> site)?
>
> cheers
> --
> Mike Karthauser
> Managing Director - Brightstorm Ltd
>
> Email   >> [EMAIL PROTECTED]
> Web >> http://www.brightstorm.co.uk
> Tel >> 0117 9426653 (office)
>07939 252144 (mobile)
>
> Snailmail   >> Unit 8, 14 King Square,
>Bristol BS2 8JJ
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php