У меня есть php-файл, который извлекает и печатает данные из моей таблицы mysql. здесь код ..php - mysql fetch array (LIKE%)
<?php
{
$username = 'root';
$bookid = "GCK";
$con = mysql_connect("localhost","root","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("library", $con);
$query3 = "SELECT * FROM GCKcatalogue WHERE BookID LIKE'%$bookid%'";
$numresults=mysql_query($query3);
$numrows=mysql_num_rows($numresults);
$result3 = mysql_query($query3);
($info3 = mysql_fetch_array($result3));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="en-us" http-equiv="Content-Language">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Results</title>
</head>
<body>
<table align="center" style="width: 80%" class="style4" cellpadding="1px" cellspacing="1px">
<tr>
<td class="style19">Resource ID</td><td class="style19">ISBN</td><td class="style19">Title</td><td class="style19">Author</td><td class="style19">Publisher</td><td class="style19">Year</td><td class="style19">Edition</td><td class="style19">Language</td><td class="style19">Type</td><td class="style19">Price</td><td class="style19">Location</td><td class="style19">Abstract</td><td class="style19">Availability</td><td class="style19">Last Issued</td><td class="style19">Last Received</td><td class="style19">Loan To</td>
</tr>
<?php
while($info3 = mysql_fetch_array($result3)){
$RID = $info3["BookID"];
$ISBN = $info3["ISBN"];
$Title = $info3["Title"];
$Author = $info3["Author"];
$Publisher = $info3["Publisher"];
$Year = $info3["Year"];
$Edition = $info3["Edition"];
$Language = $info3["Language"];
$Type = $info3["Type"];
$Price = $info3["Price"];
$Location = $info3["Location"];
$Abstract = $info3["Abstract"];
$Availability = $info3["Availability"];
$Issue = $info3["IssueDate"];
$Receive = $info3["ReceiveDate"];
$User = $info3["User"];
echo '
<tr>
<td class="style20">' . $RID . '</td>
<td class="style20">' . $ISBN . '</td>
<td class="style20">' . $Title . '</td>
<td class="style20">' . $Author . '</td>
<td class="style20">' . $Publisher . '</td>
<td class="style20">' . $Year . '</td>
<td class="style20">' . $Edition . '</td>
<td class="style20">' . $Language . '</td>
<td class="style20">' . $Type . '</td>
<td class="style20">' . $Price . '</td>
<td class="style20">' . $Location . '</td>
<td class="style20">' . $Abstract . '</td>
<td class="style20">' . $Availability . '</td>
<td class="style20">' . $Issue . '</td>
<td class="style20">' . $Receive . '</td>
<td class="style20">' . $User . '</td>
</tr>
';
}
?>
</table>
</body>
</html>
Проблема заключается в том, Запрос пропускает (или не давать) данные из первой строки. Все остальное работает отлично ..
Я использую
Apache/2.2.13 (Win32) PHP/5.3.0
MySQL версии клиента: mysqlnd 5.0.5-DEV - 081106 - $ Revision: 1.3.2.27 $
если я удалю эту строку, как я могу получить данные? –
Вы уже получаете данные в строке 'while ($ info3 = mysql_fetch_array ($ result3)) {'. –
Можете ли вы изменить скрипт для меня ?? я застрял ..: P –