im sure im missing something obvious, i just cant see it any more.
i had a fail on a site as i tried live, i tried to break the problem down i found the error as below with a foreach and an if condition.
This is working fine on my local server but not live.

 $sql = "SELECT * FROM data"; 
    $result = mysqli_query($test,$sql);
    mysqli_fetch_array($result );
    foreach($result as $row){
        if( $late['area']=='Sanur'){
    echo  $row['title'].'<br>';
        }}      

It has to be something basic i am sure but im cooked!

Recommended Answers

All 5 Replies

thnk you , i got it working using PDO but I could not see why it would worl locally and not live

there are some specification on hosting sites sometimes to make it more secure. but localy you dont need much security on a standalone computer or your localhost.

got it done with below. thx

        $sql= "SELECT * FROM villadata ";
$result = $test->query($sql);
while($row = $result->fetch_array())
{
$rows[] = $row;
}   
foreach($rows as $row)
{
 if( $row['area']=='Sanur'){
    echo  $row['title'].'<br>';
        }}  
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.