La query non funge come dovrebbe
Salve ragazzi. oramai sono quasi due giorni che perdo la testa su questa, banale pagina, scusate la mia ignoranza...allora io ho questo errore
Citazione:
Table 'my_zomer.richieste' doesn't exist
in poche parole dice che la tabella my_zomer.richieste non esiste, ma io nello script non la chiamo, io richiamo la tabella richiesteidutente (es: richieste7)...come mai si confonde dove ho sbagliato? :|
script.php
Codice PHP:
<?php
//oggetto start
ob_start();
//sessione start
session_start();
/*recupero le variabili inviate tramite get e definisce la data corrente */
$nome = $_GET[$nome];
$data = date("d/m/Y");
$tipo = amicizia;
//connesione al database
include("config.ini.php");
//query
$id = "SELECT id FROM utenti WHERE nome = '".$nome."'";
$res = mysql_query($id,$dbh) /*eseguo la query e controllo se va a buon fine ^^*/
or die("<h1>".mysql_error()."</h1>");
$array = mysql_fetch_array($res);
//invia la richiesta
$richieste = "INSERT INTO richieste".$array['id']." (id_amico, tipo_richiesta, data_amicizia) VALUES ('".$session[id]."', '".$tipo."', '".$data."')";
$res2 = mysql_query($richieste,$dbh) /*eseguo la query e controllo se va a buon fine ^^*/
or die("<h1>".mysql_error()."</h1>");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>Richiesta effetuata con sucesso</title>
</head>
<body>
<img alt="logo" src="loghi/logo.png"><br>
<br>
<br>
<br>
<br>
<br>
<br>
<div style="text-align: center;">Richiesta inviata con
sucesso <a href="home.php">torna alla home</a></div>
</body>
</html>