Jump to content

Query Problem


Rommeo

Recommended Posts

For the website I  m working on

 

one table is like :

table_user

usernaname | shoppingbox

rommeo  | 1 3 5 19 36 89...94 105 1002

julliet | 3 5 6 8 9 10

rome | 8 9 10

 

I want to list the users whose shoppingbox does not contain "1", I m stuck about the query since it does not contain just one value.

$boxitem = 1;

$query = "SELECT * FROM table_user WHERE shoppingbox != $boxitem";

 

This query would not work I guess,

 

( I m aware of the problem about the design of the table, But I must use this way )

Link to comment
Share on other sites

Hi Rommeo,

you can try this

$boxitem = 1;
$query = "SELECT * FROM table_user WHERE  shoppingbox REGEXP '^$boxitem | $boxitem$| $boxitem ' OR shoppingbox =$boxitem";

Hey,

I think it s the correct code and works well, but it gives me the result of datas where shoppingbox contains $boxitem, I want the results of datas where shoppingbox does NOT contain boxitem

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.