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,
Larry BiedermanSoftware EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
Yes, that is correct.  http://php.net/manual/en/function.mysql-pconnect.php  Except that it is not your program version but your code that is out of date.  And you can not simply replace the PHP code because the newer version, mysqli or PDO, requires a little different syntax and functions.
Dave BaldwinFixer of ProblemsCommented:
Every function that starts with 'mysql_' must be changed.  Fortunately, there are not really a lot of them in those files.  Also, 'get_magic_quotes_gpc' might fool you because since PHP 5.4, it always returns false because 'magic_quotes_gpc' were removed with PHP 5.4.
Ray PaseurCommented:
It's a frequent question, hence this article that explains the situation and the way forward.

BTW, there is almost never a need for pconnect() functions in PHP scripts.  The environment is usually set up and taken down for each web page request.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Larry BiedermanSoftware EngineerAuthor Commented:
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?

# 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!
Dave BaldwinFixer of ProblemsCommented:
You probably need to use a different editor.  Your versions of PHP and MySQL are pretty current but Dreamweaver is not generating compatible code.  Most PHP programmers do not use Dreamweaver because the code it generates is not what they need.  Most used a colorized code / text editor.
Ray PaseurCommented:
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 BiedermanSoftware EngineerAuthor Commented:
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,
Dave BaldwinFixer of ProblemsCommented:
Since I believe we're the top (by points) PHP experts here...  we'd recommend PHP.  And MySQL.  But the only thing you should use Dreamweaver for is the text and graphic display layout.  When you start programming in PHP, I suggest you close Dreamweaver and use a code editor like Notepad++ http://notepad-plus-plus.org/ , HTML-Kit http://www.chami.com/ , PSPad http://www.pspad.com/ , or any of a dozen other non-WYSIWYG programs.  Bluefish http://bluefish.openoffice.nl/index.html is available on all platforms.

I spend most days editing my main customer's site that he and his crew have 'designed' in Dreamweaver.  While they have good graphic and color sense, they are not good technically, not even with HTML.  In addition to doing the PHP programming, I also clean up their layout code because they do almost everything from 'design' view and never seen their technical problems.   I use HTML-Kit for programming and page layout and PSPad for a variety of odd tasks including creating new SQL inserts for their databases.  They rely extensively on me to take care of things and I have never owned a copy of Dreamweaver.  I did show one client how to use 'code' mode in his copy one day.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Larry BiedermanSoftware EngineerAuthor Commented:
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 BiedermanSoftware EngineerAuthor Commented:
Still can't make it work.
Any help with converting my syntax?
-Thanks, Larry
Ray PaseurCommented:
"Converting syntax" is a professional job -- one that would be paid.  There are many of us here at E-E with "hire me" buttons in our profiles.  I'll sign off on this question now, but with a gentle recommendation that you might consider.  Learn about Laravel.  It's really head-and-shoulders above working with the native PHP language, and once you understand the framework, you will never go back.  It will take a month or so to get deep enough into Laravel to appreciate its amazing power.  Trust me -- it will be a month well-invested!
Larry BiedermanSoftware EngineerAuthor Commented:
OK thanks for lots of good advise.  I'll look elsewhere for the solution to the actual question.

Larry BiedermanSoftware EngineerAuthor Commented:
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.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.