Seems more than necessary, however Im using a variable from the URL.
I have these two fields in my database - id/pageid
On the webpage I use php explode to get $line which is a number in the URL and identical to a pageid that might exist
basically i need to query or search for 'id' which exists in the same row as 'pageid'
If this is true and id exists I go ahead and output that row...
If no 'id' is found then do the else statement. Which is a basic set of records showing no data exists and the user can input data to the pageid.
I just might have the order backwards...
$query = "SELECT * FROM upload WHERE pageid LIKE $line";
I've tried...
if(isset($id)) { ...
if ($id) { ...
...
$query = "SELECT FROM upload WHERE pageid LIKE '$line' LIMIT 0, 5";
} else {
$query = "SELECT FROM upload WHERE pageid LIKE '9999' LIMIT 1";
}
example:
when the url has $line thats (4545) :
I look into the table for exact same $pageid (4545)
When its true I want to output that row of data
When its false i want to output a default $pageid (9999)
Right now, by switching around the queries I get upsidedown results...
if the url is true to the database I can output the correct data. But then on another URL page when its false, nothing outputs at all. Switch the queries and when the URL is true nothing outputs, but when its false the default data outputs.
Im so confused