<?php
include ('main_config.php');
//get all web settings
$web_settings = array();

<?php
include ('main_config.php');
//get all web settings
$web_settings = array();
try {
    $db = new PDO($mysql_host_db, $mysql_user, $mysql_pass);
    $query = "SELECT * FROM t_lfs_web_settings"; 
    //$result = $db->query($query);
    $result = $db->prepare($query);
    $result->execute();
     foreach($result as $row)
        {
        echo $row['gld'].'<br />';
        echo $row['gname'].'<br />';
        echo $row['gvalue'];
        }



$db = new PDO($mysql_host_db, $mysql_user, $mysql_pass);
$query = "SELECT * FROM t_lfs_web_settings"; 
//$result = $db->query($query);
$result = $db->prepare($query);
$result->execute();
 foreach($result as $row)
    {
    echo $row['gld'].'<br />';
    echo $row['gname'].'<br />';
    echo $row['gvalue'];
    }

here gld,gname,gvalue are the field names of table. But I get error message while trying to display.

What is the error that you're getting?

You could try to add print_r($row); inside your loop so that you can see the contents of $row and see if anything is missing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.