I do not understand much about this, but what I'm doing is an android project.
Create a login with facebook, which leads to a user registry, in which only the users enter a user, and the rest of the data I subtract from the profile.
The function you create is called functions.php
, which is the next file.
<?php
header( 'Content-Type: text/html;charset=utf-8' );
function ejecutarSQLCommand($commando){
$mysqli = new mysqli("*******", "*******", "*******", "******");
/* check connection */
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
if ( $mysqli->multi_query($commando)) {
if ($resultset = $mysqli->store_result()) {
while ($row = $resultset->fetch_array(MYSQLI_BOTH)) {
}
$resultset->free();
}
}
$mysqli->close();
}
function getSQLResultSet($commando){
$mysqli = new mysqli("******", "*******", "*******", "******");
/* check connection */
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
if ( $mysqli->multi_query($commando)) {
return $mysqli->store_result();
}
$mysqli->close();
}
?>
And then create this file called registro.php
<?php include ('functions.php');
$nombre=$_GET['nombre'];
$usuario=$_GET['usuario'];
$mail=$_GET['mail'];
$facebookid=$_GET['facebookid'];
ejecutarSQLCommand("INSERT INTO 'usuarios' (nombre, usuario, mail, facebookid)
VALUES (
'$nombre' ,
'$usuario' ,
'$mail' ,
'$facebookid')
ON DUPLICATE KEY UPDATE 'nombre'= '$nombre',
'usuario'='$usuario',
'mail'='$mail',
'facebookid'='$facebookid';");
?>
The issue is that when I write the url ex:
mydomain.com/folder/register.php?name=loose & user = rattle & mail = [email protected] & facebookid = 254453
is sent to the database, but many records are created.
After 3 attempts I noticed an error in the faecbookid and a complete column could arrive, but that did not solve the problem that many tables were created. if I could correct the .php I would appreciate it !! and if they explain to me how I can delete all those failed records, or the table I would also appreciate them!