• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

DW MX 04 LOGIN FORM...

New Here ,
Dec 07, 2017 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

Views

385

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
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 07, 2017 Dec 07, 2017

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

Votes

Translate

Translate
LEGEND ,
Dec 07, 2017 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?

Votes

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
community guidelines
New Here ,
Dec 07, 2017 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.

Votes

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
community guidelines
LEGEND ,
Dec 07, 2017 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.

Votes

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
community guidelines
Community Expert ,
Dec 07, 2017 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— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

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
community guidelines
New Here ,
Dec 07, 2017 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?

Votes

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
community guidelines
Community Expert ,
Dec 07, 2017 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— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

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
community guidelines
Community Expert ,
Dec 07, 2017 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— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

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
community guidelines
New Here ,
Dec 07, 2017 Dec 07, 2017

Copy link to clipboard

Copied

LATEST

Both sites are on the same server.

Votes

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
community guidelines