@Jigumer

PHP Fatal error: Uncaught PDOException?

Ошибки:

[21-Apr-2022 18:46:48 UTC] PHP Fatal error:  Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 in /public_html/fopps.xyz/gekaae/api/mysql.php:10
Stack trace:
#0 /home/l97763/public_html/fopps.xyz/gekaae/api/mysql.php(10): PDO->prepare('select * from s...')
#1 /home/l97763/public_html/fopps.xyz/gekaae/api/init_msg.php(101): selectUser(NULL)
#2 /home/l97763/public_html/fopps.xyz/gekaae/api/includes.php(5): include('/home/l97763/pu...')
#3 /home/l97763/public_html/fopps.xyz/gekaae/main.php(10): include('/home/l97763/pu...')
#4 {main}
  thrown in /home/l97763/public_html/fopps.xyz/gekaae/api/mysql.php on line 10
[21-Apr-2022 18:47:24 UTC] PHP Fatal error:  Uncaught Error: Unsupported operand types in /public_html/fopps.xyz/gekaae/api/init_msg.php:37
Stack trace:
#0 /home/l97763/public_html/fopps.xyz/gekaae/api/includes.php(5): include()
#1 /home/l97763/public_html/fopps.xyz/gekaae/main.php(10): include('/home/l97763/pu...')
#2 {main}
  thrown in /home/l97763/public_html/fopps.xyz/gekaae/api/init_msg.php on line 37


Код mysql.php:

<?
//include("../config/config.php");
include("config/connections.php");

function selectUser($uid){
    $pdo = connect();
		if ($pdo) {
    //  $sql = "SHOW COLUMNS FROM fs_content"; 
      $sql = "select * from sravni_users where id = {$uid}";
			$st = $pdo->prepare($sql);
			$st->execute();
      $result = $st->fetchAll();
      $res = $result[0];
       return $res; 
		}
	return false;
  
}


function EditBalance($uid, $new_balance) {
  updateColumns(["amount_confirm" => $new_balance], $uid);
}


Код init_msg.php:

// file_put_contents("lang.txt",print_r($lang,1));
  
  if ( isset($json['message']['photo']) ) { $text = $json['message']['caption']; }
  
  $message_photo_count = ($json['message']['photo']);
  $message_photo = $json['message']['photo'][$message_photo_count - 1]['file_id'];
  • Вопрос задан
  • 73 просмотра
Решения вопроса 1
rozhnev
@rozhnev Куратор тега PHP
Fullstack programmer, DBA, медленно, дорого
Уж если используете подготовленные выражения - делайте это правильно
$sql = "select * from sravni_users where id = ?";
      $st = $pdo->prepare($sql);
      $st->execute([$uid]);
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы