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

  • SEARCH
  • Home
  • 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 8798071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:59:41+00:00 2026-06-13T23:59:41+00:00

if (! empty ( $fname ) && ! empty ( $lname )) { $query5

  • 0
if (! empty ( $fname ) && ! empty ( $lname )) {
        $query5 = "select * from " . $db_prefix . "customer_det where (fname = '" . $fname . "' and lname = '" . $lname . "')";
            $result5 = $mysqli->query ( $query5, MYSQLI_STORE_RESULT ) or die ( mysql_error () );
    } else {
        $query5 = "select * from " . $db_prefix . "customer_det where phone = '" . $phone . "'";
        $result5 = $mysqli->query ( $query5, MYSQLI_STORE_RESULT ) or die ( mysql_error () );

    }
    while ($row=$result5->fetch_assoc) {
        $uid = $row['id'];
            $visits = $row['visits'];
        }
        var_dump($uid);
        var_dump($visits);
            var_dump($result5);
            var_dump($fname);
            var_dump($lname);

I’m not sure where I’m going wrong here. I run both of those queries in the phpMyAdmin SQL query box and it returns a row set. Then when I run it in PHP, and var_dump the variables, $uid returns NULL as well as $visits. Here’s the var dump:

NULL NULL object(mysqli_result)#4 (5) { ["current_field"]=> int(0) ["field_count"]=> int(34) ["lengths"]=> NULL ["num_rows"]=> int(1) ["type"]=> int(0) } string(6) "Wesley" string(6) "Snipes"

Any advice would be great.

  • 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-13T23:59:42+00:00Added an answer on June 13, 2026 at 11:59 pm

    When you’re calling fetch_assoc(), you’re forgetting the parentheses:

    while ($row=$result5->fetch_assoc) {
    

    Should be:

    while ($row=$result5->fetch_assoc()) {
    

    Because of this, the loop is never entered and $uid and $visits aren’t being set (so they’re still null).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My table table1 has 3 fields: FName , LName , Phone . I am
Is empty lookup table the same as non-matching lookup table in lookup transform? What
The empty() native in PHP will fail if the string is 0 or something
This returns an empty string when I try to determine the default text direction...
Possible Duplicate: How to empty DB in heroku I have a Postgres database on
I got an empty Div called Target : <div id=target></div> and a div called
I need an empty char array, but when i try do thing like this:
I have created an empty json object having an array itemlist(which further contains itemid
I have an empty matrix m : m <- matrix(0, nrow = 4, ncol
Starting with an empty dataframe, I need to fill the dataframe as follows: A

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.