ok trying to connect to mysql db, i got it working but have some questions
this is on a xp box
i am running mysql 4.1.7
i am running apache 1.3
i am running php 4.3.1 for win
i was getting an authentication error, and i was reading this due to the new password algorithm in mysql 4.1 and was told to use
SET PASSWORD FOR 'test'@'%' = OLD_PASSWORD('1234'); at the sql prompt
this allowed me in the db, but my question
i was reading that having the new version of php, which i thought i had, i would not have to use the above coding to get it too work, i would like to use the new hashing, and not have to manually input this code for everyuser, could someone explain in newbie terms how to fix this problem?
mysql connecting questions -newbie be warned
Moderator: General Moderators
-
LittleBill
- Forum Newbie
- Posts: 12
- Joined: Wed Jan 26, 2005 10:42 pm
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
well ok. if your trying to connect to a db through php you would actually use somtin like
try something like that?
Code: Select all
$dbhost = 'localhost';
$dbusername = ****';
$dbpassword = '****';
$dbname = '****';
$connect = mysql_connect($dbhost, $dbusername, $dbpassword) or die ('Cant connect to MySQL');
mysql_select_db($dbname,$connect) or die ("Could not select database");-
LittleBill
- Forum Newbie
- Posts: 12
- Joined: Wed Jan 26, 2005 10:42 pm
this what i have
<html>
<head><title>Connect Server</title></head>
<body>
<?
$link = mysql_connect("211.102.211.21:3306","test","1234")or die("Connect Error: ".mysql_error());
print "Successfully connected.\n";
mysql_select_db(php , $link)
or die("Couldn't open $db: ".mysql_error());
print "Successfully connected to db.\n";
mysql_query ("INSERT INTO data (number ) VALUES ('21')");
print "Successfully inserted to db.\n";
mysql_close($link);
?>
</body>
</html>
this is what i am using and it is working, although right now after running it once it will not keep adding 21 to the db, its done it only once so im having that issue now, but i still need to figure why i need that set password command i spoke above before, also my /n in my print command is not working, its running the message straight across the page
<html>
<head><title>Connect Server</title></head>
<body>
<?
$link = mysql_connect("211.102.211.21:3306","test","1234")or die("Connect Error: ".mysql_error());
print "Successfully connected.\n";
mysql_select_db(php , $link)
or die("Couldn't open $db: ".mysql_error());
print "Successfully connected to db.\n";
mysql_query ("INSERT INTO data (number ) VALUES ('21')");
print "Successfully inserted to db.\n";
mysql_close($link);
?>
</body>
</html>
this is what i am using and it is working, although right now after running it once it will not keep adding 21 to the db, its done it only once so im having that issue now, but i still need to figure why i need that set password command i spoke above before, also my /n in my print command is not working, its running the message straight across the page
-
LittleBill
- Forum Newbie
- Posts: 12
- Joined: Wed Jan 26, 2005 10:42 pm
-
LittleBill
- Forum Newbie
- Posts: 12
- Joined: Wed Jan 26, 2005 10:42 pm
its working well, here is what i have so far
this is a sendmail.php that is running off another form i created
feyd | use formatting!
this is a sendmail.php that is running off another form i created
Code: Select all
<?
$email = $_REQUESTї'email'] ;
$message = $_REQUESTї'message'] ;
$fname = $_REQUESTї'fname'] ;
$lname = $_REQUESTї'lname'] ;
mail( "littlebill@littlebill.shacknet.nu", "Feedback Form Results",
" First Name $fname \n Last Name $lname\n $message", "From: $email" );
$link = mysql_connect("211.102.211.21:3306","test","1234")or die("Connect Error: ".mysql_error());
print "Successfully connected.\n";
mysql_select_db(php , $link)
or die("Couldn't open $db: ".mysql_error());
print "Successfully connected to db.\n";
mysql_query ("INSERT INTO data (email,first,last,message ) VALUES ('$email','$fname','$lname','$message')");
print "Successfully inserted to db.\n";
mysql_close($link);
?>feyd | use formatting!
-
LittleBill
- Forum Newbie
- Posts: 12
- Joined: Wed Jan 26, 2005 10:42 pm