Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9153861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:20:30+00:00 2026-06-17T12:20:30+00:00

I was recently told to stop using mysql_query() and instead switch to mysqli() .

  • 0

I was recently told to stop using mysql_query() and instead switch to mysqli(). Needless to say, I’m having difficulties making these changes in my code. I’d love to fix what I currently have, however I’m also looking for the most efficient (read least typing) way of looping through the example below.

In my config.php file

<?php
    $host = 'mysql.host.com';
    $user = 'userName';
    $password = 'password';
    $database = 'database';
    $link = new mysqli();
    $link->connect($host, $user, $password, $database);
    if (mysqli_connect_errno()) {
        exit('Connect failed: '. mysqli_connect_error());
    }
?>

In my index.php

$i = 0;
$getFundsQuery = "SELECT * FROM fund";
$getFundsResult = $link->query($getFundsQuery);
while($i < $getFundsResult->num_rows){
    echo "<option value = '".$getFundsResult['fundID']."'>".$getFundsResult['name']."</option>";
    $i++;
}

The immediate problem is that no data is being returned. And as stated above, I’m also looking for the method that would yield the least typing for looping through the results

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:20:31+00:00Added an answer on June 17, 2026 at 12:20 pm

    First of all you can omit the $link->connect(..) with:

    $mysqli = new mysqli($host, $user, $password, $database);
    

    Second, loop your results like this:

    while ( $row = $getFundsResult->fetch_object() ) {
        echo "<option value = '" . $row->fundID ."'>" . $row->name . "</option>";
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I work at an eCommerce company. Our DBA recently told me that using SQL
A consultant told me recently that he has clients using IIS. Those servers accept
I was told recently by a Flash developer that I respect that using include
I was recently told that using mongodb _id fields in a URL is unsafe.
I recently found an article online that told me about this: RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1&section=$2
I cannot remember where, but recently I passed a comment where the user told
I was recently told casting [NSNull null] to (NSString*) was terrible. However, -[NSDictionary stringForKey:]
I was recently told it was bad practice to haved marked a number of
I've recently been told to use Panels to dynamically load content into different sections
This is a (hopefully) really simple question - I have been told recently that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.