I rummaged through the whole Runet and the Internet didn’t find anything. Maybe they will help me here. Essence does not work last request. He is not satisfied.
<? session_start(); include $_SERVER['DOCUMENT_ROOT'].'/conf/db_connect.php'; $sql = "call get_user_by_user_name('$_POST[username]')"; $get_user = db_query($sql, $link, $_SESSION[mode]); $row = db_fetch($get_user, $_SESSION[mode]); if(!empty($row[user_id])) { header ("location:/reg/regindex.php?error=1"); exit; } if( !empty( $_FILES['avatar']['name'] ) ) { $userAvatar = $_SERVER['DOCUMENT_ROOT'].'/avatars/' .$_POST['username']. basename($_FILES['avatar']['name']); $userAvatarPath = '/avatars/' .$_POST['username']. basename($_FILES['avatar']['name']); if( substr($_FILES['avatar']['type'], 0, 5)=='image' ) { if (!move_uploaded_file($_FILES['avatar']['tmp_name'], $userAvatar)) { header ("location:/reg/regindex.php?error=2"); exit; } } else { header ("location:/reg/regindex.php?error=2"); exit; } } else { unset($userAvatar); unset($userAvatarPath); } $userName = $_POST['username']; $userPassword = $_POST['pw']; $email = $_POST['email']; $userFirstName = $_POST['firstname']; $userLastName = $_POST['lastname']; $birthdate = $_POST['date']; $userName = stripslashes($userName); $userName = htmlspecialchars($userName); $userName = addslashes($userName); $userPassword = stripslashes($userPassword); $userPassword = htmlspecialchars($userPassword); $userPassword = addslashes($userPassword); $userFirstName = stripslashes($userFirstName); $userFirstName = htmlspecialchars($userFirstName); $userFirstName = addslashes($userFirstName); $userLastName = stripslashes($userLastName); $userLastName = htmlspecialchars($userLastName); $userLastName = addslashes($userLastName); $email = stripslashes($email); $email = htmlspecialchars($email); $email = addslashes($email); $userName = trim($userName); $userPassword = trim($userPassword); $userFirstName = trim($userFirstName); $userLastName = trim($userLastName); $email = trim($email); $userName = str_replace("'","'",$userName); $userPassword = str_replace("'","'",$userPassword); $userFirstName = str_replace("'","'",$userFirstName); $userLastName = str_replace("'","'",$userLastName); $email = str_replace("'","'",$email); $sql_two = "call add_user('$userName','$userPassword','$email','$userLastName','$userLastName','$birthdate','$userAvatarPath')"; db_query($sql_two, $link, $_SESSION['mode']); header ("location:/reg/regend.php"); ?> If I comment it out
$sql = "call get_user_by_user_name('$_POST[username]')"; $get_user = db_query($sql, $link, $_SESSION[mode]); $row = db_fetch($get_user, $_SESSION[mode]); Everything is working. Otherwise, the opposite. Even the error does not betray if I remove the "or die". None of them work. $ link is a global connection variable, did checks before the last request, the connection does not fall off. There are no problems with him. There is another file, there are two requests in a row
$tempRow = db_row(db_query("SELECT count(*) FROM view_guest_book", $link, $_SESSION['mode']), $_SESSION['mode']); $result = db_query("call get_entries_gb_per_page('$per_page', '$start')", $link, $_SESSION['mode']); Db_query function
function db_query($query, $link, $conntype) { switch($conntype) { case "sqlb": { $result = mysql_query($query) or die("\nНекорректный SQL запрос >>" . $query); return $result; break; } case "sqlip": { $result = mysqli_query($link, $query) or die("\nНекорректный SQL запрос >>" . $query); return $result; break; } case "sqlio": { $result = $link->query($query) or die("\nНекорректный SQL запрос >>" . $query); return $result; break; } case "pdo": { $result = $link->prepare($query); $result->setFetchMode(PDO::FETCH_NUM); $result->execute() or die("\nНекорректный SQL запрос >>" . $query); return $result; break; } default:break; } } db_row is about the same, only functions corresponding to extensions are used there. Yes, and another such moment, before that, another database, and the queries were directly to the tables, and it did not work through procedures. In general, brains boil all nonsense.