I'm trying to insert directory path of images in a table with FK (MySQL) using PHP-PDO, but I'm receiving this error:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (bd-veiculos.fotos, CONSTRAINT fk_fotos_veiculos FOREIGN KEY (veiculos_idveiculos) REFERENCES mydb.veiculos (idveiculos) ON DELETE NO ACTION ON UPDATE NO ACTION)
This is my table:
I'm building a CRUD in php, I've got a table with informations of cars as below:
I've got a submit button called 'AddImages' When I click it, I'm sending via POST the ID of car that I want to change, this is the php page that I send...
uploadimageform.php:
after that I choose some images then I click submit and send the informations to the next php code:
<?php
include "dbconfig.php";
if(isset($_POST['submit'])){
$id = trim(strip_tags($_POST['id']));
# INFO IMAGEM
$file = $_FILES['img'];
$numFile = count(array_filter($file['name']));
# PASTA
$folder = 'uploads';
# REQUISITOS
$permite = array('image/jpeg', 'image/png');
$maxSize = 1024 * 1024 * 5;
# MENSAGENS
$msg = array();
$errorMsg = array(
1 => 'O arquivo no upload é maior do que o limite definido em upload_max_filesize no php.ini.',
2 => 'O arquivo ultrapassa o limite de tamanho em MAX_FILE_SIZE que foi especificado no formulário HTML',
3 => 'o upload do arquivo foi feito parcialmente',
4 => 'Não foi feito o upload do arquivo'
);
if($numFile <= 0)
echo 'Selecione uma Imagem!';
else{
for($i = 0; $i < $numFile; $i++){
$name = $file['name'][$i];
$type = $file['type'][$i];
$size = $file['size'][$i];
$error = $file['error'][$i];
$tmp = $file['tmp_name'][$i];
$extensao = #end(explode('.', $name));
$novoNome = rand().".$extensao";
if($error != 0)
$msg[] = "<b>$name :</b> ".$errorMsg[$error];
else if(!in_array($type, $permite))
$msg[] = "<b>$name :</b> Erro imagem não suportada!";
else if($size > $maxSize)
$msg[] = "<b>$name :</b> Erro imagem ultrapassa o limite de 5MB";
else{
if(move_uploaded_file($tmp, $folder.'/'.$novoNome)):
$msg[] = "<b>$name :</b> Upload Realizado com Sucesso!";
$imgpath[] = $folder.'/'.$novoNome;
else:
$msg[] = "<b>$name :</b> Desculpe! Ocorreu um erro...";
endif;
}
foreach($msg as $pop)
echo $pop.'<br>';
}
}
try
{
$sql = "INSERT INTO fotos (tbl_imagecar) VALUES ";
foreach ($imgpath as $path)
{
$sql .= " ('$path'),";
}
$sql = substr ($sql,0,strlen ($sql)-1);
$result = $DB_con->exec($sql);
echo "Dados criados com sucesso.<br><br>";
}
catch(PDOException $e)
{
echo $e->getMessage();
}
}
?>
<br><br>
INDEX
<a href="read.php" title""=>LISTAR</a>
Here's the query that I'm trying use to put the informations in the DB:
INSERT INTO fotos SET `tbl_imagecar` = 'uploads/19350.JPG', `veiculos_idveiculos` = (SELECT idveiculos FROM veiculos WHERE idveiculos = 3
from there I can not progress in my code. (Sorry for my bad English)
You are getting database foreign key voilation error. To fix this
Your field
mydb.veiculos (idveiculos)
needs to be first inserted/updated with same value(for example 13232) ,
which you are trying to insert into table field
bd-veiculos.fotos.veiculos_idveiculos
Related
I'm doing a web service but I need to get data from two different tables taking into account the result of a query in a relational table
How can I make 2 queries to two different tables taking into account a 3 query to obtain the data of those queries?
I have a relational table in which I keep the id's and I need to make a query of that table and then make two queries to two different tables to get the data and show them together in a json to be able to use it
example:
$ query1 = "select * from family where ID = 2";
while ($ query1) {
$ consult2 = "select * from adults where son = $ query1 ['ID']";
$ consult3 = "select * from siblings where son = $ query1 ['ID']";
}
my code for the query is this, is in PHP:
require 'Database.php';
class Union {
function __construct(){
}
public static function getById($id_vehiculo){
// Consulta del vehiculo
$consulta = "SELECT id_relacion, id_operador, id_vehiculo FROM uniontaxioperador WHERE id_vehiculo = ?";
try {
// Preparar sentencia
$comando = Database::getInstance()->getDb()->prepare($consulta);
// Ejecutar sentencia preparada
$comando->execute(array($id_vehiculo));
// Capturar primera fila del resultado
$row = $comando->fetch(PDO::FETCH_ASSOC);
return $row;
} catch (PDOException $e) {
// Aquí puedes clasificar el error dependiendo de la excepción
// para presentarlo en la respuesta Json
return -1;
}
}
}
and to show the json is this:
require 'WS_consulta.php';
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
if (isset($_GET['id_vehiculo'])) {
// Obtener parámetro id_vehiculo
$parametro = $_GET['id_vehiculo'];
// Tratar retorno
$retorno = Union::getById($parametro);
if ($retorno) {
$union["estado"] = "1";
$union["id_relacion"] = $retorno;
// Enviar objeto json de la union
print json_encode($union);
} else {
// Enviar respuesta de error general
print json_encode(
array(
'estado' => '2',
'mensaje' => 'No se obtuvo el registro'
)
);
}
} else {
// Enviar respuesta de error
print json_encode(
array(
'estado' => '3',
'mensaje' => 'Se necesita un identificador'
)
);
}
}
I put my code after some explanations.
I program this because i need to fill a database used by an application with .mm document (Freemind docs, .mm is the extension for "mind mapping")
The application and database need i keep the structure inside the Freemind doc. I don't program the application and the database, it's the work of an another guy.
This is the reason because i have all this
"if the child of the current node is a node with a child is an icon with an attribute called BUILTIN contains idea, this child is not an other object to put in the database, but the "contenu" value of the object create by the current node"
Just horrible to explain (it's horrible to explain it in French... And i try to make it clear in English. I hope it's clear.)
When i try to use my program, i can select the Freemind docs i want to convert is SQL, but i have this error just after:
Fatal error: Can't use method return value in write context in C:\xampp\htdocs\test2\transfertXmlBdd.php on line 25
Someone know why it's doesn't work and how i can make it works?
I think it's this part
if(move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
$chaineXML = $target_file;
I try to keep the uploaded file in the $chaineXML for charge it with DOM after.
$dom->loadXML($chaineXML);
But i probably do it wrong.
uploadForm
<form action="upload.php" method="post" enctype="multipart/form-data">
Selectionner le document Freemind a charger:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Charger le document" name="submit">
</form>
</body>
</html>
upload
// Check if image file is a actual image or fake image
//if(isset($_POST["submit"])) {
// $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
// if($check !== false) {
// echo "File is an image - " . $check["mime"] . ".";
// $uploadOk = 1;
// } else {
// echo "File is not an image.";
// $uploadOk = 0;
// }
//}
// Check if file already exists
if (file_exists($target_file)) {
echo "Le fichier a deja ete charger.";
$uploadOk = 0;
}
// Check file size
//if ($_FILES["fileToUpload"]["size"] > 50000000) {
// echo "Le fichier est trop lourd.";
// $uploadOk = 0;
//}
// Allow certain file formats
if($imageFileType != "mm") {
echo "Vous ne pouvez upload que des fichiers XML au format MM (mind mapping).";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Echec du chargement.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
$chaineXML = $target_file;
echo "Le fichier ". basename( $_FILES["fileToUpload"]["name"]). " a ete charger.";
//on appelle la conversion/transfert
include_once('C:/xampp/htdocs/test2/transfertXmlBdd.php');
echo "Les donnees ont ete enregistre dans la BDD.";
} else {
echo "Une erreur s'est produite.";
}
}
?>
transferXmlBdd
$dom->loadXML($chaineXML);
$element = $listeElements->item(0);
//variables
$id= NULL;
$nom = NULL;
$type = NULL;
$contenu = NULL;
$idParent = NULL;
$idFils = NULL;
//comper le nombres d'elements déjà présent dans la table
$res = $bdd->query('select count(*) as nb from element');
$data = $res->fetch();
$id = $data['nb'];
foreach($xml as $node)
{
//on vérifie la présence ou non de BUILTIN de valeur idea, on passe à l'itération suivante (en forçant) si oui
if($node->hasChild("icon")->hasAttribute("BUILTIN")="idea")
{
continue;
}
//on génere les valeurs id et nom
$nom = getAttributeNode('NAME');
$id = $id + 1;
$idFils = $id;
//
$node.setAttribute(bddid,$id);
//on vérifie la parenté de l'enregistrement
if($node->hasParent("node"))
{
$idParent = getAttributeParent('bddid');
$req = $bdd->prepare('INSERT INTO fils_des_element(id_elem, id_fils) VALUES( idParent, :idFils)');
}
else
{
// affilié à l'élement 0
$req = $bdd->prepare('INSERT INTO fils_des_element(id_elem, id_fils) VALUES( 0, :idFils)');
}
//vérification de contenu
if($node->hasChild("node")->hasChild("icon")->hasAttribute("BUILTIN")=idea)
{
$contenu = getChildAttribute('NAME');
}
//détermination du type
if($node->hasChild("icon")-hasAttribute("BUILTIN")=button_ok)
{
$type = "Avec Solution";
}
elseif($node->hasChild("icon")-hasAttribute("BUILTIN")=button_cancel)
{
$type = "Sans Solution";
}
else
{
$type = NULL;
}
//création de l'entré dans la table
$req = $bdd->prepare('INSERT INTO element(id_element, nom, type, proprietaire, visible, contenu, date_modif) VALUES( :id, :nom, :type, drn, 0, :contenu, CURDATE())');
}
?>
I'm new with PHP and SQL...
I'm trying to create new tables based on the url, but it's only working the first time I use it. After that, it's not possible.
Here is my PHP code:
if(isset($_GET['id'])){
$tabela = $_GET['tabela'];
$_GET['id'];
$criar = $tabela . $nivel . $page_id;
// Se clicar no botão 'confirmar', então ele faz o seguinte:
if(isset($_POST['submit'])){
$titulo = $_POST['titulo'];
$_FILES['imagem']['tmp_name'];
$texto = $_POST['texto'];
// Se um destes campos estiver vazio:
if($titulo=='' or $imagem=='' or $texto==''){
echo "Preencha todos os campos para o menu!";
exit(); }
// Se não houver campos vazios, ele faz: else {
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "site";
// Ligação à base de dados:
$conn = new mysqli($servername, $username, $password, $dbname);
// Verifica a ligação:
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Cria a nova tabela:
$sql = "CREATE TABLE IF NOT EXISTS $criar (
id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
titulo VARCHAR(255),
imagem LONGBLOB,
texto TEXT,
grupo INT(9),
FOREIGN KEY (grupo) REFERENCES $tabela(id)
)";
// Se conseguir ligar-se à base de dados e criar uma nova tabela, ele insere os dados na nova tabela:
if ($conn->query($sql) === TRUE) {
include("includes/connect.php");
mysql_query("SET NAMES 'utf8'");
move_uploaded_file($image_tmp,"../imagens/$imagem");
$insert_query = "INSERT INTO $criar (titulo, imagem, texto, grupo) VALUES ('$titulo','$imagem','$texto','$page_id')";
// Se inserir os dados na nova tabela, ele dá uma mensagem de sucesso:
if(mysql_query($insert_query)){
echo "<script>alert('Menu inserido com sucesso!')</script>";
echo "<script>window.open('index.php','_self')</script>";
}
else{
echo "Erro: " . $insert_query . "<br>" . $conn->error;
}
}
// Caso ele não consiga criar uma nova tabela (porque já existe), ele insere os dados na tabela já existente:
else {
include("includes/connect.php");
mysql_query("SET NAMES 'utf8'");
// Cria a nova tabela:
$sql = "CREATE TABLE IF NOT EXISTS $criar (
id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
titulo VARCHAR(255),
imagem LONGBLOB,
texto TEXT,
grupo INT(9),
FOREIGN KEY (grupo) REFERENCES $tabela(id)
)";
if(mysql_query($sql)){
echo "sim!";
}
else {
echo "não!";
}
move_uploaded_file($image_tmp,"../imagens/$imagem");
$insert_query = "INSERT INTO $criar (titulo, imagem, texto, grupo) VALUES ('$titulo','$imagem','$texto','$page_id')";
// Caso consiga inserir os dados na tabela já existente, dá uma mensagem de sucesso:
if(mysql_query($insert_query&&$sql)){
echo "<script>alert('Menu inserido com sucesso!')</script>";
echo "<script>window.open('index.php','_self')</script>";
}
else{
echo "isto não está a correr bem!";
}
// Fecha a ligação à base de dados:
$conn->close();
} } }$nivel = $_GET['grupo']; $page_id =$imagem = $_FILES['imagem']['name']; $image_tmp =
What do you mean 1st time, 2nd time? Do you try to create another table with the same name you just have created? You'll get a table already exists error.
CREATE TABLE IF NOT EXISTS $criar
This explicitly tells MySql not to create the table if it exists, so if you pass the same query parameters to your php then it'll not be able to create the same table again.
Probably you could change it to:
$page_id = $_GET['id'];
$criar = $tabela . $nivel . $page_id;
And then pass a different id and/or different tabela every time.
this code looks behind the issue to me :
$tabela = $_GET['tabela'];
$_GET['id']; //this line looks odd
$criar = $tabela . $nivel . $page_id;
and maybe it's not creating new tables because you give the same $criar every time.
After hours of trying to solve this issue, i finally got good news! :) i was working in my local server (via xampp) and decided to put it online to check if something changes... and dont know why, but it works perfectly online and dont work with xampp! What a mess!! but its working!! thanks all for your help!! ;)
I have a script that loads images in the database and in two directories: uploads / original and a directory for the preview: uploads / thumbs
I need to create a small panel to delete inserted images, I have already created the code to delete from the database, but I can not delete them from the two directories.
I know I need to use unlink, but I'm no expert, I do not know where to place the code etc. I ask for help to you.
This is the file that I delete.php structured so far:
<?php
$con = mysql_connect("localhost","*******","******");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("**********************", $con);
if($_POST)
{
$ids = isset($_POST['id']) ? $_POST['id'] : array();
elimina_record($ids);
}
elseif(isset($_GET['id']))
{
elimina_record(array($_GET['id']));
}
else
mostra_lista();
function mostra_lista()
{
// mostro un eventuale messaggio
if(isset($_GET['msg']))
echo '<b>'.htmlentities($_GET['msg']).'</b><br /><br />';
// preparo la query
$query = "SELECT id,name,filename FROM image";
// invio la query
$result = mysql_query($query);
// controllo l'esito
if (!$result) {
die("Errore nella query $query: " . mysql_error());
}
echo '
<form name="form1" method="post" action="">
<table border="1">
<tr>
<th> </th>
<th>ID</th>
<th> </th>
</tr>';
while ($row = mysql_fetch_assoc($result))
{
$name = htmlentities($row['name']);
$id = htmlentities($row['id']);
$filename = htmlentities($row['filename']);
// preparo il link per la modifica dei dati del record
$link = $_SERVER['PHP_SELF'].'?id=' . $row['id'];
echo "<tr>
<td><input name=\"id[]\" type=\"checkbox\" value=\"$row[id]\" /></td>
<td>$id</td>
<td>delete</td>
</tr>";
}
echo '</table>
<br />
<input type="submit" name="Submit" value="Elimina record selezionati" />
</form>';
// libero la memoria di PHP occupata dai record estratti con la SELECT
mysql_free_result($result);
// chiudo la connessione a MySQL
mysql_close();
}
function elimina_record($ids)
{
// verifico che almeno un id sia stato selezionato
if(count($ids) < 1)
{
$messaggio = urlencode("Nessun record selezionato!");
header('location: '.$_SERVER['PHP_SELF'].'?msg='.$messaggio);
exit;
}
// per precauzione converto gli ID in interi
$ids = array_map('intval',$ids);
// creo una lista di ID per la query
$ids = implode(',',$ids);
// preparo la query
$query = "DELETE FROM image WHERE id IN ($ids)";
// invio la query
$result = mysql_query($query);
// controllo l'esito
if (!$result) {
die("Errore nella query $query: " . mysql_error());
}
// conto il numero di record cancellati
$num_record = mysql_affected_rows();
// chiudo la connessione a MySQL
mysql_close();
$messaggio = urlencode("Numero record cancellati: $num_record");
header('location: '.$_SERVER['PHP_SELF'].'?msg='.$messaggio);
}
?>
While, it may be useful, even paste the file to upload.php files:
session_start();
$_SESSION['id']="1";
$id=$_SESSION['id'];
include 'config.php'; //assume you have connected to database already.
$folder = 'uploads/';
$name = date('YmdHis');
$filename = md5($_SERVER['REMOTE_ADDR'].rand()).'.jpg';
$original = $folder.$filename;
// The JPEG snapshot is sent as raw input:
$input = file_get_contents('php://input');
if(md5($input) == '7d4df9cc423720b7f1f3d672b89362be'){
// Blank image. We don't need this one.
exit;
}
$result = file_put_contents($original, $input);
if (!$result) {
echo '{
"error" : 1,
"message" : "Failed save the image. Make sure you chmod the uploads folder and its subfolders to 777."
}';
exit;
}
$info = getimagesize($original);
if($info['mime'] != 'image/jpeg'){
unlink($original);
exit;
}
// Moving the temporary file to the originals folder:
rename($original,'uploads/original/'.$filename);
$original = 'uploads/original/'.$filename;
// Using the GD library to resize
// the image into a thumbnail:
$origImage = imagecreatefromjpeg($original);
$newImage = imagecreatetruecolor(154,110);
imagecopyresampled($newImage,$origImage,0,0,0,0,154,110,520,370);
imagejpeg($newImage,'uploads/thumbs/'.$filename);
echo '{"status":1,"message":"Success!","filename":"'.$filename.'"}';
$sql="INSERT INTO image VALUES ('','$name','$filename')";
$result=mysqli_query($con,$sql);
$value=mysqli_insert_id($con);
$_SESSION["myvalue"]=$value;
$cart_1="/uploads/original/";
$cart_2="/uploads/thumbs/";
foreach($files as $file){
$f_1=$cart_1.$file;
$f_2=$cart_2.$file;
unlink($f_1);
unlink($f_2);
}
Check this out:
$dir1 = '/upload/original/';
$dir2 = '/upload/thumbs/';
$image = 'abc.jpg';
if(file_exists($dir1.$image))
unlink($dir1.$image);
if(file_exists($dir2.$image))
unlink($dir2.$image);
I have two tables where I need to display text in a table corresponding to the users of the users table.
So I did this:
$email = $_SESSION['email'];
$select = mysql_query("SELECT t.id, t.id_textos, t.userTitleSite, t.userTextSobre, t.userTextContatos, t.userTextMaisInfos FROM vms_textos t INNER JOIN vms_users u ON (t.id = u.id) LIMIT 1") or print (mysql_error());
while($res_select = mysql_fetch_array($select)){
$userTitleSite = $res_select["userTitleSite"];
$userTextSobre = $res_select["userTextSobre"];
$userTextContatos = $res_select["userTextContatos"];
$userTextMaisInfos = $res_select["userTextMaisInfos"];
$id = $res_select["id"];
and working.
Now i need to update this information straight from the INPUTS..
but I can not do because my field UPDATE must be wrong because it always resets everything after that grip on SUBMIT.
This is the code I'm using. Please see what is wrong:
$query=mysql_query("UPDATE vms_textos SET userTitleSite='$userTitleSite', userTextSobre='$userTextSobre', userTextContatos='$userTextContatos', userTextMaisInfos='$userTextMaisInfos' WHERE t.id=u.id");
Thanks!
[EDIT]
ALL IMPORTANT CODE:
// INCLUDES.PHP
// Starts
ob_start();
session_start();
// Globais
$startaction="";
// Ação
if(isset($_GET["acao"])){
$acao=$_GET["acao"];
$startaction=1;
}
// Conexão com o banco de dados
$conectar=new DB;
$conectar=$conectar->conectar();
// Metodos de Cadastro
if($startaction == 1){
if($acao == "cadastrar"){
$usuario=$_POST["usuario"];
$nome=$_POST["nome"];
$sobrenome=$_POST["sobrenome"];
$telefone=$_POST["telefone"];
$email=$_POST["email"];
$senha=$_POST["senha"];
if(empty($usuario) || empty($nome) || empty($sobrenome) || empty($telefone) || empty($email) || empty($senha)){
$msg="Preencha todos os campos!";
}
// Todos os campos preenchidos
else {
// Email válido
if(filter_var($email,FILTER_VALIDATE_EMAIL)){
// Senha inválida
if(strlen($senha) < 8){
$msg="As senhas devem conter no mínimo oito caracteres!";
}
// Senha válida
else {
// Executa a classe de cadastro
$conectar=new Cadastro;
echo "<div class=\"flash\">";
$conectar=$conectar->cadastrar($usuario, $nome, $sobrenome, $telefone, $email, $senha);
echo "</div>";
}
}
// Email invalido
else{
$msg="Digite seu e-mail corretamente!";
}
}
}
}
// Método de Login
if($startaction == 1){
if($acao == "logar"){
// Dados
$email=addslashes($_POST["email"]);
$senha=addslashes(sha1($_POST["senha"].""));
if(empty($email) || empty($senha)){
$msg="Preencha todos os campos!";
} else{
if(!filter_var($email,FILTER_VALIDATE_EMAIL)){
$msg="Digite seu e-mail corretamente!";
} else {
// Executa a busca pelo usuário
$login=new Login;
echo "<div class=\"flash\">";
$login=$login->logar($email, $senha);
echo "</div>";
}
}
}
}
// Método de Checar usuário
if(isset($_SESSION["email"]) && isset($_SESSION["senha"])){
$logado=1;
$nivel=$_SESSION["nivel"];
}
// LOGIN.PHP -- CLASSE DE LOGIN
class Login {
public function logar($email, $senha){
$buscar=mysql_query("SELECT * FROM vms_users WHERE email='$email' AND senha='$senha' LIMIT 1");
if(mysql_num_rows($buscar) == 1){
$dados=mysql_fetch_array($buscar);
if($dados["status"] == 1){
$_SESSION["email"]=$dados["email"];
$_SESSION["senha"]=$dados["senha"];
$_SESSION["nivel"]=$dados["nivel"];
setcookie("logado",1);
$log=1;
} else{
$flash="Usuário bloqueado! Entre em contato conosco!";
}
}
if(isset($log)){
$flash="Você foi logado com sucesso!";
} else{
if(empty($flash)){
$flash="Ops, digite seu e-mail e sua senha corretamente!";
}
}
echo $flash;
}
}
// CADASTRO.PHP -- CLASSE DE CADASTRO
class Cadastro{
public function cadastrar($usuario, $nome, $sobrenome, $telefone, $email, $senha){
// Tratamento das variaveis
$usuario=ucwords(strtolower($usuario));
$nome=ucwords(strtolower($nome));
$sobrenome=ucwords(strtolower($sobrenome));
$telefone=ucwords(strtolower($telefone));
$email=ucwords(strtolower($email));
$senha=sha1($senha."");
// Inserção no banco de dados
$validaremail=mysql_query("SELECT * FROM vms_users WHERE email='$email' OR usuario='$usuario'");
$contar=mysql_num_rows($validaremail);
if($contar == 0){
$insert=mysql_query("INSERT INTO vms_users(usuario, nome, sobrenome, telefone, email, senha, nivel, status) VALUES('$usuario','$nome','$sobrenome','$telefone','$email','$senha','1','0')");
} else{
$flash="Desculpe, mas já existe um usuário cadastrado com este e-mail em nosso sistema!";
}
if(isset($insert)){
// Cadatro ok
$flash="Cadastro realizado com sucesso, aguarde nossa aprovação!";
} else{
if(empty($flash)){
$flash="Ops, houve um erro em nosso sistema!";
}
}
// Retorno para o usuário
echo $flash;
}
}
$query=mysql_query("UPDATE vms_textos SET t.userTitleSite='$userTitleSite' WHERE t.id='u.id'");
$query=mysql_query("UPDATE vms_textos SET userTitleSite='$userTitleSite' WHERE t.id=u.id");
what field do u want to update in db? SET that particular field in mysql_query(). i mentioned here.. try like this if u set all fields then all fields are updated..