Forums

PHP

This topic is locked

PHP problem with DWMX recordset

Posted 12 Mar 2005 11:24:25
1
has voted
12 Mar 2005 11:24:25 Niall Porter posted:
Hi all,

I'm using DreamWeaver MX 2004 to build a simple site for a commercial property agency. I'm using PHP 4.3.10 on MS IIS under Windows XP Professional SP2 with MySQL 4.1.

I have a page which is meant to display a list of properties in the database. There is a small form at the top of the page which contains dropdown menu's for selecting filters to apply to the recordset. The recordset is like this:

<font face='Courier New'>SELECT properties.id, properties.address, properties.town, areas.area, groups.group, status.status
FROM properties LEFT OUTER JOIN areas ON properties.areaCode = areas.areaCode LEFT OUTER JOIN groups ON properties.grpCode = groups.grpCode LEFT OUTER JOIN status ON properties.statCode = status.statCode
WHERE (properties.areaCode = varArea) AND (properties.grpCode = varGroup)
ORDER BY varSort</font id='Courier New'>

In the recordset panel the Run-time values for the variables are set thus:

varGroup = $mnuGroup$
varArea = $mnuArea$
varSort = $mnuSort$

I set these to the values shown based on what i found in DWMX help files.

However, when i try and view the page I get this from PHP:

<font face='Courier New'>Parse error: parse error, expecting `','' or `')'' in c:\inetpub\wwwroot\nash\property-search.php on line 10</font id='Courier New'>

Thing is, the code for the recordset is *exactly* as DreamWeaver generated, no hand edits. Here's the code around line 10:

<font face='Courier New'>$varGroup_rstProperties = "3";
if (isset($mnuGroup$)) {
$varGroup_rstProperties = (get_magic_quotes_gpc()) ? $mnuGroup$ : addslashes($mnuGroup$);
}</font id='Courier New'>

This happens when browsing to the page from another one where the form parameters obviously haven't been sent yet. Like i said, the DW help told me to use $formFieldName$ to get things passed from URLs or POST form data. Can someone tell me what's going wrong? My suspicion is the $formFieldName$ thing is maybe for an older PHP version, is that right?

TIA
Niall Porter

Edited by - niall.porter on 12 Mar 2005 11:24:46

Replies

Replied 14 Mar 2005 21:11:43
14 Mar 2005 21:11:43 Chris Charlton replied:
I've never seens $ signs on both sides myself, only in the front ($variable).

To grab a field from a form you need to use:
<pre id=code><font face=courier size=2 id=code>$_POST['fieldname']</font id=code></pre id=code>

~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>
Replied 23 Mar 2005 19:50:55
23 Mar 2005 19:50:55 Niall Porter replied:
hmm, well i saw it in the DreamWeaver help file for the recordset object! In any case I've now downloaded and installed PHAkt (2.7.2) and started using that. Now I have a page with a single recordset which has the following SQL in it:

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>SELECT *
FROM areas
ORDER BY areas.area<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

It works fine in the DreamWeaver recordset test panel, works fine if I paste the SQL into the query page on phpMyAdmin but if I try and browse to the page on the server I get:

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1 <hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

anyone help a php noobie? <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Reply to this topic