By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,426 Members | 3,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,426 IT Pros & Developers. It's quick & easy.

Alternative of PHP "Unset" function is ASP

P: n/a
Hi everybody I have got the following PHP code which I am trying to convert to
ASP any help will be appreciated...I have done most of it but I cant find a
replace function for Unset in asp which will discard the variable alltogether...
if ($categoryid == "all")
{
$sql = "SELECT * FROM products where shopinspection=$shopinspection";
unset($HTTP_POST_VARS['categoryid']);
unset($HTTP_POST_VARS['shopinspection']);
}
else
{
$sql = "SELECT * FROM products where categoryid = $categoryid";
unset($HTTP_POST_VARS['categoryid']);
}
unset($HTTP_POST_VARS['Submit']);
while (list($key, $value) = each($HTTP_POST_VARS))
{
if ($value != "" )
{
$sql = $sql .=" AND $key=$value";
//$sql = $sql .=" AND solesource = $solesource";
//echo "<strong>$value</strong>";
}
}

Jul 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I don't believe that you'll find a replacement for this, as the Request.Form
collection is read-only. Try something like:
For each thing in Request.Form
If thing <> "categoryid" And thing <> "shopinspection" Then
'''your code
Next

Ray at work

<fa*****@yahoo.com> wrote in message news:cl*********@drn.newsguy.com...
Hi everybody I have got the following PHP code which I am trying to
convert to
ASP any help will be appreciated...I have done most of it but I cant find
a
replace function for Unset in asp which will discard the variable
alltogether...
if ($categoryid == "all")
{
$sql = "SELECT * FROM products where shopinspection=$shopinspection";
unset($HTTP_POST_VARS['categoryid']);
unset($HTTP_POST_VARS['shopinspection']);
}
else
{
$sql = "SELECT * FROM products where categoryid = $categoryid";
unset($HTTP_POST_VARS['categoryid']);
}
unset($HTTP_POST_VARS['Submit']);
while (list($key, $value) = each($HTTP_POST_VARS))
{
if ($value != "" )
{
$sql = $sql .=" AND $key=$value";
//$sql = $sql .=" AND solesource = $solesource";
//echo "<strong>$value</strong>";
}
}

Jul 21 '05 #2

P: n/a
Thanks ray I am including my ASP code which I have converted but is not working
the way I want it to....

if categoryid = "all" Then
sql = "SELECT * FROM products where shopinspection= "& shopinspection &""
Else
'sql = "SELECT * FROM products where categoryid = "& categoryid &""
sql = "SELECT * FROM products where "
End If

For x = 1 To (formcount - 1)
If Request.Form.item(x) <> "" Then
sql = sql & Request.Form.Key(x) &"="& Request.Form.Item(x) &""
sql = sql & " And "
End If
Next

In article <e9**************@tk2msftngp13.phx.gbl>, Ray Costanzo [MVP]" <my
first name at lane 34 dot commercial> says...

I don't believe that you'll find a replacement for this, as the Request.Form
collection is read-only. Try something like:
For each thing in Request.Form
If thing <> "categoryid" And thing <> "shopinspection" Then
'''your code
Next

Ray at work

<fa*****@yahoo.com> wrote in message news:cl*********@drn.newsguy.com...
Hi everybody I have got the following PHP code which I am trying to
convert to
ASP any help will be appreciated...I have done most of it but I cant find
a
replace function for Unset in asp which will discard the variable
alltogether...
if ($categoryid == "all")
{
$sql = "SELECT * FROM products where shopinspection=$shopinspection";
unset($HTTP_POST_VARS['categoryid']);
unset($HTTP_POST_VARS['shopinspection']);
}
else
{
$sql = "SELECT * FROM products where categoryid = $categoryid";
unset($HTTP_POST_VARS['categoryid']);
}
unset($HTTP_POST_VARS['Submit']);
while (list($key, $value) = each($HTTP_POST_VARS))
{
if ($value != "" )
{
$sql = $sql .=" AND $key=$value";
//$sql = $sql .=" AND solesource = $solesource";
//echo "<strong>$value</strong>";
}
}



Jul 21 '05 #3

P: n/a
In what way is it not working the way you want it to and in what way do you
want it to work? Tell us what you see that tells you it "is not working the
way I want it to...."

Ray at work

<fa*****@yahoo.com> wrote in message news:cl********@drn.newsguy.com...
Thanks ray I am including my ASP code which I have converted but is not
working
the way I want it to....

if categoryid = "all" Then
sql = "SELECT * FROM products where shopinspection= "& shopinspection
&""
Else
'sql = "SELECT * FROM products where categoryid = "& categoryid &""
sql = "SELECT * FROM products where "
End If

For x = 1 To (formcount - 1)
If Request.Form.item(x) <> "" Then
sql = sql & Request.Form.Key(x) &"="& Request.Form.Item(x) &""
sql = sql & " And "
End If
Next

In article <e9**************@tk2msftngp13.phx.gbl>, Ray Costanzo [MVP]"
<my
first name at lane 34 dot commercial> says...

I don't believe that you'll find a repla

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.