Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
ddragas
Forum Contributor
Posts: 445 Joined: Sun Apr 18, 2004 4:01 pm
Post
by ddragas » Tue Feb 07, 2006 3:40 pm
Why doesn't this work?
Code: Select all
$result = mysql_query("select Sifra_apartmana from apartmani
where apartmani.iznajmljivac = '$broj'
and Sifra_apartmana NOT in
(
select smjestaj from banner
where ((prikazivati_do <= '$danas') or
(banner.prikazivati >= banner.prikazano))
)
order by apartmani.vrsta_smjestaja ") or die (mysql_error());
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Tue Feb 07, 2006 3:52 pm
Moved from PHP Code to Databases...
What error do you get? Does your version of MySQL support subqueries?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
ddragas
Forum Contributor
Posts: 445 Joined: Sun Apr 18, 2004 4:01 pm
Post
by ddragas » Tue Feb 07, 2006 3:58 pm
pickle wrote: Moved from PHP Code to Databases...
What error do you get? Does your version of MySQL support subqueries?
right now I've been reading topic that asked the same question
MySQL Servers and Clients 3.23.47
ddragas
Forum Contributor
Posts: 445 Joined: Sun Apr 18, 2004 4:01 pm
Post
by ddragas » Tue Feb 07, 2006 4:01 pm
error is
Code: Select all
You have an error in your SQL syntax near 'select smjestaj from banner where ((prikazivati_do <= '1139349957') or ' at line 5
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Feb 07, 2006 4:06 pm
Subqueries were added in 4.1 I believe.. so you can't use them.
ddragas
Forum Contributor
Posts: 445 Joined: Sun Apr 18, 2004 4:01 pm
Post
by ddragas » Tue Feb 07, 2006 4:07 pm
I've also found answer on some post.
Thank you both for reply
Weirdan
Moderator
Posts: 5978 Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine
Post
by Weirdan » Tue Feb 07, 2006 4:10 pm
Depending on the mysql version, it could be that subqueries were not supported...