General queries
am 13.03.2006 22:37:07 von UKuserHi 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 "
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
Re: General queries
am 14.03.2006 00:22:51 von Bill Karwin"UKuser"
news:1142285827.226483.183150@j33g2000cwa.googlegroups.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
.. . .
>
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.