Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
psychotomus
Forum Contributor
Posts: 487 Joined: Fri Jul 11, 2003 1:59 am
Post
by psychotomus » Mon May 30, 2005 7:08 pm
Code: Select all
$sql = mysql_query("SELECT id, url, title, descriptionFROM {$prefix}pages WHERE category = $c AND accepted = 'y' AND subtype != '4' ORDER BY title LIMIT ".($s-1).",$n");
whats wrong with this. It will work fine without subtype != '4'. should it be <> instead or NOT or what?
Jcart | Please use Code: Select all
tags when posting php code. Review [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Burrito
Spockulator
Posts: 4715 Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah
Post
by Burrito » Mon May 30, 2005 7:37 pm
did you try it?
it should be "<>", but you gotta try it to know
psychotomus
Forum Contributor
Posts: 487 Joined: Fri Jul 11, 2003 1:59 am
Post
by psychotomus » Mon May 30, 2005 8:17 pm
neither work but i did an alternative way.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Mon May 30, 2005 8:49 pm
heres a list of
symbols
specifically
!= (not equal), Comparison Functions and Operators
Perhaps show us your table structure? I don't see anything obvious why it wouldn't work.. but I might just have missed it.
Ambush Commander
DevNet Master
Posts: 3698 Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US
Post
by Ambush Commander » Mon May 30, 2005 9:46 pm
Code: Select all
$var = (0 !== false)
//true
$var = (0 != false)
//false
EDIT- Err... maybe that's not what he meant.
patrikG
DevNet Master
Posts: 4235 Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK
Post
by patrikG » Tue May 31, 2005 1:53 am
remove the curly brackets in your SQL statement. If you want to insert variable values, a clean way would be:
Code: Select all
"SELECT me FROM thousands WHERE ".$i."<>'you'";