PDA

View Full Version : PHP mySQL problem


raven
07-22-2004, 06:54 AM
Hey guys,

I've been playing around with things, pulling things out of tutorials and all that. Thanks to everyone for all of the help so far. I am missing something here though.

I am pulling a query into xml format:
http://cushingonline.com/laszlo/xmlSql2.php that I am calling on my Laszlo server at home.

test.lzx:
<canvas width="600" height="550" >
<dataset name="dset" src="http://www.cushingonline.com/laszlo/xmlSql2.php" autorequest="true" type="http" />
<view datapath="dset:/phonebook/contact">
<simplelayout axis="y"/>
<view name="contact" visible="false" x="20" height="120">
<text y="10">First Name:</text>
<edittext name="firstName" datapath="@firstName" x="80" y="10"/>
<text y="35">Last Name:</text>
<edittext name="lastname" datapath="@lastName" x="80" y="35"/>
<text y="85">Email:</text>
<edittext name="email" datapath="@email" x="80" y="85"/>
</view>
</view>
</canvas>

All I am getting as the source is what you see above, no values are being filled in. Any ideas why?

antun
07-22-2004, 11:46 AM
<canvas width="600" height="550" debug="true">
<dataset name="dset"
src="http://www.cushingonline.com/laszlo/xmlSql2.php"
autorequest="true" type="http"
ondata="Debug.write( 'data came back' )"
onerror="Debug.write( 'data error' )"
ontimeout="Debug.write( 'data timeout' )" />

<simplelayout axis="y"/>
<view datapath="dset:/phonebook/contact">
<view name="contact" x="20" height="120">
<text y="10">First Name:</text>
<edittext name="firstName" width="100" datapath="firstName/text()"
x="80" y="10"/>
<text y="35">Last Name:</text>
<edittext name="lastname" datapath="lastName/text()" x="80"
y="35"/>
<text y="85">Email:</text>
<edittext name="email" datapath="email/text()" x="80" y="85"/>
</view>
</view>
</canvas>

A few points:

The reason you couldn't see anything is that the view that contained all the contact info was invisible:

<view name="contact" visible="false" x="20" height="120">

It helps to give your datasets ondata, onerror and ontimeout event handlers, just so you know whether or not the data came back. Turn the debugger on!

Your datapaths for the text fields were like this:

<edittext name="firstName" datapath="@firstName" />

... that's the syntax for an attribute named firstName. Since your values are in XML nodes, you want firstName/text() instead.

A good way to debug something like this is to take the node that is suppose to replicate (<view datapath="dset:/phonebook/contact">), and give it a width and height and a background color. Then you'll see if it is actually being created.

-Antun