4

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'");
2
  • So what exactly is the problem? Is there an error-message? Does that querySingle-thing work? It looks like this query collects all ids from the rows which have "$Model" in one of the parameter* fields - is that correct? Is your problem that you have now that array of id's and don't know how to select the corresponding rows? Commented Sep 19, 2011 at 9:52
  • The 1ste answer worked like a charm ;) Commented Sep 19, 2011 at 10:55

1 Answer 1

3

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 !

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.