SA-MP Forums Archive
can anyone help me with php - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: can anyone help me with php (/showthread.php?tid=628711)



can anyone help me with php - iKevin - 13.02.2017

http://straccicompany.tk/ucp/?p=login

hi guys, im testing out some sorta ucp and it outputs a warning, deprecation, error, whatever.. can you tell me what's it for and what do I have to change to fix it?

thanks in advance


Re: can anyone help me with php - Meller - 13.02.2017

You should use a newer tutorial, but just because you wont; Simply change mysql_ to mysqli_


Re: can anyone help me with php - iKevin - 13.02.2017

i tried that, whole site turned into errors and it kept refreshing itself constantly

edit; changed mysql_ to mysqli_ now, check the site now..
http://straccicompany.tk/ucp/


Re: can anyone help me with php - iKevin - 14.02.2017

anyone?


Re: can anyone help me with php - Luis- - 14.02.2017

Show the mysqli_select_db & mysqli_error code.


Re: can anyone help me with php - iKevin - 17.02.2017

Код:
<?php

////\\\\\\\\\\\\\\\\\\\\\\EDIT The Below Variables\\\\\\\\\\\\\\\\\
////\\\\\\\\\\\\\\\\\\\ONLY EDIT WITHIN THE QUOTATION MARKS ("")\\\
//
$servername = "n10.ultra-h.com"; //Server name (usually "localhost")
$database = "port_5930";    //Database name (often username_databasename)
$username = "port_5930";        //User name for MySQL Database
$password = "*******";          //Password for MySQL User name
//
//// \\\\\\\\\\\\\\\\\\\\\\\DO NOT EDIT BELOW\\\\\\\\\\\\\\\\\\\\\\\
//
$connect = mysqli_connect($servername,$username,$password);
    mysqli_select_db($database, $connect) or die(mysqli_error());

?>
so here's the whole config.php i hope it helps

thanks in advance


Respuesta: can anyone help me with php - Eloy - 17.02.2017

Update

Try Check Parameter function mysqli_connect

PHP код:
<?php
$con 
mysqli_connect("HOST""USER""PASSWORD""DBNAME");

if (!
$con) {
    echo 
"Error: Mysql Conection." PHP_EOL;
    exit;
}

echo 
"Ready: Success " PHP_EOL;

?>



Re: can anyone help me with php - Macronix - 17.02.2017

"mysqli_select_db" asks for a database name (string) and you gave that function an integer ($connect).
The first parameter should be "$connect" and the second parameter "$database":

PHP код:
<?php
////\\\\\\\\\\\\\\\\\\\\\\EDIT The Below Variables\\\\\\\\\\\\\\\\\
////\\\\\\\\\\\\\\\\\\\ONLY EDIT WITHIN THE QUOTATION MARKS ("")\\\
//
$servername "n10.ultra-h.com"//Server name (usually "localhost")
$database "port_5930";    //Database name (often username_databasename)
$username "port_5930";        //User name for MySQL Database
$password "*******";          //Password for MySQL User name
//
//// \\\\\\\\\\\\\\\\\\\\\\\DO NOT EDIT BELOW\\\\\\\\\\\\\\\\\\\\\\\
//
$connect mysqli_connect($servername,$username,$password);
    
mysqli_select_db($connect$database) or die(mysqli_error($connect));
?>
You could also combine it directly with "mysqli_connect":

PHP код:
<?php
////\\\\\\\\\\\\\\\\\\\\\\EDIT The Below Variables\\\\\\\\\\\\\\\\\
////\\\\\\\\\\\\\\\\\\\ONLY EDIT WITHIN THE QUOTATION MARKS ("")\\\
//
$servername "n10.ultra-h.com"//Server name (usually "localhost")
$database "port_5930";    //Database name (often username_databasename)
$username "port_5930";        //User name for MySQL Database
$password "*******";          //Password for MySQL User name
//
//// \\\\\\\\\\\\\\\\\\\\\\\DO NOT EDIT BELOW\\\\\\\\\\\\\\\\\\\\\\\
//
$connect mysqli_connect($servername,$username,$password,$database);
// Check connection
if (mysqli_connect_errno())
{
    echo 
"Failed to connect to MySQL: " mysqli_connect_error();
}
?>



Re: can anyone help me with php - iKevin - 17.02.2017

Quote:
Originally Posted by Macronix
Посмотреть сообщение
"mysqli_select_db" asks for a database name (string) and you gave that function an integer ($connect).
The first parameter should be "$connect" and the second parameter "$database":

PHP код:
<?php
////\\\\\\\\\\\\\\\\\\\\\\EDIT The Below Variables\\\\\\\\\\\\\\\\\
////\\\\\\\\\\\\\\\\\\\ONLY EDIT WITHIN THE QUOTATION MARKS ("")\\\
//
$servername "n10.ultra-h.com"//Server name (usually "localhost")
$database "port_5930";    //Database name (often username_databasename)
$username "port_5930";        //User name for MySQL Database
$password "*******";          //Password for MySQL User name
//
//// \\\\\\\\\\\\\\\\\\\\\\\DO NOT EDIT BELOW\\\\\\\\\\\\\\\\\\\\\\\
//
$connect mysqli_connect($servername,$username,$password);
    
mysqli_select_db($connect$database) or die(mysqli_error($connect));
?>
You could also combine it directly with "mysqli_connect":

PHP код:
<?php
////\\\\\\\\\\\\\\\\\\\\\\EDIT The Below Variables\\\\\\\\\\\\\\\\\
////\\\\\\\\\\\\\\\\\\\ONLY EDIT WITHIN THE QUOTATION MARKS ("")\\\
//
$servername "n10.ultra-h.com"//Server name (usually "localhost")
$database "port_5930";    //Database name (often username_databasename)
$username "port_5930";        //User name for MySQL Database
$password "*******";          //Password for MySQL User name
//
//// \\\\\\\\\\\\\\\\\\\\\\\DO NOT EDIT BELOW\\\\\\\\\\\\\\\\\\\\\\\
//
$connect mysqli_connect($servername,$username,$password,$database);
// Check connection
if (mysqli_connect_errno())
{
    echo 
"Failed to connect to MySQL: " mysqli_connect_error();
}
?>
i tried that before


Re: can anyone help me with php - BroZeus - 17.02.2017

what YOU are doing :
Quote:

mysqli_select_db($database, $connect) or die(mysqli_error());

What it SHOULD be :
Quote:

mysqli_select_db($connect, $database) or die(mysqli_error());

$connect is first parameter not $db !!