Re: [PHP] hello the list

2002-07-14 Thread DL Neil

Welcome Nicolas,
=You didn't actually say what the problem was!
=Some have made suggestions, please also consider (below):


i'm new and i'm trouble with this code :'( can U help me please ??

this is the code :

while ($cd_tbl = mysql_fetch_array ($result))
{
$cd_id = $cd_tbl['cd_id'];
$cd_oeuvre = $cd_tbl['cd_oeuvre'];
$cd_chef = $cd_tbl['cd_chef'];
$cd_compositeur = $cd_tbl['cd_compositeur'];

---partie concernée-
//-Debut Seth
//--
// name : _ALTERNANCE_COULEUR_
// desc : test de 'id' pour l'alternance de couleur
//--

if(is_int($cd_id) = TRUE)


=there is no need for the double-quotes in this statement.
=you should be coding equality (==) or even equality and type equivalence
(===)

Regards,
=dn



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




[PHP] hello the list

2002-07-13 Thread Nicolas GUILLOU

i'm new and i'm trouble with this code :'( can U help me please ??

this is the code :

while ($cd_tbl = mysql_fetch_array ($result))
{
$cd_id = $cd_tbl['cd_id'];
$cd_oeuvre = $cd_tbl['cd_oeuvre'];
$cd_chef = $cd_tbl['cd_chef'];
$cd_compositeur = $cd_tbl['cd_compositeur'];

---partie concernée-
//-Debut Seth
//--
// name : _ALTERNANCE_COULEUR_
// desc : test de 'id' pour l'alternance de couleur
//--

if(is_int($cd_id) = TRUE)
{
$bgcolor=#00;
}
else
{
$bgcolor=#33;
}
echo tr;
echo td bgcolor=$bgcolorfont face=Verdana size=1b$cd_id/b/font/td;
echo td bgcolor=$bgcolorfont face=Verdana 
size=1b$cd_compositeur/b/font/td;
echo td bgcolor=$bgcolorfont face=Verdana size=1b$cd_oeuvre/b/font/td;
echo td bgcolor=$bgcolorfont face=Verdana size=1b$cd_chef/b/font/td;
echo td bgcolor=$bgcolor;
echo a href=detail.php?cd_id=$cd_idfont face=Verdana size=1bFiche 
complète/b/font/a;
echo /td;
echo /tr;
}

//- Fin Seth


echo /table;
}

^lease help me !! :'(
thx !
Seth



Re: [PHP] hello the list

2002-07-13 Thread Alberto Serra

ðÒÉ×ÅÔ!

Nicolas GUILLOU wrote:

You may either write:

 echo td bgcolor='$bgcolor'font face=Verdana size=1b$cd_id/b/font/td;

or

 echo td bgcolor=.$bgcolor.font face=Verdana 
size=1b$cd_compositeur/b/font/td;

ðÏËÁ
áÌØÂÅÒÔÏ
ëÉÅ×

-_=}{=_-@-_=}{=_--_=}{=_-@-_=}{=_--_=}{=_-@-_=}{=_--_=}{=_-

LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu?
lOrD i'M sHiNiNg...
YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is...


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




Re: [PHP] hello the list

2002-07-13 Thread Matt

 echo td bgcolor=$bgcolorfont face=Verdana
size=1b$cd_id/b/font/td;

Strings work differently when the outer quotes are double or single quotes.
Inside double quotes variables will be converted into their values.  Inside
single they will not.
So:
$var = 'Hello World';
echo $varbr\n;

will result in
Hello Worldbrnewline

and:
$var = 'Hello World';
echo '$varbr\n';

will result in
$varbr\n  //actual two characters '\' and 'n' and not newline.

Inside double or single quotes, you can use the other quote:
$var = 'Hello World';
echo $varbr\n;
Hello Worldbrnewline

$var = Hello 'World';
echo $varbr\n;
Hello 'World'brnewline

Your trouble is that you're using double quotes inside a double quoted
string and the second double quote that php encounters will terminate the
string. The next thing encountered is your variable $bgcolor, but that
syntax isn't correct.  php sees your string as three pieces:
1. td bgcolor=
2. $bgcolor
3. font face=Verdana size=1b$cd_id/b/font/td;

So you could either convert the double quotes inside the string into single
quotes:
echo td bgcolor='$bgcolor'font face=Verdana
size=1b$cd_id/b/font/td;

or escape the double quotes like this:
echo td bgcolor=\$bgcolor\font face=Verdana
size=1b$cd_id/b/font/td;

or you could concatenate the three pieces:
echo td bgcolor= . $bgcolor .font face=Verdana
size=1b$cd_id/b/font/td;

I personally like all of the tag values double quoted so I'd
echo td bgcolor=\$bgcolor\font face=\Verdana\
size=\1\b$cd_id/b/font/td;


When php parses the outside double quoted string, it has to do extra work to
convert variables.  I generally use single quotes unless there's a variable
or special char to convert (like newline).  It doesn't really matter though,
it's fast anyway.

If your using arrays inside a double quoted string, you need to help php out
and use special coding. This code won't work:
$arr = array('fish' ='Tuna','reptile' = 'Snake','rodent' = 'mouse');
echo $arr['fish']br\n;

This will work:
$arr = array('fish' ='Tuna','reptile' = 'Snake','rodent' = 'mouse');
echo {$arr['fish']}br\n;  // note the curly braces around the array



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