Basically what I want to do is a query to MySQL with PHP and bring the results of the row specified in the URL.
For example, my URL is this: link
Then the query brings the results of the row that contains that nick (the nickname is unique, it is like an ID).
What I'm trying to do is this PHP query but something I'm doing wrong, I do not know the functions well and I do not know how to search it in google either.
conexion.php:
<?php
$host_name = '***';
$database = 'searya';
$user_name = 'plugins';
$password = '***';
$connect = mysqli_connect($host_name, $user_name, $password, $database);
if (mysqli_connect_errno()) {
die('<p>Failed to connect to MySQL: '.mysqli_connect_error().'</p>');
} else {
if(isset($_GET['nick'])){
$nick=$_GET['nick'];
$query = "SELECT * FROM referralsystem3 WHERE name = '$nick'";
$resultado = mysqli_query($connect,$query);
}else{
echo "No se pasaron datos en el GET";}
}
?>
index.php:
<?php
include("php/conexion.php");
while($fila = mysqli_fetch_array($resultado)){
?>
<h1 class="***"><?php echo $fila['nick'] ?> Te ha invitado</h1>
<?php
}
?>
The error I receive on the page is:
( ! ) SCREAM: Error suppression ignored for
( ! ) Notice: Undefined variable: name in X:\...\conexion.php on line 13
As you may have noticed, it is difficult for me to explain it since I do not really know what tools are used to do this, and I read in a forum that is with $ _GET.
Thank you very much!