Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

select sql in php

<?php
$mysqli = new mysqli("localhost","my_user","my_password","my_db");

if ($mysqli -> connect_errno) {
  echo "Failed to connect to MySQL: " . $mysqli -> connect_error;
  exit();
}

$sql = "SELECT Lastname, Age FROM Persons ORDER BY Lastname";
$result = $mysqli -> query($sql);

// Associative array
$row = $result -> fetch_assoc();
printf ("%s (%s)
", $row["Lastname"], $row["Age"]);

// Free result set
$result -> free_result();

$mysqli -> close();
?>
//eng.aamirAlshawa
 
PREVIOUS NEXT
Tagged: #select #sql #php
ADD COMMENT
Topic
Name
2+4 =