Re: [PHP] Change styling depending on var value

2009-11-23 Thread Phil Matt
Mari Masuda wrote: This may be a dumb question, but did you actually fetch the db query's results and put them in $row before trying to use $row? In MySQL you could do something like: $query = select * from my_table; $result = mysql_query($query); $row = mysql_fetch_array($result); //this

[PHP] CSS and variables

2009-11-20 Thread Phil Matt
De-lurking here. I'm trying, with no success, to use some CSS styling on my PHP output. Here's the code I want to style: echo 'trtd class=spacer'.$row[0].'/tdtd'.$row[1].'/td I want to use a CSS style for the second td cell, picking up the style from the value of a variable. I tried this:

Re: [PHP] Change styling depending on var value

2009-11-20 Thread Phil Matt
Ashley Sheridan wrote: Copying back the phplist *again*! Sorry. I'll remember to copy in... what does your code currently look like now, with the right == in? $entree=meat; $beverage=coffee; if ($row[3] == $entree) { $newcolor=color:red; } elseif ($row[3] == $beverage) {

Re: [PHP] Change styling depending on var value

2009-11-20 Thread Phil Matt
Dan McCullough wrote: To add to what Ashley said about $row[3], remember that when you are returning from the db the counter for fields will start at 0 not 1, so if its the 3rd field that will be $row[2]. You might also want to do switch rather then elseif but thats always a good debate.

Re: RES: [PHP] CSS and variables

2009-11-20 Thread Phil Matt
Jônatas Zechim wrote: Try: echo 'td style=' . $newcolor .'' . $row[1] . '/td'; Thanks, Jônatas. This was the solution. Cheers --- Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Change styling depending on var value

2009-11-20 Thread Phil Matt
Ashley Sheridan wrote: copy the results of this: vardump($row); Sirloin Steak freshAcmemeat Chicken Breast frozen Acmemeat Decaf Columbianpantry Giant coffee Ice Cream frozen Giant dessert All looks as expected. NB: This is just

Re: [PHP] Change styling depending on var value

2009-11-20 Thread Phil Matt
Ashley Sheridan wrote: That's not a vardump, a vardump would contain the type of variable. I wanted to see the whole thing. I played with this for a while and checked the PHP manual; not sure how to use this. Cheers --- Phil -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Change styling depending on var value

2009-11-20 Thread Phil Matt
Ashley Sheridan wrote: As Mike pointed out, I meant var_dump(), sorry! Is the idea to put the variable in question within the parentheses? I tried the statement, var_dump($row[3]; And I got in the output: NULL Also tried var_dump(); And I got in the output: Warning: Wrong parameter

Re: [PHP] Change styling depending on var value

2009-11-20 Thread Phil Matt
Ashley Sheridan wrote: put var_dump($row); I inserted this line in the script at the end of the html table, still inside the PHP echo statement. This yields: bool(false) Cheers --- Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Problem with header

2004-03-24 Thread Phil Matt
the other statement go? header(Location:error.shtml); TIA for any advice you can offer. I must be really missing the point here. Cheers --- Phil Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php