0

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!

Edited by edbr

4
Contributors
5
Replies
26
Views
2 Years
Discussion Span
Last Post by edbr
0

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

0

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.

Edited by joshuajames.delacruz

0

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>';
        }}  
This question has already been answered. 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.