1
I have a syntax problem in my sql code inside the php code, I need to know which video has the biggest id in the database to save it in a separate folder with the same id number, so that the path is saved in the database. The mistake that happens is: You have an error in your SQL syntax; check the manual that Corresponds to your Mariadb server version for the right syntax to use near ' deo)FROM video' at line 1
<?php
include "Conection.php";
include "select.php";
$nome = $_POST['nome_video'];
$genero = $_POST['genero'];
$comando = "SELECT MAX(id_vídeo)FROM video;";
$select = mysqli_query($con,$comando);
if (!$select){
printf("Error: %s\n", mysqli_error($con));
exit();
}
$dado = mysqli_fetch_array($select);
$max_id = $dado['id_vídeo'];
$new_id = $max_id + 1;
$a = "C:/Users/ian/Desktop/UploadTeste/".$new_id;
print $a;
$query = "INSERT INTO video (CPF,nome_vídeo,genero,caminho) VALUES ('$cpf_cookie','$nome','$genero','$a');";
$insert = mysqli_query($con,$query);
mysqli_close($con);
if($insert== true){
echo"<script language='javascript' type='text/javascript'>alert('upload realizado com sucesso!');window.location.href='MinhasProducoes.php'</script>";
}
else{
echo"<script language='javascript' type='text/javascript'>alert('Não foi possível fazer o upload desse vídeo');window.location.href='##EnviarProdução.php'</script>";
}
$destino = 'C:/Users/Ian/Desktop/UploadTeste/' . $_FILES['arquivo']['name'];
$arquivo_tmp = $_FILES['arquivo']['$new_id'];
move_uploaded_file( $arquivo_tmp, $destino );
From a look in the parentheses are glued in the from.
– Leonardo Roese
$command = "SELECT MAX(id_video)FROM video;"; Well, you don’t need ";" inside select, and video does have an accent? (I think this might be the error).
– Leandro
Yes, it does have an accent and I can not give an alter table, because it is a primary key :(
– Iandro Stark