Page 1 of 1

mySQL looks working, but my scripts cannot connect...

PostPosted: 09. June 2006 12:00
by myslivo

I can access mySQL server with phpMyAdmin and with command line, but when I acces any of my webs mySQL is not responding at all.

I use this function to open connection to the mySQL server (it worked with PHPTriad):

Code: Select all
  function OpenConnection()
   { $server="localhost";
      $conn = mysql_Connect(localhost,$username,$password);
      $res = mysql_Select_DB($db,$conn);
       { echo "<p>Error in selecting the active DB...</p>";

      return $conn;

   $connection = OpenConnection();
   $sql = "<sql query>";
   $response = mySQL_Query($sql, $connection);
   echo mySQL_error();

It writes no error, but no SQL querries work...

I just installed XAMPP, ran Apache and mySQL from Control Panel and secured XAMPP pages, added password for root in mySQL (then i removed it via phpMyAdmin to try if this was not causing the problem).

I would be grateful for any suggestions.

PostPosted: 09. June 2006 12:12
by Wiedmann
Code: Select all
$sql = "<sql query>";

It writes no error, but no SQL querries work...

So it might be a good idea, to show us a simple query that does not work...

PostPosted: 09. June 2006 12:21
by myslivo
OK... For instance, I use this SQL query for user login to the aplication

$sql = "SELECT id_user FROM users WHERE name='".$usrname."' AND passwd='".$passwd."'";

There is the database "experiment", in this database there is table "users" and even the columns are correct...

As I posted in my first post this "application" worked correctly under PHPTriad, but then I wanted (needed) newer version of mySQL. So I installed XAMPP and hups there is a problem... I think it is somewhere in setting (or permisions, but I haven't changed anything except those changes already mentioned)...

PostPosted: 09. June 2006 12:30
by myslivo
Oh man... I'm so stupid... It was elsewhere is PHP setting. I was so focused, that it is a problem with those permissions I haven't checked those settings :-(

The best anyone can do about this thread is to delete it (such a lame of me)