-2

Parse error: syntax error, unexpected '$query' (T_VARIABLE) in C:\xampp\htdocs\connection.php on line 15

Error i am a begginer kinda on website making but pro on visual studio programming please tell me whats wrong here. The code:

http://pastebin.com/bE1dXARC

Learning coding from youtube. If this is suspicious. Link:https://www.youtube.com/watch?v=w428f-ByczE&src_vid=YkzD5lYUsEs&feature=iv&annotation_id=annotation_169240 please help.

  • There is a semicolon (`;`) missing to end the statement the line before – kero Oct 08 '14 at 11:06
  • 3
    A pro at VS should be able to find a syntax error like this with a bit of effort. – GolezTrol Oct 08 '14 at 11:07
  • 2
    Also I would suggest finding another tutorial. `mysql_` functions are deprecated and will (likely) be removed in the future. Switch to [PDO or MySQLi](http://stackoverflow.com/questions/13569/mysqli-or-pdo-what-are-the-pros-and-cons) and learn it right from the start – kero Oct 08 '14 at 11:08
  • 1
    As above, various missing semicolons. And if you are used to visual studio, then you would be right at home using a decent php ide (phpstorm - paid, netbeans - free) that would pick up errors like this. Lastly that tutorial stinks. – Steve Oct 08 '14 at 11:10
  • 1
    Why did you add the `@` before `mysql_select_db`? It surpresses errors that might contain useful information. -edit- Steve is right, that tutorial stinks. It contains nothing but bad practises and outdated functionalities. – GolezTrol Oct 08 '14 at 11:10

4 Answers4

1

Semicolon is missing in the lines where you are echoing the queries. You have to end PHP line of code with a semicolon.

@mysql_select_db($website_information) or ("Database error number 1");

echo $query;
echo $querypass;
echo $queryemail;
Jenz
  • 8,009
  • 6
  • 38
  • 69
0

No semi-colon on line 13

@mysql_select_db($website_information) or ("Database error number 1") and

echo $query
echo $querypass
echo $queryemail 

as mentioned by @Jenz
Vickrant
  • 1,000
  • 2
  • 8
  • 15
0

There was no die() after @mysql_select_db, added that. No semicolons after line 13, 19, 20, 21, added them too.

<?php
$inputuser = $_POST["usernamelogin"];
$inputpass = $_POST["passlogin"];
$inputemail = $_POST["emaillogin"];
$usernamelogin = "";
$passlogin = "";
$emaillogin = "";
$connect = mysql_connect("localhost",$usernamelogin,$passlogin,$emaillogin);
@mysql_select_db($website_information) or die("Database error number 1");
$query = "SELECT * FROM `critical_account_information` WHERE `usernamelogin` = '$inputuser'";
$querypass = "SELECT * FROM `critical_account_information` WHERE `passlogin` = '$inputpass'";
$queryemail = "SELECT * FROM `critical_account_information` WHERE `emaillogin` = '$inputemail'";

echo $query;
echo $querypass;
echo $queryemail;

mysql_close();
?>
Yash Sodha
  • 735
  • 3
  • 13
  • excuse me, see before commenting, only my answer has `@mysql_select_db($website_information) or die("Database error number 1");` All other answers have - `@mysql_select_db($website_information) or ("Database error number 1")` – Yash Sodha Oct 08 '14 at 11:33
  • And this what happens when you just write a block of code without any explanation or information. Anyway Good,it is worth mentioning . Please add some line before code justifying how you code is different and efficient than others – krishna Oct 08 '14 at 11:37
  • Okay, thanks for letting me know. :) I added a bit on information of the code. – Yash Sodha Oct 08 '14 at 11:41
-3

You cann't put the query results directly in a variable. You need to use mysql_query() php function for the query and mysql_fetch_array() to get the results...

See this links:

http://php.net/manual/en/function.mysql-query.php
http://php.net/manual/en/function.mysql-fetch-array.php