PHP code not working!

  Charence 20:45 14 Jan 05
Locked

I've been trying to setup a sql query by using the address bar as well.

Here's the query: "SELECT * FROM Meal WHERE MealTypeID=".$MealTypeID;

which works when values of 3-16 are entered in the address bar, but when 1 and 2 are entered 1 displays all records, 2 displays no records. I have checked the database and it does not have problems.

When MealTypeID=1, MealID 1-7 should be displayed.

When MealTypeID=2, MealID 8-15 should be displayed.

Why aren't values 1 and 2 working?

Thank you,

Charence

  Charence 21:20 14 Jan 05

click here should just bring up Omelette Dishes

click here should just bring up Chop Suey Dishes

click here should just bring up Curry Dishes

To view all dishes click here

  Talented Monkey 22:23 14 Jan 05

Ok am i missing somthign here, or have you sorted the problem? the links you posted certainly bring up the correct listings you wanted.

maybe your browser cache needs emptying or page refresh .

  Charence 22:26 14 Jan 05

Not sorted yet.

Even the first link? When I click it, there are 153 meals. There should just be 7. What displays on yours?

Charence

  Charence 22:29 14 Jan 05

ahh that's what it was...thanks Talented Monkey!!

Also before I tick this, does anyone have any good links to PHP code?

And are there any other sorting features you think should be included? e.g. Price? Searching?

Charence

  Charence 22:31 14 Jan 05

Another question, is it possible to make it display all records?

Thanks, Charence

  Taran 00:01 15 Jan 05

SELECT * FROM tablename will display all records.

Basic PHP links:

click here

click here

click here

click here

All sorts of everything in PHP:

click here

click here

And my own personal favourite overall has to be the superb PHP Freaks web site:

click here

  Charence 13:06 15 Jan 05

Sorry, I didn't mean display all links using that query. Because for the page I've already written the query "SELECT * FROM Meal WHERE MealTypeID=".$MealTypeID; , I was wondering whether I could make this particular query display everything or is it not possible? Would I have to create another page with a different query?

Charence

This thread is now locked and can not be replied to.

How to get Windows 10 for free | How to install Windows 10: There is still a way to avoid paying…

1995-2015: How technology has changed the world in 20 years

Alex Chinneck’s giant ice cube Christmas tree at Kings Cross

Apple rumours & predictions 2017: The iPhone 8, new iPads, and everything else you should expect fr7…