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
https://forums.phpfreaks.com/topic/253691-query-problem/
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
https://forums.phpfreaks.com/topic/253691-query-problem/#findComment-1300813
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.