Jump to content

I need to combine 2 queries


thecard

Recommended Posts

I have 2 queries, I wrote one of them, and found the other on the internet as I find it preety confusing!

I need to make them cause and effect:

The first:

$dothis = mysql_query("SELECT * FROM tb_users tb WHERE EXISTS(SELECT tb2.ip FROM tb_users tb2 WHERE tb.ip=tb2.ip AND tb.username<>tb2.username) order by ip") or die (mysql_error());

The second:

$thisagain= mysql_query("UPDATE tb_users SET suspen='logged'") or die (mysql_error());

So basically if there is a duplicated ip of a users, I need all their account's "suspens" to be logged.

Sorry, I'm a bit of a noob.

I've tried changing select to UPDATE and loads of other stuff.

Link to comment
https://forums.phpfreaks.com/topic/109053-i-need-to-combine-2-queries/
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.