top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How do I make it so if there is more than one result, it will display them all?

+2 votes
323 views

I wrote a script, but when searched brings only one set of results. How do I make it so if there is more than one result, it will display them all?

posted Oct 17, 2014 by Vrije Mani Upadhyay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

The only database specific functions are $db->query, $db->select and $db->db (the constructor function). All other functions use standard PHP code only. The other point to note is that the two main functions that return rows of results take an optional argument to specify whether to return the results as an associative array, numerical array or object (which is the default)

<?php

    if ( $server == "oracle8" )
        include_once "oracle8/ez_sql.php";
    else
        include_once "mySQL/ez_sql.php";

    $users = $db->get_results("SELECT * FROM users");

    foreach ( $users as $user )
    {
        echo $user->name;
        }

?>
answer Nov 18, 2014 by Rahul Singh
Similar Questions
+1 vote

How many mongocxx::instance object I need if my application connect more than one mongod? or just one?

+5 votes

I Know that we can always fetch from one database server and rewrite it to another. But what is the simplest way to do this?

0 votes

Trying to manage line breaks in some output I'm generating and using strlen to measure the lengths of the strings I'm printing. Discovered something strange (to me!) in that strlen is returning +1 more than it
should.

The strings are from a query of my database - simple name fields. But everyone of them is coming back with a length that is one more than I see.

...