RE: [PHP-DB] Connecting To Mysql through php/mysqli

From: Date: Wed, 02 Feb 2005 17:33:22 +0000
Subject: RE: [PHP-DB] Connecting To Mysql through php/mysqli
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-38436@lists.php.net to get a copy of this message
mysqli_select_db progblem is that the arguements are reversed, should be $link, $dbname the second error is a misspelling in the mysqli_query command bastien
From: "J. Connolly" <web@jozef.info> To: PHP list <php-db@lists.php.net> Subject: [PHP-DB] Connecting To Mysql through php/mysqli Date: Wed, 02 Feb 2005 10:39:37 -0500 I am getting the gollowing error message: PHP Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in C:\Apache Group\Apache2\htdocs\PHP\_debug_tmp.php on line 5 PHP Fatal error: Call to undefined function mysqli_quesry() in C:\Apache Group\Apache2\htdocs\PHP\_debug_tmp.php on line 9 With the following code:
1    <?php
2    //in order to connect
3    $conn = mysqli_connect("localhost","root","67568");
4    //inorder to designate database
5    mysqli_select_db("php_example", $conn);
6
7    //creating a table
8    $sql = "CREATE TABLE inventory (id int not null primary key auto_increment, item varchar(75))";
9    $result = mysqli_query($sql, $conn);
10    echo $result;
11    ?>
I am a total noob and am trying to copy this right out of a book (except the mysqli part which i had to struggle through on my own). I am using MySql 4.1.8 and PHP5 on Apache 2.0 server. Any help would be great. Thank you, jozef -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.db (#38436) next »