This is a dumb question. I just want to grab what is in the ATV field, but it what I have doesn’t grab the ATV field ?
$query = “SELECT * ALL_ITEMS.ATV”;
$result = mysql_query($query)
or die (“Couldn’t execute query.”);
This is a dumb question. I just want to grab what is in the ATV field, but it what I have doesn’t grab the ATV field ?
$query = “SELECT * ALL_ITEMS.ATV”;
$result = mysql_query($query)
or die (“Couldn’t execute query.”);
SELECT ROW NAME WHERE DEFINE QUERY
In my case
Select ATV where *this is my problem I just want everything in ATV *
SELECT ROW NAME WHERE DEFINE QUERY
SELECT * FROM ATV
simple, just dont define it
What your saying makes sense but for some reason it isn’t working so I tried this for fun and it works.
$query = “SELECT * FROM ALL_ITEMS where ID=‘2’”;
$result = mysql_query($query)
or die (“Couldn’t execute query.”);
If I understand you correctly the ATV is a field in a record and the table name is ALL_ITEMS
As Miles said you need to select the fields from the table
SELECT field names seperated by a comma or just use * to get ALL fields
FROM table name(s)
WHERE any conditions that you want to imply
The BOLDED information is REQUIRED. The Blue Italics is specific info that you need to provide about your table and fields.
So in your case, you could use
SELECT ATV FROM ALL_ITEMS
The above would give you all ATV’s from the table ALL_ITEMS without discrimination.
Using your ID you might want to limit it to a specific ID like
SELECT ATV FROM ALL_ITEMS WHERE ID = '2'
or a range of ID’s
SELECT ATV FROM ALL_ITEMS WHERE ID < 10
Depending on how your ID field is, you may or may not be required to quote it. If it’s typed as a numerical field (INT, FLOAT, etc…) you won’t need to. (but can if you wish)
I hope this helps.
Peg110
The SELECT ATV FROM ALL_ITEMS should work but for some reason it doesn’t it , it takes out everything in my database all rows I should say but doesn’t populate anything like the pics, description, id nothing ?
Your original question led me to believe that you only wanted the ATV field and nothing more. If you want more then you need to add the additional fields to the select statement.
SELECT field1, field2, field3, etc....
FROM table
WHERE condtions
if you want ALL fileds in the table then you can use the wild card * to select ALL fields.
SELECT * FROM table WHERE condtions
you will then need to use a fetch command such as mysql_fetch_array() to get the data and parse it further.
I suggest that you get a basic book on SQL and it’s syntax. It will help you immensely.
This my last question for this, can you not query a field in MySql without having a Where clause ?
To answer your question, NO you don’t need a WHERE clause. That just makes it so you get ALL records (records not to be confused with fields).