如何使用php搜索起始地点到交货地点
我正在使用php创建一个网页,在这个网页中,我必须使用php搜索从起始地点到交货地点的详细信息,这可能吗 我的代码如下: index.php如何使用php搜索起始地点到交货地点,php,mysql,Php,Mysql,我正在使用php创建一个网页,在这个网页中,我必须使用php搜索从起始地点到交货地点的详细信息,这可能吗 我的代码如下: index.php <form id="contactForm" action="index.php" novalidate> <label>Starting Place</label> <input type="text" name="starting_place" placeholder="Enter Starting
<form id="contactForm" action="index.php" novalidate>
<label>Starting Place</label>
<input type="text" name="starting_place" placeholder="Enter Starting Place">
<label>Starting Place</label>
<input type="text" name="delivery_place" placeholder="Enter Starting Place">
<input type="submit" name="search" value="search">
</form>
<?php
include 'db.php';
if(isset($_POST['search']))
{
$sql = mysql_query("select * from place where "); // this is my question
while($row = mysql_fetch_array($sql))
{
echo $row['starting_place'];
echo $row['delivery_place'];
}
}
?>
起点
起点
我认为你的查询不好
$sql =mysql_query("select * from place where ");
也许你喜欢这样的东西
$search = $_POST['search'];
$sql =mysql_query("select * from `place` where `starting_place` = '$search' ");
完整的php代码
include 'db.php';
if(isset($_POST['search']))
{
$search = $_POST['search'];
$sql =mysql_query("select * from `place` where `starting_place` = '$search' ");
while($row = mysql_fetch_array($sql))
{
echo $row['starting_place'];
echo $row['delivery_place'];
}
}
我认为你的问题不好
$sql =mysql_query("select * from place where ");
也许你喜欢这样的东西
$search = $_POST['search'];
$sql =mysql_query("select * from `place` where `starting_place` = '$search' ");
完整的php代码
include 'db.php';
if(isset($_POST['search']))
{
$search = $_POST['search'];
$sql =mysql_query("select * from `place` where `starting_place` = '$search' ");
while($row = mysql_fetch_array($sql))
{
echo $row['starting_place'];
echo $row['delivery_place'];
}
}
mysql.*
已弃用,请改用mysqli.*或
pdo`
检查此查询:
$start = $_POST['starting_place'];
$end = $_POST['delivery_place'];
$sql = mysql_query("select * from place where starting_place = $start and ending_place = $end ");
mysql.*
已弃用,请改用mysqli.*或
pdo`
检查此查询:
$start = $_POST['starting_place'];
$end = $_POST['delivery_place'];
$sql = mysql_query("select * from place where starting_place = $start and ending_place = $end ");
你的问题不是很清楚。我假设您只有一个输入字段:
<form id="contactForm" action="index.php" novalidate>
<label>Starting Place</label>
<input type="text" name="starting_place" placeholder="Enter Starting Place">
<input type="submit" name="search" value="search">
</form>
你的问题不是很清楚。我假设您只有一个输入字段:
<form id="contactForm" action="index.php" novalidate>
<label>Starting Place</label>
<input type="text" name="starting_place" placeholder="Enter Starting Place">
<input type="submit" name="search" value="search">
</form>
两个输入都是起始位置??抱歉,这是交货_place@niranjanboth输入是起始位置??抱歉,这是交货_place@niranjani需要从起始地点到交货地点进行筛选_place@Standejhow您的意思是将交货地点筛选到起始地点吗@Gokulgiri也许你的意思是:$sql=mysql\u query(“选择*from
place
wheredelivery\u place
='$search'”);我需要从一开始就过滤到交货地点_place@Standejhow您的意思是将交货地点筛选到起始地点吗@Gokulgiri也许你的意思是:$sql=mysql\u query(“选择*fromplace
wheredelivery\u place
='$search'”);是的,它正在工作,但我需要筛选起始地点到交货地点以及如何回显此功能您是否更改了拼写错误??很高兴我可以帮助您:)是的,它正在工作,但我需要筛选起始地点到交货地点以及如何回显此功能您是否更改了拼写错误??很高兴我可以帮助您:)