mysql_connect() and php admin

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

mysql_connect() and php admin

Postby tavoqc » 10. July 2009 22:42

The instruction mysql_connect("localhost","root","z80") is to be used to connect to a database, where do i get the password from or how to set it and what to use to actually use that instruction to make the connection from php to a database.
Can multiple users be assign to a username at the same time? or how do i do for the users in my website to all connect to the database at the same time?
tavoqc
 
Posts: 6
Joined: 10. July 2009 22:35

Re: mysql_connect() and php admin

Postby glitzi85 » 10. July 2009 23:18

In a default XAMPP installation the root password for MySQL is empty:
Code: Select all
mysql_connect('localhost', 'root', '');

You normally set up one user for every project with permissions to only one Database, not the complete server. You can administrate the MySQL Server with the phpMyAdmin Webinterface, reachable via http://localhost/phpmyadmin
Then you just use this user in your Script. This has nothing to do with the users on your Website. Every MySQL-User can have multiple connections at the same time.

glitzi
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Re: mysql_connect() and php admin

Postby tavoqc » 11. July 2009 01:33

Thanks so much for your comment, now the error is:
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in C:\Archivos de programa\xampp\htdocs\registrocliente2.php on line 14

Line 14 is: mysql_select_db('proyecto',$conexion)
but 'proyecto' is the database I'm trying to use, how can i solve that problem?
tavoqc
 
Posts: 6
Joined: 10. July 2009 22:35

Re: mysql_connect() and php admin

Postby glitzi85 » 12. July 2009 19:20

Put
Code: Select all
echo mysql_error();

directly after your mysql_connect-Command. The error message means, that your $conexion-Variable does not contain an MySQL-Link. That mostly happens when the connect fails or you mistyped the variable.

glitzi
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim


Return to XAMPP for Windows

Who is online

Users browsing this forum: thedartgod and 68 guests