Jump to content

How do I search a database?


Recommended Posts



Could anyone familiar with mysqli advise me with regards reading and searching a database please?


After connecting to the database, and opening it.


So far, I've written the following:-



$sql = "SELECT Member_id, Fullname, Username, Email, Password, Location, Country, DOB, Gender, Photo, Tzone, WebsiteURL, MembershipType, AccountStatus, ShortURL, BusinessAddress, SignupDate, LastVisitDate, AccountClosedDate, AccountDeleteDate FROM registration";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
// output data of each row
while ($row = $result->fetch_row()) {
if ( $row[3] == $user_email & $row[4] == $user_password) {

echo "Found Entry";






I'm finding that the above, will only read the first record/entry in the database, and will not read/search the rest of the database.


I'd like to ask/request how do I go about searching the rest of the database? As I don't know how to proceed with it.


Thank You.


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...