Oblivion
Oblivion

Reputation: 63

PHP and SQLite 3, multiple returned row

I have a problem reading out multiple rows that get returned from an SQLite 3 database. I tested my querys before and i know what the result should be. But i cant seem to figure out how to read these different lines/rows that get returned from this query on a PHP based webpage. I searched the web, including stackoverflew but i can't seem to find an anwser to this question :/ Any help would be great!

Regards

P.S. this is how i fetch my the multiple rows on my php page:

$ID[$i] = $dbase->querySingle("SELECT rowid FROM rules WHERE parameter".$i." = '$Model'");

Upvotes: 4

Views: 1327

Answers (1)

Louis
Louis

Reputation: 2890

I have this in PHP:

$query = $db->query("SELECT * FROM files WHERE OBJECT = '".$id."'") ;
// begin table
echo '<table bgcolor="#FFFFFF">'."\n";
    // give titles
        echo '<tr>';
        echo '<td bgcolor="#669999"><b><u>File</u></b></td>';
        echo '<td bgcolor="#669999"><b><u>Night</u></b></td>';
        echo '<td bgcolor="#669999"><b><u>Name</u></b></td>';
        echo '<td bgcolor="#669999"><b><u>comment</u></b></td>';
        echo '</tr>'."\n";
//     
while($row = $query->fetchArray()) {
        echo '<tr>';
        echo '<td bgcolor="#CCCCCC">'.$row["uniquenumber"].'</td>';
        echo '<td bgcolor="#CCCCCC">'.$row["NIGHT"].'</td>';
        echo '<td bgcolor="#CCCCCC">'.$row["NAME"].'</td>';
        echo '<td bgcolor="#CCCCCC">'.$row["COMMENTS"].'</td>';
        echo '</tr>'."\n";
        }

It works here. Hope it can help you !

Upvotes: 3

Related Questions