Home>
Thank you very much. column userid from field customer_information is POST [userid]
I am creating a sql that extracts matching data, but I get an error and it doesn't work.
Please tell me if you know who you are.
~ Abbreviated ~
try {
$pdo->beginTransaction ();
$sql = "SELECT *,
FROM customer_information
WHERE userid =: userid;";
/ * AND 'password' =: password;";* /
print ($sql). "</br>";
$stmh = $pdo->prepare ($sql);
$stmh->bindValue (': userid', $_POST ['userid'], PDO :: PARAM_STR);
$stmh->bindValue (': password', $_POST ['password'], PDO :: PARAM_STR);
$bool = $stmh->execute ();
if ($bool) {
print ("". "Logged in.". "</br>");}
} catch (PDOException $Exception) {
$pdo->rollback ();
print "error:". $Exception->getMessage ();
}
~ Omitted ~
print ($sql). "";
SELECT *, FROM customer_information WHERE userid =: userid;
* I tried to add customer_information and userid with '', but it was not good.
Error display
Error: SQLSTATE [42000]: Syntax error or access violation: 1064 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 'FROM customer_information WHERE userid =?' At line 2
-
Answer # 1
-
Answer # 2
$sql =" SELECT *, FROM customer_information WHERE userid =: userid;";
↓$sql = "SELECT * FROM customer_information WHERE userid =: userid;";
Related articles
- php: i want to test the connection to mysql error: fatal error: uncaught error: call to undefined function mysql_connect ()
- java - i get an error when connecting to mysql
- error when starting service in mysql
- mysql - mariadb suddenly got an error and couldn't connect to the local server
- ruby - causes of mysql error when starting unicorn on ec2
- mysql error library not loaded: resolving libmysqlclient18dylib (loaderror)
- php, error in post form sqlstate [hy000]: general error: 1364 field'user_id' doesn't have a default value
- i read mamp mysql with rails 5 and get an error
- error about mysql when building environment with docker
- error with net start mysql 57
- about permission error when backing up with mysql
- i get an error trying to connect to the root of mysql
- i get an error in mysql and can't move forward! ??
- mysql - please tell us about the error statement for rails db: create!
- about error connecting nodejs application and mysql
- ruby - mysql error after auto deploy
- error message from mysql when opening laravel app
- mysql - sqlstate[hy000]: general error: 1366 incorrect string value
- error when mysql2 bundle install
- i want to display mysql on ec2 using sequel pro, but i get an error
Trends