CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 Delete in grid by 0 in textbox

Print topic Send  topic

Author Message
Ivo
Posted: 06/04/2003, 2:29 PM

User: CC, PHP, MySql, WinXP

Oke maybe this is a (new) idea to solve my problem. But I need some help..,
please.
I want my grid (my shoppingbasket) has the option to delete the product and
update the quantity of the product. I don't
know how to delete by checkbox and update quantity in one form:
http://www.gotocode.com/disc_viewt.asp?mid=21367

So maybe my new idea works better and easyer. I want to use the update
script (page's open event) :

$max = dLookUp("orderline", "max(orderline_id)", "1=1");
$min = dLookUp("orderline", "min(orderline_id)", "1=1");

for ($i=$min; $i<= $max; $i++)
{
$quantity = get_param("$i");
if ($quantity != "")
{
$quantity = str_replace(",", ".", $quantity);
$sSQLu = "UPDATE orderline SET quantity=" . $quantity . " WHERE
orderline_id=".$i;
$db->query($sSQLu);
}
}

and I want to build in this script the option like:
if quantity input is 0 delete from orderline where orderline_id=".$i;

I worked very hard (with my poor PHP experience) to let this work and my
deadline for my school project is this week :-(
so maybe somebody can help me..

I think it must be someting like this, but it does not work:

$max = dLookUp("orderline", "max(orderline_id)", "1=1");
$min = dLookUp("orderline", "min(orderline_id)", "1=1");

for ($i=$min; $i<= $max; $i++)
{
$quantity = get_param("$i");
if ($quantity != "")
{
$quantity = str_replace(",", ".", $quantity);
$sSQLu = "UPDATE orderline SET quantity=" . $quantity . " WHERE
orderline_id=".$i;
$db->query($sSQLu);
}
else if ($quantity = "0")
{
$sSQLd = "delete from orderline where orderline_id=".$i;
$db->query($sSQLu);
}
}

Please help me.

Best Regards,
Ivo

Robert Rodgers
Posted: 06/04/2003, 3:10 PM

Hi Ivo,

I don't use PHP much or CC but I have solved the same problem with CCS and
ASP. What I do is start by deleting all the items in my cart and only
adding in products where the Quantity > 0. Maybe this will help you to get
going in the right direction.


Set Connection = New clsDBSCConnection
Connection.Open
'Empty Cart
SQL = "Delete From scclnt_Basket_detail WHERE " & _
"shopper_id = '" & fnGetUserGUID() & "'" ' fnGetUserGUID() returns the
GUID that identifies the shopping cart for this person.
Call Connection.Execute(SQL)
'For each url parameter
for each i in Request.QueryString
id = i
If Mid(id,1,2) = "q_" Then ' I use q_ProductNumber=Quantity to identify
the products on the url.
ProductID = Mid(id,3)
Quantity = Request.QueryString(i)
If IsNumeric(Quantity) = True Then
Quantity = replace(Quantity,",",".")
If Quantity > 0 Then ' When Quatity is > 0 then we insert the product
and quantity into the shopping cart.
SQL = "Insert scclnt_Basket_detail (shopper_id,ProductID, Quantity)
Values(" & _
"'" & fnGetUserGUID() & "','" & ProductID & "'," & Quantity & ")"
Call Connection.Execute(SQL)
End IF
End if
End IF
next


rob

--
"Every absurdity has a champion to defend it"
Oliver Goldsmith
++++++++++++++++++++++++++++++

"Ivo" <raad@quicknet.nl> wrote in message
news:bbloc2$l95$1@news.codecharge.com...
User: CC, PHP, MySql, WinXP

Oke maybe this is a (new) idea to solve my problem. But I need some help..,
please.
I want my grid (my shoppingbasket) has the option to delete the product and
update the quantity of the product. I don't
know how to delete by checkbox and update quantity in one form:
http://www.gotocode.com/disc_viewt.asp?mid=21367

So maybe my new idea works better and easyer. I want to use the update
script (page's open event) :

$max = dLookUp("orderline", "max(orderline_id)", "1=1");
$min = dLookUp("orderline", "min(orderline_id)", "1=1");

for ($i=$min; $i<= $max; $i++)
{
$quantity = get_param("$i");
if ($quantity != "")
{
$quantity = str_replace(",", ".", $quantity);
$sSQLu = "UPDATE orderline SET quantity=" . $quantity . " WHERE
orderline_id=".$i;
$db->query($sSQLu);
}
}

and I want to build in this script the option like:
if quantity input is 0 delete from orderline where orderline_id=".$i;

I worked very hard (with my poor PHP experience) to let this work and my
deadline for my school project is this week :-(
so maybe somebody can help me..

I think it must be someting like this, but it does not work:

$max = dLookUp("orderline", "max(orderline_id)", "1=1");
$min = dLookUp("orderline", "min(orderline_id)", "1=1");

for ($i=$min; $i<= $max; $i++)
{
$quantity = get_param("$i");
if ($quantity != "")
{
$quantity = str_replace(",", ".", $quantity);
$sSQLu = "UPDATE orderline SET quantity=" . $quantity . " WHERE
orderline_id=".$i;
$db->query($sSQLu);
}
else if ($quantity = "0")
{
$sSQLd = "delete from orderline where orderline_id=".$i;
$db->query($sSQLu);
}
}

Please help me.

Best Regards,
Ivo


Ivo
Posted: 06/05/2003, 1:35 AM

Sorry i does not work in PHP. Maybe question for you or other users:

Back to basic, I want to delete if the input = 0. If I use this script, the
site deletes when the input is NOT 0. Oke I want to delete when it IS 0. But
How can I do that? Just if ($aantal=0) does not work..

Thnx,
Iv0

------------------------------------------------------

$max = dLookUp("orderline", "max(orderline_id)", "1=1");
$min = dLookUp("orderline", "min(orderline_id)", "1=1");

for ($i=$min; $i<= $max; $i++)
{
$aantal = get_param("$i");
if ($aantal!=0) {
$sSQLd = "delete from orderline where orderline_id=".$i;
$db->query($sSQLd);
}
}
------------------------------------------------------


"Robert Rodgers" <rrodgers@sylvancomputing.com> schreef in bericht
news:bblqpb$qld$1@news.codecharge.com...
> Hi Ivo,
>
> I don't use PHP much or CC but I have solved the same problem with CCS and
> ASP. What I do is start by deleting all the items in my cart and only
> adding in products where the Quantity > 0. Maybe this will help you to
get
> going in the right direction.
>
>
> Set Connection = New clsDBSCConnection
> Connection.Open
> 'Empty Cart
> SQL = "Delete From scclnt_Basket_detail WHERE " & _
> "shopper_id = '" & fnGetUserGUID() & "'" ' fnGetUserGUID() returns the
> GUID that identifies the shopping cart for this person.
> Call Connection.Execute(SQL)
> 'For each url parameter
> for each i in Request.QueryString
> id = i
> If Mid(id,1,2) = "q_" Then ' I use q_ProductNumber=Quantity to identify
> the products on the url.
> ProductID = Mid(id,3)
> Quantity = Request.QueryString(i)
> If IsNumeric(Quantity) = True Then
> Quantity = replace(Quantity,",",".")
> If Quantity > 0 Then ' When Quatity is > 0 then we insert the product
> and quantity into the shopping cart.
> SQL = "Insert scclnt_Basket_detail (shopper_id,ProductID,
Quantity)
> Values(" & _
> "'" & fnGetUserGUID() & "','" & ProductID & "'," & Quantity & ")"
> Call Connection.Execute(SQL)
> End IF
> End if
> End IF
> next
>
>
> rob
>
> --
> "Every absurdity has a champion to defend it"
> Oliver Goldsmith
> ++++++++++++++++++++++++++++++
>
> "Ivo" <raad@quicknet.nl> wrote in message
>news:bbloc2$l95$1@news.codecharge.com...
> User: CC, PHP, MySql, WinXP
>
> Oke maybe this is a (new) idea to solve my problem. But I need some
help..,
> please.
> I want my grid (my shoppingbasket) has the option to delete the product
and
> update the quantity of the product. I don't
> know how to delete by checkbox and update quantity in one form:
> http://www.gotocode.com/disc_viewt.asp?mid=21367
>
> So maybe my new idea works better and easyer. I want to use the update
> script (page's open event) :
>
> $max = dLookUp("orderline", "max(orderline_id)", "1=1");
> $min = dLookUp("orderline", "min(orderline_id)", "1=1");
>
> for ($i=$min; $i<= $max; $i++)
> {
> $quantity = get_param("$i");
> if ($quantity != "")
> {
> $quantity = str_replace(",", ".", $quantity);
> $sSQLu = "UPDATE orderline SET quantity=" . $quantity . " WHERE
> orderline_id=".$i;
> $db->query($sSQLu);
> }
> }
>
> and I want to build in this script the option like:
> if quantity input is 0 delete from orderline where orderline_id=".$i;
>
> I worked very hard (with my poor PHP experience) to let this work and my
> deadline for my school project is this week :-(
> so maybe somebody can help me..
>
> I think it must be someting like this, but it does not work:
>
> $max = dLookUp("orderline", "max(orderline_id)", "1=1");
> $min = dLookUp("orderline", "min(orderline_id)", "1=1");
>
> for ($i=$min; $i<= $max; $i++)
> {
> $quantity = get_param("$i");
> if ($quantity != "")
> {
> $quantity = str_replace(",", ".", $quantity);
> $sSQLu = "UPDATE orderline SET quantity=" . $quantity . " WHERE
> orderline_id=".$i;
> $db->query($sSQLu);
> }
> else if ($quantity = "0")
> {
> $sSQLd = "delete from orderline where orderline_id=".$i;
> $db->query($sSQLu);
> }
> }
>
> Please help me.
>
> Best Regards,
> Ivo
>
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.