Jump to content

gavs_sc

New Members
  • Posts

    1
  • Joined

  • Last visited

gavs_sc's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. My PHP search code always returns 0 records, even when the record exists. Any help would be appreciated. <?php $conn = new mysqli("localhost", "root", "xxxxxx", "SAVR1984"); $Surname =$_POST['Surname']; $Maidenname = $_POST['Maidenname']; $Firstname = $_POST['Firstname']; $sql="SELECT * FROM 1984 WHERE Surname LIKE $Surname AND Maidenname LIKE '%".$Maidenname."%' AND Firstname LIKE '%".$Firstname."%'"; If(! $conn ) { die('Could not connect: ' . mysqlerror()); } $result = $conn->query($sql); if ($result->num_rows > 0){ while ($row = $result->fetch_assoc() ){ echo $row["Surname"] . " " . $row["Maidenname"] . " " . $row["Firstname"] . " " . $row["ID"] . " " . $row["Occupation"] . " " . $row["Address"] . " " . $row["Notes"] . "<BR>"; } } else { echo "0 records found"; } $conn->close(); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.