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
On Nov 20, 2009, at 2:29 PM, Ashley Sheridan wrote:
> On Fri, 2009-11-20 at 17:23 -0500, Phil Matt wrote:
>
>> 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
On Fri, 2009-11-20 at 17:23 -0500, Phil Matt wrote:
> 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
That means that
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
On Fri, 2009-11-20 at 17:08 -0500, Phil Matt wrote:
> 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:
>
>
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 co
On Fri, 2009-11-20 at 16:41 -0500, Phil Matt wrote:
> 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
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 unsubscribe
> -Original Message-
> From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
> Sent: 20 November 2009 21:16
> To: Phil Matt
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Change styling depending on var value
>
> On Fri, 2009-11-20 at 16:17 -0500, Phil M
On Fri, 2009-11-20 at 16:17 -0500, Phil Matt wrote:
> Ashley Sheridan wrote:
>
> > copy the results of this:
> >
> > vardump($row);
> >
> Sirloin SteakfreshAcmemeat
> Chicken Breast frozen Acmemeat
> Decaf Columbian pantry Giant coffee
> Ice
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 te
On Fri, 2009-11-20 at 15:52 -0500, Phil Matt wrote:
> 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
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.
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)
{
$newcol
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.
On Fri, Nov 20, 2009 at 3:16
On Fri, 2009-11-20 at 15:30 -0500, Phil Matt wrote:
> Ashley Sheridan wrote:
>
> > print $row[3];
> >
> > Does it contain a string like you expect?
> >
>
> Yes. I'm going to try the same kind of formatting on a different $row
> cell and see what happens.
>
> Cheers and thanks again --- Phil
On Fri, 2009-11-20 at 15:11 -0500, Phil Matt wrote:
> Ashley Sheridan wrote:
>
> > Well, you're main problem here is that you are only using a single =
> > character. What that is saying to PHP is: "if you let me assign the
> > value of $beverage to $row[3] then do this next bit", but what I th
On Fri, 2009-11-20 at 14:45 -0500, Phil Matt wrote:
> I am trying to style HTML table cells depending on the values stored in
> a MySQL db. Thanks to other on this list, I can now refer to the
> variable that holds a CSS styling value.
>
> Now, I need to apply different values of that variable,
I am trying to style HTML table cells depending on the values stored in
a MySQL db. Thanks to other on this list, I can now refer to the
variable that holds a CSS styling value.
Now, I need to apply different values of that variable, depending on the
content of the table cell itself.
I tried
19 matches
Mail list logo