Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Mysqi query returns nothing

Engaged ,
Jul 31, 2010 Jul 31, 2010

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

TOPICS
Server side applications
754
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 31, 2010 Jul 31, 2010

Never mind found it, I used parenthesis where I shouldn't do....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 03, 2010 Aug 03, 2010
LATEST

Nothing helps you find the answer like posting to a forum!  There must be something about typing out the question that makes the subconscious work a little harder and bingo, the answer comes as soon as you hit the send button. There must be studies on this phenomena, or their should be...

--   
Lawrence   *Adobe Community Professional*
www.Cartweaver.com
Complete Shopping   Cart Application for
Dreamweaver, available in PHP and CF

Stay updated - http://blog.cartweaver.com

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines