0

I Need to select a specific row from a MySQLi database based off of a value in it.

For example I have a Table with a column named "house", and under that column there are maybe 5 rows with the title "house1" and three rows with the title "house2". I only want to select the rows that have "house1" in them.

This is my code

$query = "SELECT * FROM Hockey WHERE house = house1 ORDER BY attendance desc";

I then want it to make a table with only values from a row if the house is Jacksons

right now if I delete the WHERE part from my query it will make a table but it will have rows from both houses (Jacksons and Martlands)

Thanks!

1
  • 3
    Syntax is correct, just enclose house1 within single-quote commas. I don't see what the question is here, you have answered it yourself. Commented May 19, 2013 at 22:09

1 Answer 1

4
$query = "SELECT * FROM Hockey WHERE house = 'house1' ORDER BY attendance desc";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.