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 7631389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:20:29+00:00 2026-05-31T06:20:29+00:00

I have a strange mysql-thing going on here, it is about the following code:

  • 0

I have a strange mysql-thing going on here, it is about the following code:

$res = mysql_query("SELECT * FROM users WHERE group='".$group."'");
if (mysql_num_rows($res)==1) {

$row = mysql_fetch_assoc($res); 
$uid = $row['uid'];

$user_update = mysql_query("UPDATE fe_users SET group = 5 WHERE  group='".$group."'");           

return 'ok';

} else {

return 'not ok';

}   

I am checking, if there is a user with the group = $group. If so, the group is updated to 5 and after that the string “ok” is returned, if no user with group=$group exists, as you can see the string “not ok” is returned.

This should be very easy, but the problem now is, that if there is a user with group=$group, the update is done correctly, but instead of returning “ok”, php returns “not ok”, as if the change from the update is been taken into account for the above executed select retroactively. I dont understand this. Any help would be really appreciated.

Thanx in advance,
Jayden

  • 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-05-31T06:20:30+00:00Added an answer on May 31, 2026 at 6:20 am

    I think ‘group’ is a reserved keyword that you have used as a field name, change it or use like

    $res = mysql_query("SELECT * FROM users WHERE `group`='".$group."'");
    

    and

    $user_update = mysql_query("UPDATE fe_users SET `group` = 5 WHERE  `group`='".$group."'");
    

    and you can use count($res)==1 instead of mysql_num_rows($res)==1 if it is a problem.

    Reference: Mysql Reserved keywords.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using MySQL and Java to SELECT about 50000 records. The strange thing
I have a strange issue (at least for me :)) with the MySQL's locking
Strange Issue. I have the some code that queries a database and prases the
I am having a strange problem with MySQL Stored Procedure. I have written a
I have a strange problem in php MySQL: php connects with 127.0.0.1 but not
I have a strange error with Hibernate3 here: Got a SoftwareDescription class, persisting it
Very strange things happening in phpMyAdmin (mySQL).... The Situation: I have a table with
I have this piece of php - mysql code: When a user tagged in
I have a strange problem...I have a MySql db with some columns and one
I have strange problem with sharepoint and ajax functionality. We have an UpdatePanel placed

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.