Mysqi query returns nothing
I'm migrating from asp.net to php so I hope you'l be patient with me...
I setup an connection with dreamweaver:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_database = "localhost";
$database_database = "test";
$username_database = "root";
$password_database = "6627_ac_4033";
$database = mysql_connect($hostname_database, $username_database, $password_database) or trigger_error(mysql_error(),E_USER_ERROR);
?>
And then I try to do a query with mysqli but it returns nothing, this is my code:
<?php
require_once ('connections/database.php');
$query = "select id, name from da_groups";
$mysqli = new mysqli();
$mysqli->connect($hostname_database,$username_database, $password_database, $database_database);
if ($mysqli->connect_error) die ( $mysqli->connect_error);
$result = $mysqli->query($query,MYSQLI_STORE_RESULT);
if ($mysqli->error) die ('Could not find groups in database');
while ($row = $result->fetch_array('MYSQLI_ASSOC')){
echo $row['id'];
echo $row['name'];
}
$result->free();
$mysqli->close();
?>
It still returns nothing even if I change the parameters in $mysqli->connect directly to the proper hostnames and password etc.
Now there's also somethin different, when I first used the connection file this returned a connection error wich I can't reproduce now.
I'm a litle stuck with this code, please help me ![]()
