Search
 
SCRIPT & CODE EXAMPLE
 

PHP

PHP MySQL Use The WHERE Clause

<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}

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

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

PREVIOUS NEXT
Code Example
Php :: php assign if not null 
Php :: laravel get all old input 
Php :: php str replace 
Php :: php explode end 
Php :: fakher ul islam khan 
Php :: laravel route optional parameter 
Php :: how to get meta information from pagination in laravel controller 
Php :: Round the number in php 
Php :: how to make model and controller in laravel 
Php :: .htaccess Prevent access to php.ini 
Php :: class php 
Php :: php sort() 
Php :: php append n time pattern to string 
Php :: create role spatie 
Php :: php apply function to array elements 
Php :: laravel search multiple tables 
Php :: job with queue name 
Php :: if exists in string count php 
Php :: php string functions 
Php :: wp rest api acf fields 
Php :: carbon add and subtract 
Php :: how simple get ip address json 
Php :: get git branch by php 
Php :: wordpress use jquery in plugin 
Php :: PHP | Send Attachment With Email 
Php :: secure random number php 
Php :: mysqli real escape string 
Php :: laravel 8 validation unique 2 columns 
Php :: how to set optional third parameter in routes of codeigniter 
Php :: php preg_quote 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =