How run examples from a book Im reading?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How run examples from a book Im reading?

Postby pedrolopez » 06. February 2006 04:24


I already installed the amazing software created by this amazing group.

All is function very nice, but the problem is I want to run a basic example of query a database.

I see the database using Navicat Software. Also I see the Cd's database that come in the examples after the complete installation.

After I run this: http://localhost/example.6-1.php
Using this code from a example of the book: written by Hugh E. Williams & David Lane (PHP and My SQL)

For now I use the root only. But I will change it soon.
Also the database winestore only has one user the "root"

"-//W3C//DTD HTML 4.01 Transitional//EN"
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
// (1) Open the database connection
$connection = mysqli_connect("localhost","root","");

// (2) Select the winestore database
mysqli_select_db("winestore", $connection);

// (3) Run the query on the winestore through the connection
$result = mysqli_query ("SELECT * FROM
wine", $connection);

// (4) While there are still rows in the result set, fetch the current
// row into the array $row
while ($row = mysqli_fetch_array($result, MYSQL_NUM))
// (5) Print out each element in $row, that is, print the values of
// the attributes
foreach ($row as $attribute)
print "{$attribute} ";

// Print a carriage return to neaten the output
print "\n";

This is the response of the webpage.

Warning: mysqli_select_db() expects parameter 1 to be mysql, string given in C:\Program Files\xampp\htdocs\example.6-1.php on line 16

Warning: mysqli_query() expects parameter 1 to be mysqli, string given in C:\Program Files\xampp\htdocs\example.6-1.php on line

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:\Program Files\xampp\htdocs\example.6-1
Posts: 1
Joined: 06. February 2006 03:58

Postby KingCrunch » 06. February 2006 08:40

The mysqli-extension has a changed interface.
Code: Select all
bool mysqli_select_db ( mysqli link, string dbname )
bool mysql_select_db ( string Datenbankname [, resource Verbindungs-Kennung] )

mixed mysqli_query ( mysqli link, string query [, int resultmode] )
resource mysql_query ( string Anfrage [, resource Verbindungs-Kennung] )
Nicht jeder Fehler ist ein Bug ...
Posts: 1724
Joined: 26. November 2005 19:25

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 75 guests