Answers for "select where php"

SQL
1

MySQL WHERE

SELECT 
    select_list
FROM
    table_name
WHERE
    search_condition;
    AND OR Like In Is
    officeCode = 1;
Posted by: Guest on October-19-2020
0

php select where

$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
  die("Connection failed: " . mysqli_connect_error());
}

$sql = "SELECT id, firstname, lastname FROM MyGuests WHERE lastname='Doe'";
$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
  // output data of each row
  while($row = mysqli_fetch_assoc($result)) {
    echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
  }
} else {
  echo "0 results";
}

mysqli_close($conn);
Posted by: Guest on October-28-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language