-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.

4

1 回答 1

2

您为表名提供了不正确的引号(将单引号更改为反引号`),

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

注意: 请不要mysql_*在新代码中使用函数。它们不再被维护并被正式弃用。看到红框了吗?改为了解准备好的语句,并使用PDOMySQLi -本文将帮助您决定使用哪个。如果您选择 PDO,这里有一个很好的教程

于 2013-06-21T07:52:48.600 回答