PHP - 如何从表中选择查询= $ query和query2 = $ query2 [关闭]

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

I hope you got your database connection setup. You can use this query to select the information:

mysql_query("SELECT * FROM <tablename> WHERE names = '". $names ."' AND jobs = '". $job ."' ");

Bjorn.

mysqli_query(" SELECT * FROM myTable WHERE name='{$name}' AND jobs='{$job}'");

Something like this?

And just GET the variables like this

$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();
}