I am trying to get some data out of my database for the first time, but for some reason it won't work. Here's my code:
$dbc = mysql_connect('censored', 'censored', 'censored', 'censored')
or die ('Error connecting to MySQL server.');
$query = "SELECT * FROM apparel_img";
$result = mysqli_query($dbc, $query)
or die('Error querying database.');
while($row = mysqli_fetch_array($result)) {
$product= $row['product'];
$colour = $row['colour'];
$file = $row['small'];
echo '$product . $colour . $file';
}
mysqli_close($dbc);
I keep getting the 'Error querying database' line (I DO connect to the server), but am sure that the provided table exists.
Thanks in advance!
EDIT: Unfortunately I can't add images yet.
您正在使用mysql_connect连接到数据库,但是使用mysqli_ *运行查询并与数据进行交互。您不能将两者混用。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.