![]() |
Weird error with query
Hi there.
I do not understand it. I get no output from this query: $id_bruger=$_SESSION['id_bruger']; $query=mysql_query("select distinct b_spil.titel as titel,b_spil.id as id from b_spil,f_spil where f_spil.id_bruger='$id_bruger' && f_spil.id_spil=b_spil.id"); while($result=mysql_fetch_array($query)){ echo ' <a href="index.php?mode=mine_spil&action=vis_spil&spi l='.$result["id"].'" class="undermenupunkt">'; echo $result["titel"]; |
Have you run that query against a database (and I mean manually)? If so, what does it say/do?
|
Have you tried putting a mysql error function at the end
PHP Code:
Plus i don't know if you can use && in mysql queries iv never done it that way, but usually its PHP Code:
|
Well spoted, Rendair! I usually have a problem reading code floating around, and I don't even bother reading further :-P That's his problem, I believe (I know for sure that && is not valid in MySQL).
|
&& is valid SQL - it's just the normal logical AND operator :-)
MySQL AB :: MySQL 5.0 Reference Manual :: 10.2.4 Logical Operators |
Ah well you learn something new everyday :-P
|
Quote:
AND and && are perfectly valid -- as they are with PHP too.As said before, if we could get a reply stating what the error is that MySQL is saying, that would help us to help you. :-) Edit: Thanks for providing a link Alan. I'm so slow in replying to topics :-( |
Oh, so && works in SQL, too. I supposed it didn't because I've never seen a SQL statement to contain it. I will never make assumptions again. Stupid me.
|
Thx a lot guys! it really helped me out.
|
| All times are GMT. The time now is 12:12 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0