Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. MySQL query is not returning the expected Boolean value

MySQL query is not returning the expected Boolean value

Scheduled Pinned Locked Moved Web Development
databasemysqltoolsregexhelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eadig
    wrote on last edited by
    #1

    Hello everyone I have to come up with a MySQL query that can fetch a single match by name and phone number. To that end, I wrote a query below in my query functions script:

    $sql = 'SELECT * FROM users ';
    $sql .= 'WHERE name="' .db_escape($db, $user['name']) . '" AND phoneno="' . db_escape($db, $user['phoneno']) . '"';
    $sql .= 'LIMIT 1';
    $result = mysqli_query($db, $sql);
    confirm_result_set($result);
    $row = mysqli_fetch_assoc($result);
    if(!empty($row)) {
    return true;
    } else {
    return false;
    }

    However, this query will not return true when a match is found. Please help me work out how this query can be corrected to meet the goal. I'm looking forward to receiving hints/suggestions. Thanks for reading.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups