From Database into JTable
Hi!
I have a ResultSet from a database query (select * from table) and I plan to turn it into a Object[][] in order to satisfy one of the DefaultTableModel's constructor ("DefaultTableModel(Object[][] data, Object[] columnNames)") and place it in a JTable - how do I go about in doing this.
I tried this:
myJTable.setModel(new DefaultTableModel(getData(rs),columnNames));
private Object getData(ResultSet rs){
java.util.ArrayList<Object[]> mySets = new java.util.ArrayList<Object[]>();
try{
while(rs.next()){
Object[] row = {
rs.getString("column1"), rs.getString("column2"), new Boolean(false)
ResultSets.add(row);
catch(Exception e){
e.printStackTrace();
return mySets;
But got this error when I compiled:
cannot find symbol
symbol : constructor DefaultTableModel(java.lang.Object,java.lang.String[])
location: class javax.swing.table.DefaultTableModel
new DefaultTableModel(
1 error
BUILD FAILED (total time: 0 seconds)
I'm trying to do this because I would want to have my JTable to have a checkbox in it like what's shown in the Java tutorial's SimpleTableDemo.java.
Basically, am getting data directly from the database - those that are set to 1 is enabled and 0 to disabled, then represent those as check boxes in the JTable.
Thank you so much for your help!
Thanks calvino_ind!
I've managed to get your suggestion to work:
while(rs.next()){
for(int i = 0; i < row; i++){
for(int j = 0; j < col; j++){
obj[i][j] = rs.getObject(j+1);
rs.next();
}Issues:
I had to define the number of rows in order to initialize the Object's size:
Object[][] obj = new Object[number of rows][number of columns];*column size can be retrieved from what's shown in previous post.
To get the number of rows I had to do this:
while(rs.next()){ row++; }But in doing so, the cursor moves to the last row of the ResultSet. To move it back I had to execute this:
rs.beforeFirst();Here's the whole section of the code that's been my concern:
private Object[][] getData(ResultSet rs){
Object[][] obj = null;
int row = 0;
int col = 0;
ResultSetMetaData rsmd;
try{
rsmd = rs.getMetaData();
while(rs.next()){ row++; }
System.out.println(rs.getFetchSize());
col = rsmd.getColumnCount();
obj = new Object[row][col];
rs.beforeFirst();
while(rs.next()){
for(int i = 0; i < row; i++){
for(int j = 0; j < col; j++){
obj[i][j] = rs.getObject(j+1);
rs.next();
}catch(Exception e){
e.printStackTrace();
return obj;
}Now I did a little bit of fiddling around the forums, and came across a discussion that's it's not advisable to get the row count (second post of this link: http://forum.java.sun.com/thread.jspa?threadID=683676&messageID=3982010).
Anyone care to shed some more light into this?
Thanks!
Similar Messages
-
Fetching values from database into a drop down box
in my JSP page there are 3 drop down boxes for date of birth......
what i need is i want to get the values from database into that drop down box when i access the JSP page.......
session is there....'m getting all other values.......
I will attach the JSP page.....
Please help me...........
Thanks in Advance......
<%@ taglib uri='/WEB-INF/taglib/struts-bean.tld' prefix='bean'%>
<%@ taglib uri='/WEB-INF/taglib/struts-logic.tld' prefix='logic'%>
<%@ taglib uri='/WEB-INF/taglib/dyna.tld' prefix='dyna'%>
<%@ taglib uri='/WEB-INF/taglib/struts-html.tld' prefix='html'%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><bean:message key="page_title"/></title>
<link href="<bean:message key="context"/>/CSS/default.css" rel="stylesheet" type="text/css" />
<script src="<bean:message key="context"/>/js/AC_RunActiveContent.js" type="text/javascript"></script>
<link href="<bean:message key="context"/>/CSS/screen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<%!
Membership mShip = null;
%>
<script language="javascript" >
function checkDate(Form){
var d;
d = Form.year.value+"-"+Form.month.value+"-"+Form.day.value;
alert("Date is:"+d);
Form.dob.value = d;
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<jsp:include flush="true" page="../templates/header.jsp"/> </td>
</tr>
<tr>
<td class="menuTD">
<jsp:include flush="true" page="../templates/menu.jsp"/> </td>
</tr>
<tr>
<td class="sub_menuTR"> </td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="column" valign="top" width="170"><jsp:include flush="true" page="../templates/left_panel.jsp"/></td>
<td valign="top" align="left">
<dyna:message error="error" warning="warning" message="message"/>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80%" valign="top" align="left">
<%
if(session != null){
mShip = (Membership)session.getAttribute("member");
%>
<form action="updateContactDetails.dy" method="post" name="form1">
<input type="hidden" name="m" value="<%=request.getParameter("m")%>" />
<table width="100%" border="0">
<tr>
<td>First Name</td>
<td><input name="first_name" type="text" id= "first_name" value = "<bean:write name = "member" property = "first_name" />" /></td>
</tr>
<tr>
<td>Last Name </td>
<td><input name="last_name" type="text" id="last_name" value = "<bean:write name = "member" property = "last_name" />" > </td>
</tr>
<tr>
<td>Address</td>
<td><input name="address1" type="text" id="address1" value = "<bean:write name = "member" property = "address1" />" ></td>
</tr>
<tr>
<td> </td>
<td><input name="address2" type="text" id="address2" value = "<bean:write name = "member" property = "address2" />" ></td>
</tr>
<tr>
<td>Suburb/City </td>
<td><input name="city" type="text" id="city" value= "<bean:write name = "member" property = "city" />" ></td>
</tr>
<tr>
<td>State/Territory</td>
<td><input type="text" name="state" value = "<bean:write name = "member" property = "state" />" ></td>
</tr>
<tr>
<td>Postcode</td>
<td><input type="text" name="postcode" value = "<bean:write name = "member" property = "postcode" />" ></td>
</tr>
<tr>
<td>Contact Phone</td>
<td><input type="text" name="home_phone" value = "<bean:write name = "member" property = "home_phone" />" ></td>
</tr>
<tr>
<td>Mobile</td>
<td><input type="text" name="mobile" value = "<bean:write name = "member" property = "mobile" />" ></td>
</tr>
<tr>
<td>Date of birth</td>
<td nowrap="nowrap"><select name="day">
<option>Day</option>
<option value="01">1</option>
<option value="02">2</option>
<option value="03">3</option>
<option value="04">4</option>
<option value="05">5</option>
<option value="06">6</option>
<option value="07">7</option>
<option value="08">8</option>
<option value="09">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<select name="month">
<option>Month</option>
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">Decembber</option>
</select>
<select name="year" onChange = "checkDate(this.form);" >
<option>Year</option>
<option value="1957">1957</option>
<option value="1956">1956</option>
<option value="1955">1955</option>
<option value="1954">1954</option>
<option value="1955">1955</option>
<option value="1956">1956</option>
<option value="1957">1957</option>
<option value="1958">1958</option>
<option value="1959">1959</option>
<option value="1960">1960</option>
<option value="1961">1961</option>
<option value="1962">1962</option>
<option value="1963">1963</option>
<option value="1964">1964</option>
<option value="1965">1965</option>
<option value="1966">1966</option>
<option value="1967">1967</option>
<option value="1968">1968</option>
<option value="1969">1969</option>
<option value="1970">1970</option>
<option value="1971">1971</option>
<option value="1972">1972</option>
<option value="1973">1973</option>
<option value="1974">1974</option>
<option value="1975">1975</option>
<option value="1976">1976</option>
<option value="1977">1977</option>
<option value="1978">1978</option>
<option value="1979">1979</option>
<option value="1980">1980</option>
<option value="1981">1981</option>
<option value="1982">1982</option>
<option value="1983">1983</option>
<option value="1984">1984</option>
<option value="1985">1985</option>
<option value="1986">1986</option>
<option value="1987">1987</option>
<option value="1988">1988</option>
<option value="1989">1989</option>
<option value="1990">1990</option>
<option value="1991">1991</option>
<option value="1992">1992</option>
<option value="1993">1993</option>
<option value="1994">1994</option>
<option value="1995">1995</option>
<option value="1996">1996</option>
<option value="1997">1997</option>
<option value="1998">1998</option>
<option value="1999">1999</option>
<option value="2000">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
</select ></td></tr>
<tr>
<td><input type="hidden" name = "dob" /> </td>
<td nowrap="nowrap"><input type="submit" value="Submit" /></td>
</tr>
</table>
</form>
</td>
<td width="40"></td>
<td width="200" valign="top">
<div id="headlines">
<jsp:include flush="true" page="../templates/profile.jsp"/>
</div>
</td>
</tr>
</table>
</td>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td><jsp:include flush="true" page="../templates/footer.jsp"/></td>
</tr>
</table>
</body>
</html>i think normally u will get data from databsae as objects.they are like java beans having getter and setter methods.so you create a collection of those objects like collect all the objects coming from database into an arraylist or....
suppose you want to populate the dropdown box with say "username" from database object s, your code will look like that
<html:select property="name">
<html:options collection="databaseList" property="username" />
</html:select>
"databaseList" is collection(say.. ArrayList) of objects you are getting from database.this dropdown will contain all the "usernames" you are getting from database. -
Sharepoint List to Telerik Grid, Where data is not coming from database into List.
SharePoint List to Telerik Grid, Where data is not coming from database into List.
Here, i have a SharePoint list , where configurable text are stored, using some utility.
I want to convert that SharePoint list into Telerik grid, with all Editable Option which i have in SharePoint.I know little about Telerik Grid, only find following article about Telerik integrate with SharePoint:
http://www.telerik.com/help/aspnet-ajax/moss-spradlistview_designer_general.html
a similar question:
http://www.telerik.com/forums/how-to-bind-to-a-sharepoint-list-using-radgrid
Thanks,
Qiao Wei -
RE: Images from Database into W
I've found that a good way to store images was not in the database, but
in files on the server in GIF format and then store the filenames in the
database. That way you avoid the BinaryData mess, the cursor
requirement for blobs, and can store in a compressed form..
You just have the service read in the image from the data file and pass
it back to the requestor, if I remember right.. Also nice because the
same GIF files can be used in normal HTML web pages..
-Greg
Greg Nyberg, Senior Consultant
BORN Information Services Group
(612) 404-4217 Fax: (612) 404-4440
<[email protected]>
From: Brendan Duddridge[SMTP:[email protected]]
Sent: Monday, April 28, 1997 12:28 PM
To: Forte ListServe
Subject: Images from Database into W
TransCanada PipeLines P.O. Box
1000, Station
M
Calgary,
Alberta, T2P
4K5
Telephone:
(403)
267-6100
FAX: (403)
267-6444/5/6
Corporate Head Office
Reply: Images from Database into Web SDK 1.1 page
Hi,
I want to be able to read images in from a database and have Forte
generate a web page with those images.
Does anyone know what the MIME type would be for a Forte ImageData
object? Do I have to store the images into the database in gif format
or is there some other MIME format that Forte uses to store ImageData
objects. Also, can Netscape or Internet Explorer read those images?
Here is the ReturnImage page builder method I created:
=============================================================
Response : HTTPResponse = new();
LUIObject_ID : Integer;
LUIObject_TD : TextData = new();
aLUIObject : LUIObject;
aBinaryData : BinaryData = new();
aStream : MemoryStream = new();
// Retrieve LUIObject_ID from http parameters
LUIObject_TD = pRequest.FindNameValue('LUIObject_ID');
LUIObject_ID = LUIObject_TD.IntegerValue;
// Retrieve aLUIObject for the specified LUIObject_ID from the
database.
// This object contains various ImageData attributes which contain the
// icons to display on the web page.
aLUIObject = SODIInfraSOMgrSO.SelectLUIObject(LUIObject_ID);
aBinaryData.SetAllocatedSize(aLUIObject.ClosedLargeIconSize);
aStream.Open(accessMode = SP_AM_READ_WRITE, isBinary = TRUE);
aStream.WriteSerialized(object=aLUIObject.ClosedLargeIcon);
aStream.Seek(0);
aStream.ReadBinary(target = aBinaryData);
// Not sure what MIME type to specify here for ImageData objects
// read in from a database. Any ideas??????????
Response.AssignBinaryResponse(aBinaryData, 'image/x-bitmap');
return Response;
===============================================================
Thanks,
Brendan DuddridgeHello Denis Segard,
I also try the same method and I use OLE container to store the images into database in Oracle forms 6i.
But, if i try to retrieve the images in report i got that error.
Anyway i store the images into the database but why i shouldn't retrieve it in reports and i can retrieve the images in forms
Is there any problem in my design.
Is there any other easy way to store the images into database in oracle forms 6i...
Waiting 4 ur reply!!!!!!!!
Edited by: Janarthan on Aug 19, 2011 12:36 AM
Edited by: Janarthan on Aug 19, 2011 12:39 AM -
How do i add data from database to JTable ! Urgent
How do i add data from database to the columns of JTable?.
hi,
Thanks for ur link. but this is just a part of my application which i am developing user interface in swing package for which i want to know how to show data to user in the table format where by table input data will be from the database. say something like todays activity is shown to the user in table format... So u have any idea of how to do this... -
How to put data from database into array
I need to answer hot to put data from database directly into array.
I tried like the code below but the error message said: java.lang.ArrayIndexOutOfBoundsException: 0, and it points to this line: numbers [row][0]= rs.getString("ID");
Hope you can help.
ResultSet rs = stmt.executeQuery(query);
int row=0;
String [] [] numbers=new String [row][10];
// output resultset
while ( rs.next() )
numbers [row][0]= rs.getString("ID");
numbers [row][1]= rs.getString("name");
row++;
// close resultset
rs.close();
thanks,DeviThe exception is been thrown simply because you assigned '0' to the 'row' variable, indicating a zero length of the array. In fact you should assign the row count to it.
After all, don't do that. Make use of the Collection framework and map the ResultSet to a Collection of DTO's.
List<User> users = new ArrayList<User>();
while (resultSet.next()) {
User user = new User();
user.setID(resultSet.getString("ID"));
user.setName(resultSet.getString("name"));
users.add(user);
} -
Very very urgent. population data from database into dropdownbox
Hi,
i imported a model through ejbs
this is to create new entries into database ,
and my scenerio iso now i need to populate the values that i stored into database thro EJBS in a drop down box of wd application.
plz help me through code ,i am new to java webdynpro...
neede very urgently,
Thanx .
Arjun.G
Message was edited by:
arjun swamyHi,
Have a look at these threads
Dropdown by index in table - fetching values from database
Dropdown by index
Kind Regards,
Saravanan K -
Importing materialized views from database into physical layer
Hi,
I have created materialized view in the database. When I try to import the materialized view into the physical layer in OBIEE 10G (using the import from database option), it is not showing in the list of available object. I have selected all the object types (tables,views etc.). Can you please let me know how to import the existing MVs in the database into the physical layer.
Regards
Vinodh.
Edited by: user493441 on Jul 7, 2012 4:11 PMHi Vinod,
Refer the below links.
Materialized Views in OBIEE
http://gerardnico.com/wiki/database/oracle/materialized_view
Concept of materialized views in creating datawarehouse?????
Hope this help's
Thanks
Satya -
Retrieving data from database into tabular layout item
Hi..
If the number of product_id is 1; I can retrieve data from the database into tabular layout item.However, if the number of product_id is more than 1 error message is shown.
Here is my code:
select product_id
into : PRODUCTS. ID --Tabular layout item
from products
where customer_id=5;
Any suggestions????It's simpler to do so:
insert that code in a post-query trigger at block level (block where is multi-item)
You will see after execute-query, your item will be populated.
I wrote post-query trigger no post-quert
Message was edited by:
RV -
Displaying data from database into mxList
Hello Flex Developers!
I am getting back an Array Collection with Objects inside from the database. I would like to display this in the mxml portion of my application using the mx:List control. When I put in something like:
<mx:List id="myId" dataprovider="{acFromDatabase}"></mx:List>, wrapped in a Canvas, inside of a tab navigator, I am getting back the array of objects and displayed something like this: object Object. How can I go into this object and display it within the List control? The object has values like name, date, title, etc?
Thanks in advance!
-K4Flex@K4Flex,
you can make use of an itemRenderer and include what all controls you require in your itemrenderer for display.
You can post some of your code so that I will let you know what I am saying.
Thanks,
Bhasker -
How to Retrieve data from database into another form ?
Good Day!
Am currently new at JSP. I've been studying it for awhile and still getting the hang of it. We are working on a project.
Editing a given data. We have to retrieve the given data and post it to another form "Editing form".
Since we can retrieve data using JSP but how are we going to post it to another form? I mean how are we going to transfer data from one form to another?
Can anyone help me with codes please..The client is a web browser.
The client submits a request (click a link, visit a form)
The server gets to respond to this
- look at request parameters from the client
- access database
- produce resulting html page
- send page back to client.
The standard pattern is to retrieve data from the database in java code, and then load that data into a bean.
You then make that bean available as an attribute
It is then available for use in your JSP - either <jsp:useBean> tag or using ${ELexpressions}
All you can pass from the client to the server is request parameters - which are always strings.
Draw a picture of where the information is, and the information flows. Very rarely does it go directly from one "form" to another.
Cheers,
evnafets -
How to load values from database into the f:selectItems value attribute
Hi,
I am trying to load the drop down menu value i.e f:selectItems from the database with a list of values from a column in the databse table. how can i do this? Should i use binding? or is there any other way.
Note:i am able to load values into f:selectItems from the faces-config.xml file but they are static values. i want the values from the database
Please reply with sample codes of faces jsp, bean file and config.xml fileBut this is working for me,
JSF
<h:selectOneMenu value="#{loadbean.grade}" >
<f:selectItems value="#{loadbean.gradelist}" />
</h:selectOneMenu>
bean
private String grade;
private List<SelectItem> gradelist;
public String getGrade() {
return grade;
public void setGrade(String grade) {
this.grade = grade;
public List<SelectItem> getGradelist() {
return gradelist;
public void setGradelist(List<String> items) {
gradelist=new ArrayList<SelectItem>();
gradelist.add(new SelectItem("daniel"));//this value can be from data base
gradelist.add(new SelectItem("pspindia"));
gradelist.add(new SelectItem("prelude sys"));
faces-config.xml
<managed-property>
<property-name>gradelist</property-name>
<null-value/>
</managed-property>
this working fine for me. So setter method also works to load value for the h:selectItems
Thanks a lot. -
Retrieving Data From Database To JTable
I'm new to JTable and i'm not sure how do i retrieve the data and put it inside the JTable.
As from previous example i found on the net, i've tried to incorporate the database but i get various error.
Here is the sample of the code.
Object data[];
String[] columnNames = {"First Name",
"Last Name",
"Sport",
"# of Years",
"Vegetarian"};
String sqlQuery = ("Select * From Sales_Transaction");
try{
rs = stmt.executeQuery(sqlQuery);
while(rs.next()){
data[] = {
{rs.getString(1),rs.getString(1),
rs.getString(1), rs.getString(1), rs.getString(1)},
}catch(SQLException sqlex){
JOptionPane.showMessageDialog(null,"LOL");
final JTable table = new JTable(data, columnNames);Any help is appreciated, have been researching hi and low for guides.
Edited by: zeropulse on Mar 25, 2008 3:01 AMdata[] = { {rs.getString(1), rs.getString(1), rs.getString(1), rs.getString(1), rs.getString(1)} };Not sure what you expect that to do, you are adding the same value to the array 4 times.
Don't use arrays when dealing with dynamic data, you don't know the proper size to make the arry. Use a Vector which can grow with each row or column of data. Something like this:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=614671 -
How can I read the image from database into form
hi everyone
if I have table like this
create table test
(id number(10),
pic long raw);
in this table record
in form If I have block non database
how can i read the image into non database item
I try with this code but no good
select pic into :photo from test where id=5;
photo its non database item kind image
how can i invoke image into item
thanks aloooooootHello,
You can't select image with select query. You need to create another database block from test table which has item binds with database pic column. Now in where condition in test block's property you have to write id=5. Change test block's properties UPDATE ALLOWED, INSERT ALLOWED, DELETE ALLOWED to NO. Only Query allowed property set to YES.
Now in your particular trigger write the code
GO_BLOCK('test');
Execute_Query;
please mark if it help you or correct
Regards,
Danish -
Export Advanced Recordset from Database into XML
I don't think I was clear on my previous post about my goal
with Exporting an advanced MySQL query to an XML file.
Simple example: I have a photo gallery that has pictures of
various Architect Projects. The main page shows distinct images of
various projects (like an index). When one clicks on this image to
view the rest of the Project details, a detail page opens with more
information and additional images within this project.
I want to use Spry/Ajax to give the images nice dynamic
effects on the detail page. Normally to get from an index page to a
detail page using normal server-side procedures, one would have to
set up a dynamic link to the detail page by passing the recordID
thru a URL Parameter. The detail page would have a recordset query
that would call the URL Parameter so that the distinct record
chosen will be the only record displayed.
When exporting this query from the database to XML, for some
reason the following query only displays the <row> node in
the schema when creating a Dataset. See the following sql query
that I am trying to use on the detail page to create the dataset
via XML:
SELECT*
FROM project_tbl
WHERE projectID = [URL PARAM] projectID
Why, when creating a dataset in Spry and exporting it into
XML, will this query NOT work?
What can I do to make this work? URGENT HELP will be kindly
appreciated.Danilo,
I do not have a link yet as the files are on my remote
server. I have implemented the code you sent me but still no luck.
Please see the code I have below:
The XML Generating Page:
<?php require_once('../Connections/plymouth.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType,
$theDefinedValue = "", $theNotDefinedValue = "")
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue)
: $theValue;
$theValue = function_exists("mysql_real_escape_string") ?
mysql_real_escape_string($theValue) :
mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" :
"NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) .
"'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" :
"NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue :
$theNotDefinedValue;
break;
return $theValue;
?>
<?php
// Query the database and get the selected records from
Project & Images
$colname_rsProject = "-1";
if (isset($_GET['projectID'])) {
$colname_rsProject = (get_magic_quotes_gpc()) ?
$_GET['projectID'] : addslashes($_GET['projectID']);
mysql_select_db($database_plymouth, $plymouth);
$query_rsProject = sprintf("SELECT * FROM projects_tbl WHERE
projectID = %s", GetSQLValueString($colname_rsProject, "int"));
$rsProject = mysql_query($query_rsProject, $plymouth) or
die(mysql_error());
$row_rsProject = mysql_fetch_assoc($rsProject);
$totalRows_rsProject = mysql_num_rows($rsProject);
// Send the headers
header('Content-type: text/xml');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');
?>
<?php echo('<?xml version="1.0"
encoding="utf-8"?>'); ?>
<root>
<?php if ($totalRows_rsProject > 0) { // Show if
recordset not empty ?>
<?php do { ?>
<row>
<?php foreach ($row_rsProject as $column=>$value) {
?>
<<?php echo $column; ?>><?php echo
$row_rsProject[$column]; ?></<?php echo $column; ?>>
<?php } ?>
</row>
<?php } while ($row_rsProject =
mysql_fetch_assoc($rsProject)); ?>
<?php } // Show if recordset not empty ?>
</root>
<?php
mysql_free_result($rsProject);
?>
--------------------------------------------here is the
source code to the projecct_detail page to display the
content--------
The projectID from the category page is being passed via a
URL parameter. When I pull up the Spry Dataset in this page to
display the nodes, this is the error I received (Unable to locate
or parse the XML source (-1,-1). No nodes are being displayed.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"><!--
InstanceBegin template="/Templates/temp.dwt.php"
codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<link href="global.css" rel="stylesheet" type="text/css"
/>
<!-- InstanceBeginEditable name="head" -->
<script src="SpryAssets/xpath.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryData.js"
type="text/javascript"></script>
<script type="text/javascript">
<!--
var ds1 = new
Spry.Data.XMLDataSet("xml/detail.php><?php echo(
isset($_GET['projectID'])?$_GET['projectID']:'' ); ?>", "row");
//-->
</script>
<!-- InstanceEndEditable -->
</head>
<body class="oneColFixCtr">
<div id="container"><!-- InstanceBeginEditable
name="Main Content" -->
<div id="mainContent">
<h1> </h1>
<p> </p>
<!-- end #mainContent -->
</div>
<!-- InstanceEndEditable -->
<div id="footer">
<img src="images/banner.gif" width="500" height="66"
alt="Plymouth Road Architects" />
<br />
<div id="nav">
<table width="500" border="0" cellspacing="2"
cellpadding="2">
<tr>
<td><div align="center"><a href="
http://plymouthroadarchitects.com">HOME</a></div></td>
<td><div align="center"><img
src="images/bullet.gif" width="8" height="8"
/></div></td>
<td><div align="center"><a
href="company_info.php">ABOUT/CONTACT
US</a></div></td>
<td><div align="center"><img
src="images/bullet.gif" alt="" width="8" height="8"
/></div></td>
<td><div align="center"><a
href="new_homes.php">NEW HOMES</a></div></td>
<td><div align="center"><img
src="images/bullet.gif" alt="" width="8" height="8"
/></div></td>
<td><div align="center"><a
href="additions.php">ADDITIONS</a></div></td>
<td><div align="center"><img
src="images/bullet.gif" alt="" width="8" height="8"
/></div></td>
<td><div align="center"><a
href="main_street.php">MAIN
STREET</a></div></td>
</tr>
</table>
</div>
</div>
<!-- end #container --></div>
</body>
<!-- InstanceEnd --></html>
Sorry for all the confusion and not submitting this code to
you earlier on this forum. I really do appreciate your feedback and
assistance
Maybe you are looking for
-
How to test for existence of AcroXFA test objects?
Hi - I'm writing scripts to test an XFA form with dynamic subforms. For example, at the end of Part 4, the user hits a Validate button, and if their data is correct, then the Validate button disappears and a Part 5 subform appears. So my script look
-
The relation between free goods and taxation
<b>Dear all;</b> I have a problem when i create free goods condition and it's working. Here is the Business Scenario.... my condition if the customer purchases from material XXX 10 EA we should be given a material XXX one unit free (free goods) and w
-
Help:how to get content of the word(.doc) attachment in a email
help to all: I get the email attachment(.doc or .xls) and it's content,using javaMail Api .but output it on the computer screen,I see only some sign unreadable. Pls how to get the content. thanks for you. bi tan
-
All animation freezes after Log Out used
I've searched and searched and cannot locate another issue similar to this...wondering if someone could offer advice. After I took the iTunes 7, Front Row, and QuickTime updates recently, my dock animation, menu animations, etc freezes after using Lo
-
I have a requirements of limiting users to use onedrive for business site. What I want to do is below 1) I want to configure in such a way that not all users should be able to create their personal site 2) only members of a particular AD group should