i am trying to get all the result from my databse table but this query is not working.
<?php
try
{
$pdo = new PDO('mysql:host=localhost;dbname=articles', 'Avik', '');
}
catch (PDOException $e)
{
$output = 'Unable to connect to the database server.';
echo $output;
exit();
}
try
{
$sql = 'SELECT * FROM `post_series`';
$result = $pdo->query($sql);
}
catch(PDOException $e)
{
echo "something wrong";
exit();
}
foreach ($result as $row)
{
$series_options[] = array(
'post_series_id_option' => $row['post_series_id'],
'post_series_name_option' => $row['post_series_name']
);
}
echo $series_options['post_series_name_option'];
?>
it gives me a error :
Notice: Undefined index: post_series_name_option in E:\wamp\www\test.php on line 30