MySQL查询只从表中获取一行

时间:2015-05-11 23:13:09

标签: php mysql

以下代码似乎只是抓取数组中的一行信息,当我希望它抓取整个列时。

$id = null;
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
//declare variables
$countr = null;
$sql = "SELECT * FROM `convert`";
$drippage = mysqli_query($conn, $sql); // <-- that quote; change members to whatever the table is 
//this counts the number of rows
if (mysqli_num_rows($drippage)) {
    $countr = mysqli_num_rows($drippage);
}
$ToAndFrom = mysqli_query($conn, "SELECT ToAndFrom FROM `convert`");

$ToAndFromR = mysqli_fetch_array($ToAndFrom, MYSQLI_BOTH);

$Formula = mysqli_query($conn, "SELECT Formula FROM `convert`");
$FormulaR = mysqli_fetch_array($Formula, MYSQLI_BOTH);

0 个答案:

没有答案