Note that there are some explanatory texts on larger screens.

plurals
  1. POphp - mysql fetch array (LIKE%)
    text
    copied!<p>I have a php file which fetch and print data from my mysql table. here is the code..</p> <pre><code>&lt;?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)); } ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta content="en-us" http-equiv="Content-Language"&gt; &lt;meta content="text/html; charset=utf-8" http-equiv="Content-Type"&gt; &lt;title&gt;Results&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;table align="center" style="width: 80%" class="style4" cellpadding="1px" cellspacing="1px"&gt; &lt;tr&gt; &lt;td class="style19"&gt;Resource ID&lt;/td&gt;&lt;td class="style19"&gt;ISBN&lt;/td&gt;&lt;td class="style19"&gt;Title&lt;/td&gt;&lt;td class="style19"&gt;Author&lt;/td&gt;&lt;td class="style19"&gt;Publisher&lt;/td&gt;&lt;td class="style19"&gt;Year&lt;/td&gt;&lt;td class="style19"&gt;Edition&lt;/td&gt;&lt;td class="style19"&gt;Language&lt;/td&gt;&lt;td class="style19"&gt;Type&lt;/td&gt;&lt;td class="style19"&gt;Price&lt;/td&gt;&lt;td class="style19"&gt;Location&lt;/td&gt;&lt;td class="style19"&gt;Abstract&lt;/td&gt;&lt;td class="style19"&gt;Availability&lt;/td&gt;&lt;td class="style19"&gt;Last Issued&lt;/td&gt;&lt;td class="style19"&gt;Last Received&lt;/td&gt;&lt;td class="style19"&gt;Loan To&lt;/td&gt; &lt;/tr&gt; &lt;?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 ' &lt;tr&gt; &lt;td class="style20"&gt;' . $RID . '&lt;/td&gt; &lt;td class="style20"&gt;' . $ISBN . '&lt;/td&gt; &lt;td class="style20"&gt;' . $Title . '&lt;/td&gt; &lt;td class="style20"&gt;' . $Author . '&lt;/td&gt; &lt;td class="style20"&gt;' . $Publisher . '&lt;/td&gt; &lt;td class="style20"&gt;' . $Year . '&lt;/td&gt; &lt;td class="style20"&gt;' . $Edition . '&lt;/td&gt; &lt;td class="style20"&gt;' . $Language . '&lt;/td&gt; &lt;td class="style20"&gt;' . $Type . '&lt;/td&gt; &lt;td class="style20"&gt;' . $Price . '&lt;/td&gt; &lt;td class="style20"&gt;' . $Location . '&lt;/td&gt; &lt;td class="style20"&gt;' . $Abstract . '&lt;/td&gt; &lt;td class="style20"&gt;' . $Availability . '&lt;/td&gt; &lt;td class="style20"&gt;' . $Issue . '&lt;/td&gt; &lt;td class="style20"&gt;' . $Receive . '&lt;/td&gt; &lt;td class="style20"&gt;' . $User . '&lt;/td&gt; &lt;/tr&gt; '; } ?&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The problem is, The query is skipping (or not giving) data from the first row. Everything else works fine..</p> <p>I am using</p> <p>Apache/2.2.13 (Win32) PHP/5.3.0</p> <p>MySQL client version: mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.27 $</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload