使用php和sql将数据添加到数据库时出现问题
所以我尝试使用php和mysql将数据放入我网站上的数据表中。我在文件顶部写了一些代码,以确认我正确访问了数据库。当我手动输入一些数据时,该表显示正确,但使用我的php代码,该表显示“表中没有可用数据”。我的php有什么问题吗使用php和sql将数据添加到数据库时出现问题,php,mysql,twitter-bootstrap,datatables,Php,Mysql,Twitter Bootstrap,Datatables,所以我尝试使用php和mysql将数据放入我网站上的数据表中。我在文件顶部写了一些代码,以确认我正确访问了数据库。当我手动输入一些数据时,该表显示正确,但使用我的php代码,该表显示“表中没有可用数据”。我的php有什么问题吗 $q = "SELECT tickets.ticket_id, tickets.section, tickets.row, tickets.price, users.first_name as first_name, users.last_name as last
$q = "SELECT tickets.ticket_id, tickets.section, tickets.row, tickets.price, users.first_name as first_name, users.last_name as last_name
FROM tickets
LEFT JOIN users
ON tickets.seller_id = users.umid
Where(tickets.game_id = '$g')";
$r = @mysqli_query ($dbc, $q);
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Section</th>
<th>Row</th>
<th>Price</th>
<th>Seller</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
echo '
<tr>
<td>'.$row["section"].'</td>
<td>'.$row["row"].'</td>
<td>'.$row["price"].'</td>
<td>'.$row["first_name"]. " ". $row["last_name"]. '</td>
</tr>
';
}
?>
</tbody>
</table>
$q=“选择tickets.ticket\u id、tickets.section、tickets.row、tickets.price、users.first\u name作为first\u name,users.last\u name作为last\u name
从票上
左加入用户
在tickets.seller\u id=users.umid上
其中(tickets.game_id='$g')”;
$r=@mysqli_查询($dbc,$q);
部分
一行
价格
卖方
解决了这个问题。我在代码的前面循环了我的行,因此当我想将信息放入表中时,它位于数组的末尾。运行时是否会出现任何错误..?表中没有可用数据的条件是什么??显示$rDon的内容不使用
@
,这只是对你隐藏了有用的错误。我在帖子中更新了我的代码