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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:29:54+00:00 2026-06-06T07:29:54+00:00

I am having a difficult time sorting through this PHP/MySQL issue. Let me show

  • 0

I am having a difficult time sorting through this PHP/MySQL issue. Let me show you my database, and explain my situation:


Create table:

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(50) NOT NULL AUTO_INCREMENT,
  `active` varchar(20) NOT NULL,
  `activation` varchar(15) NOT NULL,
  `firstName` longtext NOT NULL,
  `lastName` longtext NOT NULL,
  `passWord` longtext NOT NULL,
  `changePassword` text NOT NULL,
  `emailAddress1` longtext NOT NULL,
  `emailAddress2` longtext NOT NULL,
  `emailAddress3` longtext NOT NULL,
  `role` longtext NOT NULL,
  PRIMARY KEY (`id`),
  FULLTEXT KEY `name` (`firstName`,`lastName`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 ;

Insert a value:

INSERT INTO `users` (
  `id` ,
  `active` ,
  `activation` ,
  `firstName` ,
  `lastName` ,
  `passWord` ,
  `changePassword` ,
  `emailAddress1` ,
  `emailAddress2` ,
  `emailAddress3` ,
  `role`
) VALUES (
  NULL,  '1000000000',  'abcdefghijklmno',  'John',  'Smith',  '*24D7FB97963C40FE5C56A6672F9560FC8B681508',  'on',  'john@gmail.com',  '',  '',  'User'
);

Update a value:

$affected = mysql_query(UPDATE users SET passWord = PASSWORD('a9eb42e1b3be829ef42972ea9abab334'), changePassword = 'on' WHERE emailAddress1 = 'john@gmail.com', $dbID); 

if (mysql_affected_rows($affected)) {
    //Never runs
}

The above UPDATE query executes just fine in my script, phpMyAdmin, and the MySQL terminal. However, mysql_affected_rows($affected) always gives me this error:

Warning: mysql_affected_rows() expects parameter 1 to be resource, boolean given

I know that this means my query failed, but every time I go into the database, I see that the values have been updated.

Removing the parameter from the function appears to clear things up. However, I rather have the identifier as the function parameter, just to be sure what I am referring to, and for code insurance.

Any idea why this might be doing this?

Thank you for your time.

  • 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-06T07:29:56+00:00Added an answer on June 6, 2026 at 7:29 am

    http://php.net/mysql_query

    Return Values

    …

    For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.

    And:

    int mysql_affected_rows ([ resource $link_identifier = NULL ] )

    This means mysql_affected_rows wants a mysql connection resource as an argument. Not the result of mysql_query, and most certainly not if that result is only true or false. You use it like this:

    $successful = mysql_query('UPDATE ...'); 
    
    if ($successful) {
        echo 'Affected rows: ' . mysql_affected_rows();
    } else {
        echo 'Fail: ' . mysql_error();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a difficult time sorting a char field in MySQL. The problem is
Hey all, I'm having a difficult time wording this properly which is why im
I'm having a really difficult time trying to get php to connect to SQL
I'm having a really difficult time debugging this problem. Whenever I try to establish
I'm having a difficult time understanding how to do this. I have two models,
I'm having a difficult time understanding how to get Rails to show an explicit
I'm having a difficult time expressing this problem, so bear with me and please
I am having a difficult time matching up curly brackets in this code. It
I'm having a difficult time thinking in Prolog. What is incorrect about this statement:
Hey All I'm having a difficult time with a database design. As you can

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.