[Nfb-web] Wamp Server, LocalHost and Passwords Php Help

Marvin Hunkin startrekcafe at gmail.com
Mon Dec 12 04:46:58 UTC 2011


hi.
doing a website development course from http?wsi.tafensw.edu.au, and 
doing php.
and the lecturers are on vacation.
so, working my way through this subject.
and so up to inserting data into a database, using php and my sql, in a 
form.
now.
got this stupid error, which i will paste below.
and my code.
and the form.
can any one help?
getting a access denied localhost and password error.
how do i fix this?
using wamp server 2.2.
bagning my head, looked up google, and tried to update my sql server, in 
the my sql command line prompt.
tried to clear the cache, but no success.
can any one help me out.
so what code, or what sql commands do i need to use, and where?
using wamp server, and looked in the php my admin, my database is there, 
with the table i created.
so, just totally frustrated.
if any one can help.
let me know.
Marvin.
ps: the lecturers are on vacation till early febuary.
would like an answer to my problem.
using windows 7 professional, 32 bit, jaws 13, using wamp server 2.2, my 
sql 5.5.16, php 5.35, latest version.
can any one help.
so how to reset the password for the local host.
that is what i am looking for.
just totally frustrated.
rewrote the code for this weeks exercise from my lecturer a few times, 
but still giving me the error.
and learning, php, and my sql.
can any one help?
this is giving me a migrain.
Marvin, from Devonport, Tasmania, Australia.
if any aussies on the list, maybe can give me a hand.

<?php
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$phone=$_POST['phone'];
$dateofbirth=$_POST['dateofbirth'];
$server="localhost";
$user="root";
$password="pwd";
$database="AddressBook";
$connection=mysql_connect($server, $user, $password);
$dbOK=@mysql_select_db($database, $connection) or die ("Unable to select 
db");
$sql = "INSERT INTO tperson (firstname, lastname, phone, dateofbirth) 
VALUES ('$firstname', '$lastname', '$phone', '$dateofbirth')";
$result = mysql_query($sql, $connection) or die ("Error in query: 
".mysql_error());
mysql_close();
?>

ps: will http://localhost/FifthPHP/Data.php

table with 5 columns and 5 rows
( ! ) Warning: mysql_connect() [
function.mysql-connect]:
Access denied for user 'root'@'localhost' (using password: YES) in 
C:\wamp\www\FifthPHP\Data.php on line 10
Call Stack
#
Time
Memory
Function
Location
1
0.0006
373088
{main}( )
..\Data.php:0
2
0.0006
373768
mysql_connect
  ( )
..\Data.php:10
table end

Unable to select db

ps:: will paste the html form code below as well.

<html>
<head>
<title>Person Details</title>
</head>
<body>
<form action="Data.php" method="post">
Firstname: <input type="text" name="firstname">
Lastname: <input type="text" name="lastname">
Phone: <input type="text" name="phone">
Date Of Birth : <input type="text" name="dateofbirth">
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>




More information about the NFB-Web mailing list