473,399 Members | 4,177 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,399 software developers and data experts.

echo mysql table inside a new html or php page in php.

3
I need to echo this table inside a web page and need to take a print-out.Records must select according to req_num which will be entered by user.(I defined it as $req) this code gave me this error
"Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in E:\wamp\www\STMS_2.4\printprew.php on line 23"
plz help
Expand|Select|Wrap|Line Numbers
  1.  
  2. <?php
  3.  
  4.   require 'connection.php';
  5.  
  6.               //inner join...begins 28.02.2013-thilini
  7.  
  8.     if(isset($_POST['p'])){
  9.  
  10.         $req=$_POST['txtreq'];
  11.  
  12.         //$get=("select req_num from $tbltempisit Where req_num='$req'");
  13.  
  14.     $result = ("SELECT  $tbltempisit.item_name,$tbltempds.emp_name FROM $tbltempisit  INNER JOIN $tbltempds ON $tbltempisit.req_num = $tbltempds.req_num WHERE req_num ='$req' ");
  15.  
  16.      $query_r=mysql_query($result);
  17.  
  18.  
  19.   echo "<table  border='1' id='data'>
  20.   <tr>
  21.   <th>Item</th>
  22.   <th>name</th>
  23.   </tr>";
  24.   while ($row = mysql_fetch_array($query_r)) {
  25.   echo "<tr>";
  26.   echo "<td>" . $row['item_name'] . "</td>";
  27.   echo "<td>" . $row['emp_name'] . "</td>";
  28.   echo "</tr>";
  29.   }
  30.   echo "</table>";
  31.  
  32.  
  33.  
  34.     }
  35.  
  36.  
  37.  
  38. //inner join....ends
  39.  
  40. ?>
  41.  
  42.  
Mar 1 '13 #1
1 1608
Rabbit
12,516 Expert Mod 8TB
mysql_query returns a resource on a select query only if it succeeds. Otherwise, it returns a boolean false. If you're getting a boolean, that means your query failed. Check the query string that it's running after the variables are translated to see if the query string is correct.
Mar 1 '13 #2

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

Similar topics

2
by: sams | last post by:
How do I make or workaround in my Apache server to parse *.html files for <?php ?> code embedded in it? Currently php recognises <?php ?> tag only if the file has a *.php extension. Any php...
4
by: steve | last post by:
I have an on-going problem that my ".MYI" mysql files get corrupted. I have written php trapping routine to report on the problem to admin. My next step is to initiate "repair table" right after...
1
ramprabu
by: ramprabu | last post by:
Hi Design a page have two div tags. It has some set of html pages. Left div tag holds all the menus and right side another one div tag it will taget based on the menus. I can apply the...
3
by: skyy | last post by:
Hi... Is it possible to insert C++ object into HTML page using the <object> tag? If cant, then i guess the only way is to convert the C code to active X control then insert the active X object...
1
by: skyy | last post by:
Hi.. Is there any way to insert .dll object into a html webpage? I am using VC++ ATL to produce a Active X control with dialog obx.The output of the project is in .dll. So how do i insert it...
3
by: srikanth233 | last post by:
hello! How can i get data from Mysql to a html page with out changing the current page?
2
cameokid
by: cameokid | last post by:
Hi, Here is the problem which i am facing. I am trying to delete rows (using nodes) containing XML data. I am doing this to add new set of data from XML file by using a dropdown selection. ...
2
by: antonio_wn8 | last post by:
Hi all, I have a need to read and parse a table in HTML page. I’m using the following script: http://trac.davidgrant.ca/browser/src/python/misc/siteuptime/TableParser.py It works fine aside...
2
by: phpmagesh | last post by:
Hai to all, I have a Html page with some functions, what i want to do is, i want to write php code for displaying a html table in page, if i selected the option for example color, then that...
1
by: mithu0189479120 | last post by:
I am new in PHP & MYSQL. I have a multiple checkbox item in html form and want to create a new table by this checked item in an existing database with PHP code .
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.