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 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();
}
?>
@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!!!
im trying ;-; i cant seem to find it ;/ im changing every mysql with mysqli ;-;
okâŠIf still it doesnâtâŠfeel free to ask!!!
not working i really cant do it ;/ i even tried looking on google to find 7.1 version
Not working, i been looking on google but not able to find it
no it doesnt ;-; i have looked online but nothing to be found
@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();
}
?>
new error when i press register 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
Sry i have made changes again in the scriptâŠtry again!!!
weres the script? i cant try again if i cant see changes lmao
Copy the same scriptâŠwhich i have posted (i already made changes)
Parse error: syntax error, unexpected â}â, expecting end of file in /storage/h2/401/535401/public_html/register.php on line 67
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();
}
?>
have you downgraded your php versionâŠor somthing!!!
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
Can you try downgrading to php version 7.0 and tell me the errors you are facing
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
small mistake â 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();
}
?>
loving the same errors <3