Jump to content


Mysql Query


2 replies to this topic

#1 meadow

    Young Padawan

  • Members
  • Pip
  • 224 posts
  • Location:Devon, England
  • Interests:Php, Hockey, mysql, web design.

Posted 26 August 2006 - 04:52 AM

Is there a command in mysql which you can use to select rows from a database where a query is negative, for example, in php, you might write:
if(!$something="1"){
Is it possible to put tht into a query like this:
mysql_query("SELECT * FROM table WHERE something (DOES NOT)="1"");
The text in brackets where I am unsure, and I have already tried out the above code but it doesn't work.
Thanks.

Edited by meadow, 26 August 2006 - 04:53 AM.


#2 Mr. Matt

    Moderator

  • P2L Staff
  • PipPipPipPip
  • 1,945 posts
  • Gender:Not Telling

Posted 26 August 2006 - 05:01 AM

well if your first part is meant to say if $somthing isn't equal to 1, it needs to be:

if ($somthing != 1) {

and its the same with the query:

mysql_query("SELECT * FROM `table` WHERE `something` != '1'");

Matt

#3 meadow

    Young Padawan

  • Members
  • Pip
  • 224 posts
  • Location:Devon, England
  • Interests:Php, Hockey, mysql, web design.

Posted 26 August 2006 - 06:07 AM

Thankyou very much, that's worked perfectly.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users