Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,199,990 members, 7,973,407 topics. Date: Saturday, 12 October 2024 at 04:06 PM |
Nairaland Forum / Science/Technology / Programming / Help Ugently Needed For My Msqli Error (1168 Views)
Website Showing Error 403 After Unzipping File To File Manager / Programmer Needed Ugently.... / Sql Error Msg 1801, Level 16 During Execution In Ssms (2) (3) (4)
Help Ugently Needed For My Msqli Error by dapaiks: 8:15pm On Jan 31, 2018 |
Good day house, i update my locallhost/wampserver, after importing my database into my phpadmin i tried login in buh i got this error "mysql depricated, use mysqli or pdo blablabla... in connection.php" This the code bello <?php session_start(); $hostname = "localhost"; $database = "db_crimemanager"; $username = "root"; $password = ""; $conn = mysql_connect($hostname, $username, $password) or die(mysql_error()); $db = mysql_select_db($database, $conn) or die(mysql_error()); if (!$db) { die("Unable to select database" } ?> Pls i need sme1 to help me out with this as soon as posible, thnkx |
Re: Help Ugently Needed For My Msqli Error by Luminee(f): 8:18pm On Jan 31, 2018 |
dapaiks: You need to write your codes in mysqli mysql is no more in use. Mysqli and PDO is the new normal. Read more on it. Mysql is no more secured from sql injection attack, that's the reason for having to upgrade to mysqli. |
Re: Help Ugently Needed For My Msqli Error by dapaiks: 8:41pm On Jan 31, 2018 |
Luminee:I will definately read abt it, buh ryt nw i dnt hv tym on my side, i jst need a way to handle this situation like imediately. |
Re: Help Ugently Needed For My Msqli Error by Hostermipo(m): 9:04pm On Jan 31, 2018 |
dapaiks:use it this way but you will still have to change all your MySQL to MySQLi in all your codes. MySQL is outdated. <?php //Connect to database $db_connect = mysqli_connect("localhost", "root", "", "db_crimemanager" ; // check the connection if (mysqli_connect_error()) { echo 'Unable to select database'; exit(); } 1 Like |
Re: Help Ugently Needed For My Msqli Error by kaythinks(m): 10:34pm On Jan 31, 2018 |
Re: Help Ugently Needed For My Msqli Error by Luminee(f): 2:14am On Feb 01, 2018 |
dapaiks: The issue just doesn't affect only your php login code, as affects all your codes. There is a slight difference in the syntax of mysqli, so even if I help you with the login code, how do you solve all other pending issues? Read on it bro |
Re: Help Ugently Needed For My Msqli Error by ClintonNzedimma(m): 8:00am On Feb 01, 2018 |
Boss, this is a safer method so you won't waste time In your connection.php, write $mysql=new mysqli("localhost", "root", "", "db_crimemanager" ; Then in your functions and classes make $mysql a GLOBAL variable If you have the old mysql_query(), change it to $query=$mysql->query() if you have the old mysql_num_rows(), change it to $num_rows=query->num_rows Don't forget to always make the $mysql variable a global in all your functions or classes else it won't work |
(1) (Reply)
Paid Internship Position For Web Development Training At Lekki / I Need Help With Xampp Server / C# Programming In Nigeria
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 15 |