Forum Moderators: coopster

Message Too Old, No Replies

parse error line 20... please help.

         

Flolondon

12:41 pm on Jun 14, 2005 (gmt 0)

10+ Year Member




Parse error: parse error in c:\program files\easyphp1-8\www\validate-email.php on line 20

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php

if (!isset($_GET['email'])){$email = '';}else{$email= $_GET['email'];} // email
if (!isset($_GET['password1'])){$password1 = '';}else{$password1= $_GET['password1'];} // password1
if (!isset($_GET['password2'])){$password2 = '';}else{$password2= $_GET['password2'];} // password2

mysql_connect ("localhost","root","");
$result = mysql_query ( "select * from 'emailvalidate'
where name = '$email','$password1','$password2' );
if ($result) {
if (mysql_num_rows ($result) > 0) {
print "It looks like youre already signed up with us! <br>\n";
$found = true;
}

}
if ($found == false) {

if ($result) {
print "<h1> Thank you! </h1>" ;
}

else {

print "Something went wrong? please contact us!";
}

}
mysql_close();

?>
</body>
</html>

mcibor

1:37 pm on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The error appeared because you didn't finish the query with double quote. However you have a bad query there as well - mysql will give you an error. See the WHERE clause, you have WHERE name='$email' and then what? This should be proper:

mysql_connect ("localhost","root","");
$query = "select * from emailvalidate where name='$email' AND pass1='$password1' AND pass2='$password2'";//I don't know what is your db structure, so this is only an example
if($result = mysql_query($query)) {
if (mysql_num_rows ($result) > 0) {
print "It looks like you're already signed up with us! <br>\n";
$found = true;
}

Hope this helps
Michal Cibor

PS. Do you store redundant data in db (pass1, pass2)? You shouldn't! Check with php if they are the same.

dreamcatcher

1:45 pm on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

Whats the problem exactly?

What is this line doing?

$result = mysql_query

[edited by: jatar_k at 4:13 pm (utc) on June 14, 2005]
[edit reason] multiple thread splice [/edit]

mincklerstraat

6:50 am on Jun 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey Flolondon, you know you'll get a lot better help here if you're able to be a bit more concise with what your problem is, and show that you've done your own homework in trying to figure out what's wrong. Check out [webmasterworld.com...] and the forum charter for how to do this kind of stuff.

Happy coding!

mcibor

8:10 am on Jun 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Don't you guys read answers? The problem was in line with the query. Flondon didn't finish the quotation ", so the string was till print " and then certainly error.

Read answers as well!
Michal Cibor

dreamcatcher

2:55 pm on Jun 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mcibor, yes we do. This thread was started twice and the moderator has since spliced the two threads together. Our posts was for the original post.

coopster

3:04 pm on Jun 15, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



<edit>I was just going to clarify -- thanks, DC</edit>

Thanks DC for the very kind clarification.

jatar_k

5:21 pm on Jun 15, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



sorry my fault dreamcatcher

read the 2 threads quickly, didn't see the error wasn't quoted in the other one

dreamcatcher

10:36 pm on Jun 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No problem guys. :)