473,378 Members | 1,209 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

about php error called Parse error: syntax error, unexpected '&&' (T_BOOLEAN_AND), ex

1
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();  //register the session.
  3. if(isset($_POST['username']&&$_POSt['password']))  //if whethere the username and password is not set.
  4. {
  5. $username=$_POST['username'];      //assign $username variable to the sent username.
  6. $password=md5($_POST['password']); //make encycrpit the password.
  7. $conn=mysql_connec("localhost","root") or die(mysql_error()); //make connection.
  8. $mysql_select_db("system",$conn) or die(mysql_error()); // select the database.
  9. $sql="select * from instructor where username='$username' and password='$password'";//write the query.
  10. $result=mysql_query($sql,$conn);     //run the query.
  11. if(mysql_num_rows($result)==1)      // check that the number of row is 1 or not if 1 it is correct.
  12. {
  13. echo"you are successfully login as".$username;
  14. //<a href="http://bytes.com/logoutpage.php">logout</a><br>  //create a link.
  15. //<a href="http://bytes.com/registrationform.php">register<a>  //create alink.
  16. }
  17. else
  18. {
  19. echo"wrong password or username please try again";
  20. header("location:main.php"); //redirect to the main.php.
  21. }
  22. }
  23. else
  24. {
  25. echo"you must enter the required information";
  26. }
  27.  
  28.  ?>
this is the code but it displays an error on line 3 the error is called Parse error: syntax error, unexpected '&&' (T_BOOLEAN_AND), expecting ',' or ')' in C:\wamp\www\try1\open.php on line 3
Aug 30 '13 #1
2 5246
Expand|Select|Wrap|Line Numbers
  1. if(isset($_POST['username']&&$_POSt['password']))
should read
Expand|Select|Wrap|Line Numbers
  1. if ((isset($_POST['username']) && (isset($_POST['password']))
i hope you're sanitizing your input - using POSTs directly like this invite problems :-)
Aug 30 '13 #2
Dormilich
8,658 Expert Mod 8TB
note: isset() allows to check multiple variables at once.
Expand|Select|Wrap|Line Numbers
  1. if (isset($_POST['username'], $_POST['password']))
Sep 1 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Steve | last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way. ...
6
by: Euripides J. Sellountos | last post by:
Hello kind people. I hope you can you help me with the following problem. The following snippet fails to compile with g++. (It compiles fine with other compilers.) All I want to do is to throw...
2
by: Bob Alston | last post by:
I am going blind tonight but I cannot figure out the error. I get a syntax error from this sql statement, being run via vba in access 2003 insert into tbl_Volunteer_Donor in...
7
by: John Øllgård Jensen | last post by:
Hi Using MS Asccess 2000: In a query I'm trying to create a new field with following expression: FilmDate: Left(,4) The field "FilmNo" is another text field in the query. This is...
1
by: munkis29 | last post by:
Hey All, I wrote this code in SQL View Query window but when I try to save it, I get an error box that says "Syntax Error in FROM clause" I've tried a few different variations in the syntax but...
1
by: den2005 | last post by:
Hi everybody, I am new in javascript. I am working on resizing a control like Image by dragging it to a desired size at runtime. Now, my onmouseover event is working ok where the cursor type...
2
by: technocraze | last post by:
Hi guys, I have encountered this error when updating the values to the MS Acess table. Error : Update on linked table failed. ODBC sql server error Timeout expired. MS Acess is my front end and...
3
by: SilvaZodiac | last post by:
Hi everyone, I'm still rather new to PHP code, and I have a syntax error. I've tried several different solutions, but it won't fix. It seems to suggest that I need a new bracket somewhere in the...
2
by: HalfCoded | last post by:
Hi everyone, I am currently working at learning perl but come up with two problems i can't clear on my own. I use perl version 5.8 on windows xp The complete I am working on is supposed to...
3
by: Ananthu | last post by:
Hi I have created one website named OTMS using ASP.NET in a File System Format.My project location is in F: drive(F:\Project\OTMS). I have installed IIS properly and the website runs properly in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.