Jeff North wrote:[color=blue]
> On Wed, 27 Jul 2005 19:02:18 +0100, in mailing.database.mysql
> Newsscanner <frankied@NOSPAM.netvigator.co.uk> wrote:
>
>[color=green]
>>| Hello,
>>| I am learning PHP/MySQL at the moment.
>>| I found what looked like an excellent tutorial site, but the first
>>| program I wrote already left me with an error to which I cannot find an
>>| answer.
>>| I typed in the following program:
>>| <html>
>>| <head><title>Connect Server</title></head>
>>| <body>
>>| <?
>>| $link =
>>| mysql_connect("localhost",$_POST['username'],$_POST['password'])or
>>| die("Connect Error: ".mysql_error());
>>| print "Successfully connected.\n";
>>| mysql_close($link);
>>| ?>
>>| </body>
>>| </html>
>>| Iobviously typed in my own username and password instead of 'username'
>>| and 'password' in the line
>>| "mysql_connect("localhost",$_POST['username'],$_POST['password'])or...."
>>|
>>| However, I keep getting the following error when running it from my
>>| browser:
>>| "Parse error: syntax error, unexpected T_VARIABLE in C:\Program
>>| Files\Abyss Web Server\htdocs\logon.php on line 5"
>>|
>>| Can anyone enlighten me please ?
>>| I use PHP v 5.1.1.0 and MySQL v 4.1.13
>>|
>>| Any help will be much appreciated.
>>| TIA,
>>| Newsscanner.[/color]
>
>
> You should have another form with 2 input boxes (Username and
> Password).
> This other form should have the following html code:
> <form name="???" action="login.php" method="post">
> User Name <input type="text" name="username" value="" />
> User Name <input type="password" name="password" value="" />
> <input type="Submit" value="Submit" />
> </form>
>
> If this is not the case then in your login.php file then change
> $_POST['username'] and $_POST['password'] to the information that you
> want to use i.e.
> mysql_connect("localhost",'myUsername','myPassword ')
> ---------------------------------------------------------------
>
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
> ---------------------------------------------------------------[/color]
I do, but when I slot it in, as in this:
"<html>
<head><title>Connect Server</title></head>
<body>
<?
$link = mysql_connect("localhost",$_POST['*****'],$_POST['********'])or
die("Connect Error: ".mysql_error());
print "Successfully connected.\n";
mysql_close($link);
?>
<form method="POST" action="kiekteki.php">
Enter Username: <input type="text" name="username" size="20">
Enter Password:<input type="password" name="password" size="20">
<input type="submit" value="Submit"><input type="reset">
</form>
</body>
</html>"
I get the following errors in the browser:
"Notice: Undefined index: ****** in C:\Program Files\Abyss Web
Server\htdocs\kiekteki.php on line 5
Notice: Undefined index: ******** in C:\Program Files\Abyss Web
Server\htdocs\kiekteki.php on line 5
Warning: mysql_connect() [function.mysql-connect]: Access denied for
user 'ODBC'@'localhost' (using password: NO) in C:\Program Files\Abyss
Web Server\htdocs\kiekteki.php on line 5
Connect Error: Access denied for user 'ODBC'@'localhost' (using
password: NO)"
(Once again, the stars in the text were put there by me for security
reasons as they revealed my password etc.)
Thanks,
Newsscanner.