Need password for insert? Need help ASAP please
Posted by: sofia (---.bornet.net)
Date: June 27, 2006 07:13AM

I do not use a password for my database, which works fine with SELECT-queries, but not with INSERT-queries as I get this error when I try to insert data through a script.

I use the latest version of Wamp and need a solution to this ASAP (preferably yesterday winking smiley)

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\wamp\www\directory\insert_db.php on line 2
Could not connect: Access denied for user 'root'@'localhost' (using password: YES)

This is a sample of my INSERT-code:

<?php
$con = mysql_connect("localhost","root","hmhm"winking smiley;
if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_db("autoliv", $con);

$sql="INSERT INTO author
(au_id,au_lname, au_fname, affiliate)
VALUES
('$_POST[au_id]','$_POST[au_lname]','$_POST[au_fname]' '$_POST[affiliate]')";

Options: ReplyQuote
Re: Need password for insert? Need help ASAP please
Posted by: CyberSpatium (67.170.181.---)
Date: June 27, 2006 09:10PM

change
$con = mysql_connect("localhost","root","hmhm"winking smiley;

to
$con = mysql_connect("localhost","root",null);

Options: ReplyQuote
Re: Need password for insert? Need help ASAP please
Posted by: Graven (---.ipt.aol.com)
Date: June 28, 2006 11:20AM

ahh Thank you so much, I've not been able to use msql for about 4 days because I couldn't connect!

Options: ReplyQuote
Re: Need password for insert? Need help ASAP please
Posted by: CyberSpatium (67.170.181.---)
Date: June 28, 2006 11:34AM

yeah, the WAMP comes with thedefault root mysql user set with no password, so use null.

Options: ReplyQuote


Sorry, only registered users may post in this forum.