I cant seem to access my table. Once again I’m sure its something simple I’m overlooking. I’m not getting any errors. Nothing is being added to the table and nothing shows up. I have renamed everything several times, made sure the connection is good, made sure the table exists. I cannot see anything wrong.
Add Data to Table
// Valid Data
require_once('resources/php/db.php');
$id = uniqid();
//die ( $id . $name . $sex. $age. $hair. $eye. $skin. $body. $pf );
// Insert Data to the Table
$statement1 = $db->prepare('INSERT INTO player VALUES(:player_id, :name, :sex, :age, :hair, :eye, :skin, :body, :pf)');
$result1 = $statement1 -> execute(array(
':player_id' =>$id,
':name' =>$name,
':sex' =>$sex,
':age' =>$age,
':hair' =>$hair,
':eye' =>$eye,
':skin' =>$skin,
':body' =>$body,
':pf' =>$pf
));
// Make Sure Everything Worked
if( $result1 == false )
{
die('Update Failed, Please Check Your Database.');
}
header("Location: ../../new_success.php?id=$id;");
exit();
Success Page
// Start the Load
$query1 = "SELECT *
FROM player
WHERE player_id = :player_id";
$statement1 = $db->prepare($query1);
$statement1 -> execute(array(
':player_id' =>$id
));
// Make Sure the Data Exists
if( $statement1->rowCount() == 0 )
{
die('Please Enter a Valid ID Tag - (id)');
}
else
{
$notEmpty = true;
}
while($row = $statement1->fetch())
{
$name = $row['name'];
$sex = $row['sex'];
$age = $row['age'];
$hair = $row['hair'];
$eye = $row['eye'];
$skin = $row['skin'];
$body = $row['body'];
$pf = $row['pf'];
}
It seems you are using pdo. If thats the case, you are missing
:inexecutemethod. It should be:player_idnotplayer_id.Same way the second query is also not proper.
php.net example.