Search
 
SCRIPT & CODE EXAMPLE
 

PHP

PHP MySQL Use The ORDER BY 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 ORDER BY lastname";
$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 :: how to call php function from ajax 
Php :: wp php category page count products 
Php :: Tenant could not be identified on domain tenancy 
Php :: laravel local scope 
Php :: @lang laravel blade 
Php :: Root composer.json requires php ^7.1.3 but your php version (8.0.3) does not satisfy that requirement. 
Php :: php indexof 
Php :: delete data with ajax in php 
Php :: how to set up the laravel ssh keygen 
Php :: filter var php function 
Php :: update codeigniter 
Php :: laravel valet refresh env 
Php :: laravel blade global variable 
Php :: php get all array keys in json 
Php :: how to make a json request in php 
Php :: IlluminateContractsAuthAuthenticatable, AppModelsUser given, called in 
Php :: php file upload 
Php :: php html to pdf 
Php :: acf get image id sub_field 
Php :: how to setup php mailer 
Php :: laravel store file 
Php :: Laravel jwt check token sent by request is valid 
Php :: get all users created in a month laravel 
Php :: html in php 
Php :: generate fake name php 
Php :: laravel scheduler on shared hosting 
Php :: laravel where in 
Php :: routes not defined 
Php :: Databases supported by php 
Php :: close connection pdo 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =