Connecting To Mysql through php/mysqli
| From: | J. Connolly | Date: | Wed, 02 Feb 2005 15:39:37 +0000 |
| Subject: | Connecting To Mysql through php/mysqli | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-38433@lists.php.net to get a copy of this message | ||
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