Link to home
Start Free TrialLog in
Avatar of Larry Biederman
Larry BiedermanFlag 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
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Still can't make it work.
Any help with converting my syntax?
-Thanks, Larry
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK thanks for lots of good advise.  I'll look elsewhere for the solution to the actual question.

-Larry
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