El siguiente código debería obtener el valor de un campo (user) de una tabla llamada users e introducirlo en otra tabla llamada images. Sin embargo, no lo hace. ¿Alguna sugerencia?.
$linked_img = mysqli_connect("localhost", "root", "", "register");
require("login_img.php");
$prof_img_upload = mysqli_query($linked_img, 'SELECT U.user FROM users U WHERE U.email="'.mysql_real_escape_string($email).'" AND U.password="'.mysql_real_escape_string($password). '"');
$result_img = mysqli_query($linked_img, 'INSERT INTO images (id_user) values ($prof_img_upload)');
login_img.php:
<?php
session_start();
$link = mysqli_connect("localhost", "root", "", "register");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$email = strip_tags($_POST['email']);
$password = strip_tags(sha1($_POST['password']));
if ($result = mysqli_query($link, 'SELECT U.name, etc... FROM users U WHERE U.email="'.mysql_real_escape_string($email).'" AND U.password="'.mysql_real_escape_string($password). '"')) {
$array = mysqli_fetch_array($result, MYSQLI_ASSOC);
$_SESSION['logged'] = 'yes';
$_SESSION['name'] = $array['name'];
etc.....sigue cargando variables
echo '<script>window.location="upload_crop_v1.2.php"</script>';
....else....
mysqli_free_result($result);
}
?>