PDA

View Full Version : recordset setup variable attributes dnw


jamesparkhyde
12-13-2009, 12:04 AM
I am passing a parameter from my master page to a detail page. It is: http://localhost/gr/getLocationsDetail.php?addr_id=3

I am using the passed parameter in the where clause.

This is the SQL statement in rsDetail:
SELECT city, state_code
FROM addresses
WHERE addresses.addr_id = varAddrID

In the Variables specification of recordset I set the default value to be 1 and runtime variable as $_GET['addr_id']. But that is changed to -1 and blank, and a "totalRows" variable was added as soon as I saved the recordset. The totalRows variable has exactly the same attributes that the rsDetail variable HAD. Which I really don't understand.

The error I get when I test it is: "Parse error: parse error in C:\wamp\www\gr\getLocationsDetail.php on line 47"

This is the whole statement, lines 38 through 49, from the code:

mysql_select_db($database_connGR, $connGR);
$query_rsDetail = sprintf("select addresses.city, addresses.state_code from addresses where addresses.addr_id = %s;", GetSQLValueString($varAddrID_rsDetail, "int"));
$rsDetail = mysql_query($query_rsDetail, $connGR) or die(mysql_error());
$row_rsDetail = mysql_fetch_assoc($rsDetail);
$totalRows_rsDetail = "1";
if (isset($_GET['addr_id'])) {
$totalRows_rsDetail = $_GET['addr_id'];
}

The referenced code is on line 47:

46. $varAddrID_rsDetail = "-1";
47. if (isset()) {
48. $varAddrID_rsDetail = ;
49. }

I assume that Line 46 shows the -1 that the variables "default" attribute was changed to. Line 48 looks mighty suspicious where the variable is set to ?? (nothing). Line 47 isset() lacks any parameter, but I don't know PHP well enough to judge...

All this code is native DW, untouched by human hands!

Any clues? Thanks!

davidj
12-13-2009, 01:27 PM
You identified the reason when you said...

All this code is native DW, untouched by human hands!

You are not evaluating anything on line 47 as you recognised

47. if (isset(???)) {

you are not assigning anything to the variable on 48

48. $varAddrID_rsDetail = ?????;

I suggest you liberate yourself and learn the language

I can help with this but you have to want to do it

edbr
12-14-2009, 12:15 AM
delete the lines you quoted see if it works. davids offer is valuable and if you want do more in the future it is a good way to go. dw wizards ate fine but have a lot of difficult to adapt code

jamesparkhyde
12-14-2009, 05:12 AM
I have been looking for someone to help me learn PHP, and David sure might be the one. At the same time, I'm working on my web site and confused by the fact that the variables attributes I am entering in the rs wizard are being munched and changed and added to and it doesn't make sense to me. It would be great someone could shed some light on this, and how to make my detail page read the url parameters I am passing it.