0% found this document useful (0 votes)
13 views1 page

Documento

Uploaded by

Carlos Mendes Jr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Documento

Uploaded by

Carlos Mendes Jr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

?

php

//Sample Database Connection Syntax for PHP and MySQL.

//Connect To Database

$hostname=”your_hostname”;

$username=”your_dbusername”;

$password=”your_dbpassword”;

$dbname=”your_dbusername”;

$usertable=”your_tablename”;

$yourfield = “your_field”;

Mysqli_connect($hostname,$username, $password) or die (“html>script


language=’JavaScript’>alert(‘Unable to connect to database! Please try again
later.’),history.go(-1)/script>/html>”);

Mysqli_select_db($dbname);

# Check If Record Exists

$query = “SELECT * FROM $usertable”;

$result = mysqli_query($query);

If($result){

While($row = mysqli_fetch_array($result)){

$name = $row[“$yourfield”];

Echo “Name: “.$name.”br/>”;

?>

You might also like