# Problem with DROPing?



## juhu (Aug 29, 2011)

Hello, i downloaded WAMP server /2.1e/ and tested index.php/testmysql.php - all was ok. 
But when i add "database.php" with my code : (to "www" folder) 

<?php 
$link = mysqli_connect("localhost", "root", "", "" ) 
or die ("Could not connect" ); 
$query = "DROP TABLE IF EXISTS install_test;"; 
$result = mysqli_query($link, $query) 
or die("Query (1) failed" ); 
$query = "CREATE TABLE install_test (a int not null auto_increment, b CHAR(25) not null, primary key (a))"; 
$result = mysqli_query($link, $query) 
or die ("Query(2) failed" ); 
for ($i=0;$i<5;$i++){ 
$query = sprintf("INSERT INTO install_test VALUES('','%s')", microtime() ); 
$result = mysqli_query($link, $query) 
or die ("Query (3)failed" ); 
} 
$query = "SELECT * FROM install_test"; 
$result = mysqli_query($link, $query) 
or die ("Query (4) failed" ); 
echo "<table>\n"; 
while ($line = mysqli_fetch_array($result, MYSQLI_ASSOC)) { 
echo "\t<tr>\n"; 
foreach($line as $col_value){ 
echo "\t\t<td>$col_value</td>\n"; 
} 
echo "\t</tr>\n"; 
} 
echo "</table>\n"; 
mysqli_close($link); 
?> 


Problem is that, that all the time write me error : "Query (1) failed" 
I was tried to do something with that (add DROPing privileges to all users throught phpmyadmin, check my code..) but it still dont work. 
I dont know what have i do. What is bad? Server's settings?/code..? 
Thanks for your answer


----------



## Laxer (Dec 28, 2010)

Try reviewing your syntax for sql connection....

Here is a good link: PHP: mysqli::__construct - Manual


----------



## Jessica1234 (Sep 22, 2011)

Hi,
I think there is some problem in the code. Please check the below one:


> * mysqli::__construct()*
> ([ string $host = ini_get("mysqli.default_host")
> [, string $username = ini_get("mysqli.default_user") [, string $passwd = ini_get("mysqli.default_pw")
> [, string $dbname = ""
> ...


I copied it from the web, hope this will help you to solve the issue.


----------



## wmorri (May 29, 2008)

Hi,

Please don't post on threads that the original post hasn't posted on in three or more months. 

Cheers!


----------

