note 112689 deleted from function.mysqli-connect by philip
| From: | philip@php.net | Date: | Thu, 03 Sep 2015 02:38:15 +0000 |
| Subject: | note 112689 deleted from function.mysqli-connect by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203603@lists.php.net to get a copy of this message | ||
Note Submitter: djfenix_31_94 at hotmail dot com
----
Simple connection to the database using this extension mysqli.
<?php
//conection:
$link = mysqli_connect("myhost","myuser","mypassw","mybd")
or die("Error " . mysqli_error($link));
//consultation:
$query = "SELECT name FROM mytable" or die("Error in the consult.." .
mysqli_error($link));
//execute the query.
$result = $link->query($query);
//display information:
while($row = mysqli_fetch_array($result)) {
echo $row["name"] . "<br>";
}
?>
or
<?php
//conection:
$link = mysqli_connect("myhost","myuser","mypassw","mybd")
or die("Error " . mysqli_error($link));
//consultation:
$query = "SELECT name FROM mytable" or die("Error in the consult.." .
mysqli_error($link));
//execute the query.
$result = mysqli_query($link, $query);
//display information:
while($row = mysqli_fetch_array($result)) {
echo $row["name"] . "<br>";
}
?>
Thanks by freddy alcarazo.