Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

cannot connect mqsql database

maxtalkermaxtalker Posts: 5Member
hi I'm new to PHP. I use WAMP server and tried to connect MYSQL database

I create form which contain 4 text feilds

source:


Phone Number:


Reload:


Vendor:





*******************************************************************
mysql database:test
table: reload_menu
fields:id,phonenumber,vendor;
id is set to ubsigned and autoincrement
user:abc
pass:123
*******************************************************************
here is source code for update.php

<?php

$Pnumber =$_POST['txt_phone'];
$Reload =$POST['txt_reload'];
$Vendor =$POST['txt_vendor'];


$con = mysql_connect("localhost","abc","123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("test", $con);

$sql="INSERT INTO reload_menu (id, phonenumber, reload, vendor)
VALUES
('NULL','$_POST[txt_phone]','$_POST[txt_reload]','$_POST[txt_vendor]')";

if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";

mysql_close($con)

?>
********************

when I'm trying to insert record to table using form following error appears.

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'maxtalker'@'localhost' (using password: NO) in C:wampwwwoneupdate.php on line 8
Could not connect: Access denied for user 'maxtalker'@'localhost' (using password: YES)
***************************

Can anyone tell me whats the wrong with my code?

Comments

Sign In or Register to comment.