Need a little help


#1

Its just giving me errors, i want to keep it on php 7.1 since my login only supports it,my register wont work because of erros :confused: please help, i want to know what I have done wrong

(Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in /storage/h2/401/535401/public_html/register.php on line 67

Fatal error: Uncaught Error: Call to undefined function mysql_error() in /storage/h2/401/535401/public_html/register.php:67 Stack trace: #0 {main} thrown in /storage/h2/401/535401/public_html/register.php on line 67)

<?php define('DB_HOST', 'localhost'); define('DB_NAME', 'id535401_kickednetwork'); define('DB_USER','id535401_root'); define('DB_PASSWORD','********'); $con=mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error()); $db=mysqli_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error()); // this is error function NewUser() { $username = $_POST['username']; $email = $_POST['useremail']; $password = $_POST['password']; $query = "INSERT INTO members (username,email,password) VALUES ('$username','$email','$password')"; $data = mysql_query ($query)or die(mysql_error()); if($data) { echo "YOUR REGISTRATION IS COMPLETED..."; } } function SignUp() { if(!empty($_POST['username'])) //checking the 'user' name which is from Sign-Up.html, is it empty or have some text { $query = mysql_query("SELECT * FROM members WHERE username = '$_POST[username]' AND password = '$_POST[password]'") or die(mysql_error()); if(!$row = mysql_fetch_array($query) or die(mysql_error())) { newuser(); } else { echo "SORRY...YOU ARE ALREADY REGISTERED USER..."; } } } if(isset($_POST['submit'])) { SignUp(); } ?>

#2

@LurkingGamerPro The error states that yoy have used an undefined function.

Crosscheck you script and search for “mysql” function(which is a deprecated function)

Then replace it with “mysqli”.

Then it will work fine!!!


#3

:frowning: im trying ;-; i cant seem to find it ;/ im changing every mysql with mysqli ;-;


#4

ok…If still it doesn’t…feel free to ask!!!


#5

not working :confused: i really cant do it ;/ i even tried looking on google to find 7.1 version


#6

Not working, i been looking on google but not able to find it


#7

no it doesnt ;-; i have looked online but nothing to be found


#8

@LurkingGamerPro I have corrected it for you…chk and let me know…if you any problem

*Note:-Update the “password with your database password”

<?php $con= new mysqli('localhost','id535401_root','password','id535401_kickednetwork')or die("Could not connect to mysql".mysqli_error($con)); function NewUser() { $username = $_POST['username']; $email = $_POST['useremail']; $password = $_POST['password']; $query = "INSERT INTO members (username,email,password) VALUES ('$username','$email','$password')"; $data = mysql_query ($query)or die(mysql_error()); if($data) { echo "YOUR REGISTRATION IS COMPLETED..."; } } function SignUp() { if(!empty($_POST['username'])) //checking the 'user' name which is from Sign-Up.html, is it empty or have some text { $query = mysqli_query("SELECT * FROM members WHERE username = '$POST[username]' AND password = '$POST[password]'") or die(mysqli_error()); if(!$row = mysqli_fetch_array($query) or die(mysqli_error())) { newuser(); } else { echo "SORRY...YOU ARE ALREADY REGISTERED USER..."; } } } if(isset($_POST['submit'])) { SignUp(); } ?>

#9

new error when i press register :confused: aka button

Fatal error: Uncaught Error: Call to undefined function mysql_query() in /storage/h2/401/535401/public_html/register.php:80 Stack trace: #0 /storage/h2/401/535401/public_html/register.php(94): SignUp() #1 {main} thrown in /storage/h2/401/535401/public_html/register.php on line 80


#10

Sry i have made changes again in the script…try again!!!


#11

weres the script? i cant try again if i cant see changes lmao


#12

Copy the same script…which i have posted (i already made changes)


#13

Parse error: syntax error, unexpected ‘}’, expecting end of file in /storage/h2/401/535401/public_html/register.php on line 67


#14

Update Password with your database password…
Its working fine here.

<?php $con= new mysqli('localhost','id535401_root','password','id535401_kickednetwork')or die("Could not connect to mysql".mysqli_error($con)); function NewUser() { $username = $_POST['username']; $email = $_POST['useremail']; $password = $_POST['password']; $query = "INSERT INTO members (username,email,password) VALUES ('$username','$email','$password')"; $data = mysql_query ($query)or die(mysql_error()); if($data) { echo "YOUR REGISTRATION IS COMPLETED..."; } } function SignUp() { if(!empty($_POST['username'])) //checking the 'user' name which is from Sign-Up.html, is it empty or have some text { $query = mysqli_query("SELECT * FROM members WHERE username = '$POST[username]' AND password = '$POST[password]'") or die(mysqli_error()); if(!$row = mysqli_fetch_array($query) or die(mysqli_error())) { newuser(); } else { echo "SORRY...YOU ARE ALREADY REGISTERED USER..."; } } } if(isset($_POST['submit'])) { SignUp(); } ?>

#15

have you downgraded your php version…or somthing!!!


#16

no im on 7.1 ;/ i dont want to downgrade because my login system doesnt support that

and

Notice: Undefined variable: POST in /storage/h2/401/535401/public_html/register.php on line 80

Notice: Undefined variable: POST in /storage/h2/401/535401/public_html/register.php on line 80

Warning: mysqli_query() expects at least 2 parameters, 1 given in /storage/h2/401/535401/public_html/register.php on line 80

Warning: mysqli_error() expects exactly 1 parameter, 0 given in /storage/h2/401/535401/public_html/register.php on line 80


#17

Can you try downgrading to php version 7.0 and tell me the errors you are facing


#18

still there but i change it to $_POST and it gives me new 2 errors

Warning: mysqli_query() expects at least 2 parameters, 1 given in /storage/h2/401/535401/public_html/register.php on line 80

Warning: mysqli_error() expects exactly 1 parameter, 0 given in /storage/h2/401/535401/public_html/register.php on line 80


#19

small mistake :joy:’ Chk this script now and also switch to php version 7.1 :-

update password with your database password:-

<?php $con= new mysqli('localhost','id535401_root','password','id535401_kickednetwork')or die("Could not connect to mysql".mysqli_error($con)); function NewUser() { $username = $_POST['username']; $email = $_POST['useremail']; $password = $_POST['password']; $query = "INSERT INTO members (username,email,password) VALUES ('$username','$email','$password')"; $data = mysqli_query ($query)or die(mysqli_error()); if($data) { echo "YOUR REGISTRATION IS COMPLETED..."; } } function SignUp() { if(!empty($_POST['username'])) //checking the 'user' name which is from Sign-Up.html, is it empty or have some text { $query = mysqli_query("SELECT * FROM members WHERE username = '$_POST[username]' AND password = '$_POST[password]'") or die(mysqli_error()); if(!$row = mysqli_fetch_array($query) or die(mysqli_error())) { newuser(); } else { echo "SORRY...YOU ARE ALREADY REGISTERED USER..."; } } } if(isset($_POST['submit'])) { SignUp(); } ?>

#20

loving the same errors :smiley: <3