-5

I have created a table 'details'-

FNAME-First name
LNAME-Last name
PHONE- Phone number
BIRTHDAY- Birthday

I have a html file with form,login.html-

<form action="check.php" method="post">
<input type="text" name="phone">
<input type="submit" value="login"></form>

I have php file checking this with mysql database,check.php

<? $PHONE=$_POST['phone']
mysql_connect//My db details here
$query=SELECT FNAME,LNAME FROM 'details' WHERE PHONE='$PHONE' ?>

But the above php code shows error,I think i'm going wrong somewhere, any one can help? Thanks in advance.

1 Answers1

2

You giving an incorrect quotes to table name (change single quotes to backticks `),

$query = "SELECT FNAME,LNAME FROM `details` WHERE PHONE='$PHONE'";

Note: Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO, or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Rikesh
  • 26,156
  • 14
  • 79
  • 87