₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,328,589 members, 8,436,454 topics. Date: Tuesday, 30 June 2026 at 10:40 AM

Toggle theme

Help Ugently Needed For My Msqli Error - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingHelp Ugently Needed For My Msqli Error (1256 Views)

1 Reply (Go Down)

Help Ugently Needed For My Msqli Error by dapaiks(op): 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"wink;
}
?>
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:
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"wink;
}
?>
Pls i need sme1 to help me out with this as soon as posible, thnkx
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(op): 8:41pm On Jan 31, 2018
Luminee:
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.
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:
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"wink;
}
?>
Pls i need sme1 to help me out with this as soon as posible, thnkx
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"wink ;

// check the connection
if (mysqli_connect_error()) {
echo 'Unable to select database';
exit();
}
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:
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.
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"wink ;
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

An Error Occurred At Log Record Id.Programmer Needed Ugently....Sql Error Msg 1801, Level 16 During Execution In Ssms234

Any Web Developer Or Programmer That Can Build Bulk SMS Platform!Laravel Vuejs Crud TutorialWhere Can I Learn Web Development [urgent]