Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7932151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:55:53+00:00 2026-06-03T20:55:53+00:00

So i wanna pairing users only in PHP: First, get one avaliable user id

  • 0

So i wanna pairing users only in PHP:

First, get one avaliable user id //right now not random

mysql_query('SELECT id FROM users WHERE state="0" LIMIT 1'); //state 0 = user avaliable, 1 = talking/playing with someone

$available_id = stuffs to get id from query

And then update:

$result = mysql_query('UPDATE INTO users SET state="1" WHERE (id=$available_id OR id=$my_id) AND state="0"');

if $result == false then it mean that no one row has updated. So back to First step,
if $result == true then what? it can mean that my row has updated or available user, or both. I am confused how to done with it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:55:54+00:00Added an answer on June 3, 2026 at 8:55 pm

    Try this code

    $first=mysql_query('select id from users where state =0 limit 1');
    
    $available=mysql_fetch_row($first);
    $available_id=$available['id'];
    
    $result = mysql_query('UPDATE INTO users SET state="1" WHERE
    (id=$available_id OR id=$my_id) AND state="0"');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanna create android animation like shown on this example. Only one change I
I wanna write <Message Text=Line1\nLine2\nLine3 /> but \n seems not to be working. What
i wanna using curl in php script and run it in command line mode.
I wanna know if it's possible to call php api like in extjs 3.x.x.
I wanna know is this possible I pass get parameters for a javascript file
I wanna get the Timedate value from another page using request.querystring and then use
I wanna make a text editor but its different other text editors.It will get
I wanna check radio buttons automatically: I tried this code but it does not
I wanna integrate Facebook's new Graphs API with my CakePHP application. Can some one
I wanna do something like this: <?php $editor = new editor('reply.php?topic=100', 'simple'); echo $editor;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.