sql insert where statment need help 0.o??? 06-02-2017, 12:18 AM
#1
Trying to use the following statement in php using pdo and sqlite
keep getting errors
The separate vars can be echo'd out, so there is no problem with the inputs.
Have no problem doing a simple insert (for new row any column) and select whatever from table column where row = 1
Looks so simple i just can't quite get i right
php code
cheers

Num5kull
keep getting errors
The separate vars can be echo'd out, so there is no problem with the inputs.
Have no problem doing a simple insert (for new row any column) and select whatever from table column where row = 1
Looks so simple i just can't quite get i right
Code:
INSERT INTO table ('stringstore')
VALUES ('string')
WHERE ('id') = ('100')
errorcode :
near "WHERE": syntax error:Code:
$id = "100";
if(!empty($astring))
{
$string = $astring;
$db = new PDO('sqlite:sqlite.db');
$result = $db->prepare("INSERT INTO table ('stringstore') VALUES ('$string') WHERE id = ('$id')");
#debuging
if (!$result)
{
echo "\nPDO::errorInfo():\n";
print_r($db->errorInfo());
}
$result->execute();
}
error:
Call to a member function execute() on booleancheers

Num5kull
(This post was last modified: 06-02-2017, 12:20 AM by Num5kull.)
[Video: https://www.youtube-nocookie.com/embed/bOkD-HSOmyI]
[bt][1B1sXX2sHhvUrf9Ga9MKcH5e9T4xgN13tB]
[bt][1B1sXX2sHhvUrf9Ga9MKcH5e9T4xgN13tB]




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)











