note 112689 modified in function.mysqli-connect by mazzanet

From: Date: Mon, 16 Jun 2014 06:34:03 +0000
Subject: note 112689 modified in function.mysqli-connect by mazzanet
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-199682@lists.php.net to get a copy of this message
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. --was-- 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_fecth_array($result)) { echo $row["name"] . "<br>"; } ?> Thanks by freddy alcarazo. http://php.net/manual/en/function.mysqli-connect.php

« previous php.notes (#199682) next »