Jump to content

[SOLVED] very easy form question


drob2689

Recommended Posts

Im just starting out learning PHP. Im trying to build a form and submit it. I am adding 5 files:

 

login.html

login.php

registration.html

register.php

memberspage.php

 

ok, so the registration works and sends the data to mysql.

 

however when i try to login, i get the message:

 

Parse error: syntax error, unexpected T_STRING in /home/jeupcom/public_html/login.php on line 19

 

firstly, can someone interperet this error message for us

 

 

here is the code with line 19 in bold.

 

 

<?php

 

//Database Information

 

$dbhost = "localhost";

$dbname = "jeupcom_tip";

$dbuser = "jeupcom_david";

$dbpass = "";

 

//Connect to database

 

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());

mysql_select_db($dbname) or die(mysql_error());

 

session_start();

$username = $_POST[‘username’];

$password = md5($_POST[‘password’]);

 

$query = “select * from users where username=’$username’ and password=’$password’”;

 

$result = mysql_query($query);

 

if (mysql_num_rows($result) != 1) {

$error = “Bad Login”;

    include “login.html”;

 

} else {

    $_SESSION[‘username’] = “$username”;

    include “memberspage.php”;

}

 

?>

 

 

 

 

thanks very much

 

Link to comment
https://forums.phpfreaks.com/topic/159045-solved-very-easy-form-question/
Share on other sites

You are apparently using a word processor or a Mac to attempt to write code with. You have "smart/curly" quotes on that line and some of the other later lines of code.

 

You need to use a programming editor and use only " and ' for quotes.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.