| | #1 |
| HyperActive Warrior Registered Member War Room Member Join Date: 2013 Location: Cardiff, UK
Posts: 357
Thanks: 16
Thanked 15 Times in 12 Posts
|
mysql_connect ("localhost", "nathan_userblog", ""); I've removed the password, but I get an error saying its depricated. It reads below - Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home1/nathan/public_html/Blog.php on line 2 How to I correct this? |
| |
| | #2 |
| Banned Join Date: 2010
Posts: 22,774
Thanks: 2,708
Thanked 11,312 Times in 7,455 Posts
|
Try mysqli_connect |
| |
| | #3 |
| HyperActive Warrior Registered Member War Room Member Join Date: 2013 Location: Cardiff, UK
Posts: 357
Thanks: 16
Thanked 15 Times in 12 Posts
|
would I have to insert the i ever time I mention mysql?
|
| |
| | #4 |
| HyperActive Warrior Registered Member War Room Member Join Date: 2013 Location: Cardiff, UK
Posts: 357
Thanks: 16
Thanked 15 Times in 12 Posts
|
Its made no different, still shows an error. Any other ideas? |
| |
| | #5 |
| HyperActive Warrior Registered Member War Room Member Join Date: 2013 Location: Cardiff, UK
Posts: 357
Thanks: 16
Thanked 15 Times in 12 Posts
|
Getting these errors now - Warning: mysqli_query() expects at least 2 parameters, 1 given in /home1/nathan/public_html/Blog.php on line 50 Line 50 - $sql = mysqli_query("SELECT * FROM blog1data ORDER BY id DESC"); Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home1/nathan/public_html/Blog.php on line 51 Line 51 - while ($row = mysqli_fetch_array ($mysqli_result, $sql)){ |
| |
| | #6 |
| VIP Warrior War Room Member Join Date: 2007 Location: Caldwell, Idaho, USA.
Posts: 1,967
Thanks: 1,024
Thanked 2,043 Times in 1,183 Posts
|
See this page to learn how to use PHP mysqli library: PHP mysqli_fetch_array() Function Your questions are answered there, just have a look at the code and compare it to what you're doing. |
|
The 2nd Amendment, 1789 - The Original Homeland Security. Gun control means never having to say, "I missed you." | |
| |
| | #7 |
| Warrior Member Join Date: 2016
Posts: 10
Thanks: 0
Thanked 2 Times in 2 Posts
|
To show no errors or warnings type PHP Code: Code: Warning: mysqli_query() expects at least 2 parameters, 1 given in /home1/nathan/public_html/Blog.php on line 50 Fix for line 50: PHP Code: PHP Code: PHP Code: |
|
Every journey begins with a small step.
Last edited on 28th Jun 2016 at 06:39 AM. Reason: Buggy forum software | |
| |
| | #8 | |
| HyperActive Warrior Registered Member War Room Member Join Date: 2013 Location: Cardiff, UK
Posts: 357
Thanks: 16
Thanked 15 Times in 12 Posts
|
Im totally confused. | |
| |
| | #9 | |
| HyperActive Warrior Registered Member War Room Member Join Date: 2013 Location: Cardiff, UK
Posts: 357
Thanks: 16
Thanked 15 Times in 12 Posts
|
| |
| |
| | #10 |
| Active Warrior Join Date: 2014
Posts: 84
Thanks: 5
Thanked 11 Times in 10 Posts
|
Just turn off error reporting, "deprecated" isn't an error itself. Did that code ever worked if so when did it stop? Maybe your problem is somewhere else . |
| |
| | #11 |
| HyperActive Warrior Join Date: 2010 Location: Newcastle, UK
Posts: 202
Thanks: 24
Thanked 16 Times in 16 Posts
|
Change the PHP ini file to only report errors and ignore warnings. If you want you can put @ in front of php commands like mysql connect to prevent it outputting those kind of warnings. |
| |
|
| Bookmarks |
| Tags |
| code, php, wrong |
| |