470,594 Members | 1,499 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,594 developers. It's quick & easy.

General queries

Hi Guys,

I have some wierd MySQL queries. Although I am using ADODB (an
abstraction layer) - the queries will probably be quite general.

1) When I post data in a url (i.e. post.php?id=120) and I use this
code: $var = secure_field($id); it will work (on the
"recieve_page.php"). However if I use $secure_field($_POST['$id']) or
any POST/GET/REQUEST type option, it won't work. Its fine, because
secure_field does what I need, however I'm just not sure why its not
picking it up. (If I probe $var - the result is blank)

2) I have a table, where I want a delete button at the end of each row
(as opposed to when only one record is displayed on the screen). I also
don't want to have to post to an external delete.php file. Is there a
way to do this?

For example:
print "<tr>
<TD>{$rs->fields[0]}</TD>
<TD>{$rs->fields[1]}</TD>
<TD>{$rs->fields[2]}</TD>
<TD>{$rs->fields[3]}</TD>
<TD><a href='another_page.php?id=$id'>Edit</a></TD>
<TD><a href='this_page.php?id=$id2'>Delete</a></TD>

Where $id = $rs->fields[0]

Even with hardcoded MySQL I have never been able to resolve this delete
per row problem. Any help would be great.

Thanks

Mar 13 '06 #1
1 1176
"UKuser" <sp********@yahoo.co.uk> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
I have some wierd MySQL queries. Although I am using ADODB (an
abstraction layer) - the queries will probably be quite general.
Hmm. You mention ADODB, but the coding questions you are asking involve
PHP. Also, I don't see any MySQL question in your posting. Perhaps you
would get a more specific reply from a PHP newsgroup.
1) When I post data in a url (i.e. post.php?id=120) and I use this
code: $var = secure_field($id); it will work (on the
What is secure_field()? Is this a function of yours?

The expression $id is a variable. Passing the variable to the
secure_field() function substitutes the value of $id, not the string '$id'.
What is the value of $id? Presumably it contains the name of the request
parameter you're reading.
"recieve_page.php"). However if I use $secure_field($_POST['$id']) or
any POST/GET/REQUEST type option, it won't work.
In PHP, putting '$id' in quotes prevents the variable from being expanded.
So the expression is trying to find an entry in the _POST parameter array
whose name is literally '$id', not the value of the $id variable as in the
other example above.
2) I have a table, where I want a delete button at the end of each row .. . . <TD><a href='this_page.php?id=$id2'>Delete</a></TD>


You could make the href='this_page.php?id=$id2;action=delete' and then look
for the 'action' parameter in your php script. If the value is delete, then
delete the specified entry. If the value of the action parameter is not
delete, then it defaults to edit.

Regards,
Bill K.
Mar 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Rob Ristroph | last post: by
8 posts views Thread by Frnak McKenney | last post: by
3 posts views Thread by Tom | last post: by
reply views Thread by WhatsPHP | last post: by
7 posts views Thread by Joe Ross | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.