I created a table that contains Names, products, and jobs, I want to select from that table where names = $name and jobs = $job How can I do this in PHP Thanks
问问题
106 次
3 回答
1
像这样的东西?
只需获取这样的变量
$names = $_GET['names']
if ($stmt = $mysqli->prepare("SELECT names, products, jobs FROM tablename WHERE names=? AND jobs=?")) {
/* Bind our params */
$stmt->bind_param("ss", $names, $jobs);
/* execute query */
$stmt->execute();
/* bind result variables */
$stmt->bind_result($names, $products, $jobs);
/* fetch value */
$stmt->fetch();
$stmt->close();
}
于 2013-06-29T18:39:47.073 回答
0
mysqli_query(" SELECT * FROM myTable WHERE name='{$name}' AND jobs='{$job}'");
于 2013-06-29T18:37:11.047 回答
0
我希望你有你的数据库连接设置。您可以使用此查询来选择信息:
mysql_query("SELECT * FROM <tablename> WHERE names = '". $names ."' AND jobs = '". $job ."' ");
比约恩。
于 2013-06-29T18:37:23.513 回答