Click to See Complete Forum and Search --> : Dreamweaver and MySQL


crypto
10-26-2003, 12:54 PM
I'm Trying to make a login page with dreamweaver using php and MySQL i have made the database and setup a dynamic page in dreamweaver and setup all the rest of the stuff but when i come to add a database to it, it dosen't work

I go to window > databases. click on the + signe then on 'MySQL Connection'.

I fill in the boxes:-
Connection name.
MySQL Server.
Username.
Password.

Then I click the button 'Select...' to get the database file.

But it comes up with an error message saying:-

"An unidentifed erorr has occurred."

I am using Dreamweaver MX and Coldfusion MX is installed aswell on my system. The MySQL program is WinMySQL v 1.4 and the normal DOS command interface of MySQL to make the databases.

My MySQL Server is on my computer so it is localhost.

I'v tryed setting the MySQL Server to my IP Address, to the dir (ie. "C:\.....mysql\" and to the 'data' dir of MySQL and the 'bin' dir aswell.) and to the URL (Like Dreamweaver uses for the 'test server') but http://localhost:X/..../mysql/ (X = what i beleive to be the PORT number(Which I have had as the one that dreamweaver uses and the one that WinMySQL uses.), (And the same dirs as above.) and still it dosen't work.

Can anyone help me please.:confused:
Thankyou.

snoopy0877
10-27-2003, 01:22 AM
I suggest you use manual php code to create connection with mysql.

$conn=mysql_connect("localhost","username","password");
if (!$conn){
echo "Could not connect to mySQL server!";
exit;
}

crypto
10-27-2003, 02:02 AM
Ok thanks for that but how do I now connect to and use my database like I want to. I have a 'Username' tsxt box name - 'username', a 'Password' password box name -'password' and a submit button name 'login' inside a form name 'loginform' on my login web page (.php.). My database name is userpass and is encrypted with - I have Both password() and md5() virtions of my database for learning perposes so if anyone could give me any code I would prefer to have both types of code. I will try now to program some cause I have an idea. I thank anyone who gives or tell me code and I find it the easyest way for me to learn and if I don't understand a part of the code I will be asking "What does x mean?". But I can understand most of it that have seen/read so far.

snoopy0877
10-27-2003, 07:56 PM
To choose the database you want to connect:

$db=mysql_select_db("databasename",$conn);
if (!$db){
echo "Could not change into the database";
exit;
}

To check user login, you use a query for check match in database

ex: $sql="select * from user where un='$un' and pss='".password($pass)."'"

$result=msql_query($sql);

if $result==true -> login sucessful
else -> login false

OK, goodluck. You must have a php tutorial for learn.

crypto
10-27-2003, 11:11 PM
Ok I know what that means and I know what that dose but where do I put it on my page? And how do i relate it to my form?

Daot Lagorille
10-29-2003, 12:09 PM
cant think of what the error might be, unless there is a conflict with the coldfusion server, but in the dreamweaver connection definition box, the server should be your ip address, nothing else. Make sure as well that you have the root username and password in there too.

crypto
10-31-2003, 05:15 PM
Ok I can now use that code in my form well my form calles the code from a different file but it just comes up with

login sucessful else -> login false

on the page every time. Why is this please?