473,386 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to solve Warning: mysql_num_rows() expects parameter 1 to be resource

Expand|Select|Wrap|Line Numbers
  1.     <?php 
  2.         if(isset($_POST['submit']))
  3.         {
  4.             $regNumber=trim($_POST['txtReg']);
  5.  
  6.             $qry="SELECT * FROM tblscore WHERE Registration_Number='$regNumber'";
  7.             $run=mysql_query($qry,$connection)or die("Database Error");
  8.  
  9.  
  10.             if(mysql_num_rows($qry)<1) 
  11.             {
  12.  
  13.             echo "<script> alert('No matches found');</script>";
  14.             }
  15.  
  16.             while($row=mysql_fetch_array($run))
  17.             {
  18.                 $regustrationNo=$row[1];
  19.                 $Viva=$row[2];
  20.                 $degree=$row[3];
  21.                 $written=$row[4];
  22.                 $Total=$row[5];
  23.  
  24.                 ?>
  25.  
  26.             <table cellspacing="2px" cellpadding="10px" align="center" border="1px">
  27.  
  28.             <tr>
  29.             <th>Registration Number </th>
  30.             <th>Viva Marks</th>
  31.             <th>Degree Marks</th>
  32.             <th>written</th>
  33.             <th>Total</th>
  34.             </tr>
  35.  
  36.             <tr>
  37.             <td><?php echo $regustrationNo;?></td>
  38.             <td><?php echo $Viva;?></td>
  39.             <td><?php echo $degree;?></td>
  40.             <td><?php echo $written;?></td>
  41.             <td><?php echo $Total;?></td>
  42.             </tr>
  43.  
  44.     <?php } ?>
  45.  
  46.     <?php } ?>
  47.  
Jun 8 '14 #1
2 4285
Luuk
1,047 Expert 1GB
1) RTFM

2) Change line#10 to:
Expand|Select|Wrap|Line Numbers
  1. if(mysql_num_rows($run)<1) 
  2.  
Jun 9 '14 #2
oriola1
20
i tinks whtz RTFM says shud solve d problems frm ur code am seeing.
Jun 9 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mini Mouse | last post by:
Hiya folks, I'm getting the following error(s) below and I'm at a bit of a loss as to how to correct it. When I give it a parameter it then complains it needs two parameters and the second one...
7
by: roseple | last post by:
Hi, can anyone please help me why I got this error every I uploaded files. Error: Here is the code on the said warning message: # Gather all required data $name =...
1
Paul NIcolai Sunga
by: Paul NIcolai Sunga | last post by:
what is wrong with my code? $Link = mysqli_connect("localhost","root","tupi"); if (!$Link) { die("Could not connect: " . mysql_error()); }...
1
by: dragos42 | last post by:
m from Romania and I bought the book let yourself, bother with a problem to conduct script 14.2 appear: The file has been uploaded! Warning: mysqli_query() expects parameter 1 to be mysqli,...
12
by: Rana Chakra | last post by:
<?php $username="root"; $password=""; $database="lko_phone"; $host="localhost"; $msg=""; mysql_connect($host,$username,$password); @mysql_select_db($database); if($_SERVER == "POST")
3
by: mocha | last post by:
I have this error message --> Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\script.php on line 24 You have an error in your SQL syntax; check the...
1
by: rameshbabu1251 | last post by:
hi i am getting this warning Warning: mysql_fetch_field() expects parameter 1 to be resource, boolean given in :\wamp\www\phpclasses\inserttestdetails.php on line 62 my code is please help me...
1
by: voncolin | last post by:
Warning: mktime() expects parameter 6 to be long any advice would be appreciated im a newbie thanks !! wordpress template on my dashboard error Warning: mktime() expects parameter 6 to be long,...
3
by: Cheyens | last post by:
Hi, This works as long one or both Checkboxes are checked: <?php if( in_array( 'Red', get_field('materiale') ) ) {echo '<a href="' . get_field('download') . '" target="_blank"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.