0

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

2
Contributors
1
Reply
9
Views
3 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.