Highlighted

DW MX 04 LOGIN FORM...

New Here ,
Dec 07, 2017

Copy link to clipboard

Copied

Have run into a problem in designing a login form.  A persistent error such as:

Warning: mysql_select_db() expects parameter 2 to be resource, null given in /home/ibtib/public_html/chsn/login2.php on line 19

Warning: mysql_query() expects parameter 2 to be resource, null given in /home/ibtib/public_html/chsn/login2.php on line 24

Am not able to resolve this.

Curt L. Gustafsson

Adobe Community Professional
Correct answer by Nancy OShea | Adobe Community Professional

CS6 is now almost 6 years old and still contains deprecated MySQL behaviors which should never be used on any project.

See link below.

Simple User Registration & Login Script in PHP and MySQLi | All PHP Tricks

Views

237

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

DW MX 04 LOGIN FORM...

New Here ,
Dec 07, 2017

Copy link to clipboard

Copied

Have run into a problem in designing a login form.  A persistent error such as:

Warning: mysql_select_db() expects parameter 2 to be resource, null given in /home/ibtib/public_html/chsn/login2.php on line 19

Warning: mysql_query() expects parameter 2 to be resource, null given in /home/ibtib/public_html/chsn/login2.php on line 24

Am not able to resolve this.

Curt L. Gustafsson

Adobe Community Professional
Correct answer by Nancy OShea | Adobe Community Professional

CS6 is now almost 6 years old and still contains deprecated MySQL behaviors which should never be used on any project.

See link below.

Simple User Registration & Login Script in PHP and MySQLi | All PHP Tricks

Views

238

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 07, 2017 0
LEGEND ,
Dec 07, 2017

Copy link to clipboard

Copied

One possibility is you could be trying to mix mysql, the old workflow with mysqli, the new workflow?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 07, 2017 0
New Here ,
Dec 07, 2017

Copy link to clipboard

Copied

First I only changed mysql_select to mysqli_select .  This does not result in any change.

Then I changed every instance of mysql to mysqli .

In each case the result is unchanged.  In other words: This does not result in either case does not fix the issue.

Warning: mysql_select_db() expects parameter 2 to be resource, null given in /home/ibtib/public_html/chsn/login2.phpon line 19

Warning: mysql_query() expects parameter 2 to be resource, null given in /home/ibtib/public_html/chsn/login2.php on line 24

Also, when I make the change in the code itself, adding the "i" to mysql = mysqli, the code changes from red to black, which probably means it is no longer active -- my hunch, only.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 07, 2017 0
LEGEND ,
Dec 07, 2017

Copy link to clipboard

Copied

curtgus  wrote

First I only changed mysql_select to mysqli_select .  This does not result in any change.


It doesnt work like that I'm afraid. mysqli has its only way of connecting and selecting.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 07, 2017 0
Adobe Community Professional ,
Dec 07, 2017

Copy link to clipboard

Copied

curtgus  wrote

First I only changed mysql_select to mysqli_select .  This does not result in any change.

Then I changed every instance of mysql to mysqli .

It does not work that way.  MySQLi is separate code from deprecated MySQL.

You cannot mix the 2 or use them interchangeably as you have here.

DW MX is too old to be of any value to modern PHP coders.

Nancy O'Shea, ACP

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 07, 2017 0
New Here ,
Dec 07, 2017

Copy link to clipboard

Copied

I have CS6 but have not made the change yet.

The strange thing is that I have another site which has the identical code.  It works just fine.  This might mean the issue is somewhere else but is affecting the lines referenced above.

Any suggestions for proceeding?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 07, 2017 0
Adobe Community Professional ,
Dec 07, 2017

Copy link to clipboard

Copied

CS6 is now almost 6 years old and still contains deprecated MySQL behaviors which should never be used on any project.

See link below.

Simple User Registration & Login Script in PHP and MySQLi | All PHP Tricks

Nancy O'Shea, ACP

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 07, 2017 1
Adobe Community Professional ,
Dec 07, 2017

Copy link to clipboard

Copied

curtgus  wrote

The strange thing is that I have another site which has the identical code.  It works just fine. 

The other site might be on an older PHP version.  If your server has PHP 7, the deprecated MySQL code won't work at all.  In some cases, servers with PHP 5.6 won't work either because error reporting is enabled.

The best overall solution is to use modern code and stay away from the deprecated server behaviors.

Nancy O'Shea, ACP

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 07, 2017 1
curtgus LATEST
New Here ,
Dec 07, 2017

Copy link to clipboard

Copied

Both sites are on the same server.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 07, 2017 0