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

Problems with the Windows version of XAMPP, questions, comments, and anything related.

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

Postby myslivo » 09. June 2006 12:00

Hello,

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";
      $username="root";   
      $password="";   
      $db="experiment";   
     
      $conn = mysql_Connect(localhost,$username,$password);
      $res = mysql_Select_DB($db,$conn);
      if(!$res)
       { 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.
myslivo
 
Posts: 3
Joined: 09. June 2006 11:35

Postby Wiedmann » 09. June 2006 12:12

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...
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby myslivo » 09. June 2006 12:21

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)...
myslivo
 
Posts: 3
Joined: 09. June 2006 11:35

Postby myslivo » 09. June 2006 12:30

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)
myslivo
 
Posts: 3
Joined: 09. June 2006 11:35


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 60 guests