Avatar of Larry Biederman
Larry Biederman
Flag for United States of America asked on

What is replacement syntax for: "Deprecated: mysql_pconnect(): The mysql extension is deprecated"

Hi Experts,
I am new to php and mySQL.

I am using Dreamweaver CS6 with Apache/2.4.9 (Win64) PHP/5.5.12 and MySQL  5.6.17.
When I run the webpage I receive this error:
"Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\holland2\Connections\holland.php on line 9".

It seems mysql_pconnect() needs to be replaced with mysqli or PDO syntax after php 5.0.
The syntax needs to be replaced in 2-3 lines in index.php and holland.php.
Apparently my versions of php and mySQL are mismatched.

Both files are attached, as well as the screen with the error.
Can you please show me the full replacement lines of code?

Thanks so much,
Lbiederman
Lbiederman-php-error.zip
PHPMySQL Server

Avatar of undefined
Last Comment
Larry Biederman

8/22/2022 - Mon
SOLUTION
Dave Baldwin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Dave Baldwin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Ray Paseur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Larry Biederman

ASKER
Thank you both for replying. However, I have read many such articles, but, being new to php, am still clueless as to what the EXACT..... syntax should be.

Here is the 'bad' code in holland.php.  Can you re-write it?

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_holland = "localhost";
$database_holland = "holland";
$username_holland = "root";
$password_holland = "";
$holland = mysql_pconnect($hostname_holland, $username_holland, $password_holland) or trigger_error(mysql_error(),E_USER_ERROR);
?>

Can you do same for index.php?

NOTE:  I didn't manually write code.  Ir was generated by Dreamweaver CS6 when I created a recordset.
Should I be using a different version of either MySQL or php so compatible code is auto generated?

Again, Thanks much!
-Larry
SOLUTION
Dave Baldwin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Ray Paseur

what the EXACT..... syntax should be...
The exact syntax is given in the article.  Exact!  You can copy and install the code snippets from the article and run them on your own server.  Suggest you put aside pconnect() functions - we don't do that in PHP scripts that generate web pages.

Good text editors (Google 'em) include Textpad, Textmate, Textwrangler, Sublime, Notepad++.  Your best choice will depend on your workstation operating system and your work flow.  I agree with Dave - get rid of Dreamweaver.  It generates some of the most incomprehensibly bad PHP code I've ever seen.
Larry Biederman

ASKER
Dear Experts,
Sorry for delayed response, I have been ill past week.  Back at it now!

Ray, I will look at the syntax in article - thanks!

Ray & Dave,
I'm a very experienced VB6, and .net programmer (also Access, MsSQL, MySQL databases),
but obviously new at php and only basic web sites.

I need to write a web app involving databases. A moderate sized project over next 6 months.
What language and app would you suggest learning/using?

After this, will award all points.
Thanks much,
Larry
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
Dave Baldwin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Larry Biederman

ASKER
Fellows,
I have downloaded notepad++.
Thanks for all the advice.  I am going through the lynda.com training now.
I have VS.net 2013 and the current Infragistics addon objects for ASP,
If php is that much better, will pursue it.

Ray, after reading your articles, I am still not able to replace the syntax.
Again, can you rewrite the small code block with new syntax, or is that too much work?

Still can't make this work.
Thanks much, Larry
Larry Biederman

ASKER
Still can't make it work.
Any help with converting my syntax?
-Thanks, Larry
SOLUTION
Ray Paseur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Larry Biederman

ASKER
OK thanks for lots of good advise.  I'll look elsewhere for the solution to the actual question.

-Larry
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Larry Biederman

ASKER
Hi Moderator - Please change the points to 200 for Ray and 300 for Dave, and grade to B.
Although I did NOT get an answer to the question, I did receive much great info.

-Larry