Jump to content

[SOLVED] Problem with IF STATEMENT


gc40

Recommended Posts

I am trying to access a database table field called "Category" from a database named 1.

 

The output of everything else works great, however, I am trying to get an if statement working on the data that is output.

 

Category has a numeric value of 1-3.

 

 			if ($row->Category == '1')
			{
				echo ("Products");
			}
		else if ($row->Catgeory == '2')
			{
			echo ("World");
			}
		else if ($row->Catgeory == '3')
		{
			echo ("lol");
		}

 

Can someone tell me what I am doing wrong?

If Category field value = 1, then output Products, if the category field in the database has a value of 2, then output world, etc etc.

Link to comment
https://forums.phpfreaks.com/topic/65934-solved-problem-with-if-statement/
Share on other sites

It is Category. I am using the output for other database fields. All outputs work fine, its just the Category field.

 

If I type:

echo ("</td>"."<td>".$row->Title."</td>"."<td>".$row->Category."</td>");

and the Category for that "id" number is equal to 3, then 3 would be output as plain text. However, I want to do an array of some sort or an if statement.

stdClass Object
(
    [id] => 1
    [Meta_Description] => meta describtion about cbfi
    [Meta_Keywords] => Keywords,lol,haha,rolled,pwned, haha
    [Title] => CBFI Title
    [subTitle] => Subtitle
    [Content] => Lorem
    [Theme_Image] => 0
    [Category] => 2
)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.