|
Posted by Markus Ernst on 08/10/06 07:04
mpar612 schrieb:
>>>>>Now I am trying to retrieve the "isbn=987654321" using $_GET and I'm
>>>>>trying to make that a part of an SQL query using the following code and
>>>>>I constantly get a "DB Error:
>>>>>no such field." I could post more code if necessary, I was just trying
>>>>>to save space:
>>>>
>>>>"DB Error: no such field.", sound like you are trying to access a column that
>>>>isn't there, I do suggest you do echo out your SQL query before you do the
>>>>query, so that you can see that it's correct.
>>>>
>>>>
>>>> //Aho
>>>
>>>
>>>Thanks! I ran the SQL query in phpmyadmin and everything before the
>>>WHERE works. I also tried to print the $_GET['isbn'] and that worked.
>>>The two are not working together. Any ideas?
>>>
>>
>>Is isbn a numeric kind of MySQL field? Otherwise it is necessary to
>>quote the value: "WHERE isbn='$isbnget'" (which is a good idea anyway).
>>
>>If this does not solve your problem, you need more information. If you
>>use PEAR DB you can just add var_dump($rows) to get the PEAR error
>>message. If you don't find the error yourself, post complete error
>>messages here.
>>
>>HTH
>>Markus
>
>
> I am not familiar with var_dump, but I inserted var_dump($rows) into my
> code and this was returned: array(0) { }. I'm not sure what that
> means.
IF you use PEAR DB (please confirm that, so we know what we talk about),
this means that there is no error in that query, but there was no
matching row found in the database. If there was an error, $rows were a
PEAR error object rather than an empty array.
Next steps:
- What does var_dump($isbnget) print?
- Is there a record in the database with this same value in the $isbnget
field?
- What other queries do you run in the same script, that could cause the
error message? As J.O. Aho told you before - check the processed text of
each query by echoing it:
echo "SELECT isbn, artist_name, album_title,
date_format(release_date, \'%M %d, %Y\') as release_date,
date_format(add_date, \'%M %d, %Y\') as add_date, description, price
FROM lounge WHERE isbn=$isbnget";
So you see what is actually queried - you are likely to find the error
like this.
--
Markus
Navigation:
[Reply to this message]
|