dbernhar
|
| Posted: 01/07/2002, 10:37 PM |
|
I'm following the steps in the article "Deletion of Records in Grid using Checkboxes" http://gotocode.com/art.asp?art_id=51& . I'm using PHP4 and Templates, w/mySQL. I've surrounded the Grid with form tags in header/footer, set the updatable field to "Label" and checked "html" in Field properties. My fields are simple: a hidden ID, and a Name. I haven't implemented Step 5 (adding action code to Page/Open event) because the step is written in ASP, and I need assistance converting it to PHP. Can anyone provide the same code in PHP4, pretty please? Also, when I GoLive with the code, I get a grid full of checkboxes with no labels next to them....probably because I haven't implemented step 5? If I take out the line $fldname="<input type=checkbox name=$fldname>", then I get a grid full of labels (my Name field) with no checkbox beside them. Need help putting the two together in CodeCharge:
Checkbox Name
Thanks in advance!
dbernhar
|
|
|
 |
Alex Alexapolsky
|
| Posted: 01/08/2002, 2:00 AM |
|
Make sure that your label is called name (case sensetive) , should check
Field Properties/Name
|
|
|
 |
Nicole
|
| Posted: 01/08/2002, 2:42 AM |
|
Hello,
the code for step 5 for PHP could be:
$max = dLookUp("items", "max(item_id)", "1=1");
$min = dLookUp("items", "min(item_id)", "1=1");
for ($i=$min; $i<= $max; $i++)
{
$on = get_param("$i");
if ($on != "")
$sSQLd = "delete from items where item_id=".$i;
//or use update sql query
$db->query($sSQLd);
}
|
|
|
 |
dbernhar
|
| Posted: 01/08/2002, 4:45 AM |
|
I wish it were that simple! I checked Field/Properties. My field is actually called category_name (all lower case), and my Before Show event is $fldcategory_name= "<input type=checkbox name=$fldcategory_name>"; (including the semi-colon -- wouldn't parse w/o it). I'm currently using version 2.0.4 of codecharge, if that makes any difference.
Thanks again!
dbernhar
|
|
|
 |
abrudisill
|
| Posted: 01/12/2002, 6:04 PM |
|
Followed everything up to this point. Where do I put the code from step 5 in Codecharge?
Thanks for your help.
|
|
|
 |
dbernhar
|
| Posted: 01/12/2002, 8:15 PM |
|
Hi Nicole! I used the php code you gave me for the step 5, and it worked! Thanks much for your help!
Cheers!
Dena
|
|
|
 |
dbernhar
|
| Posted: 01/14/2002, 8:08 PM |
|
In the php code Nicole offers for Step 5 of the tutorial, the if statement needs {}. i.e.:
if ($on != "")
{
//define query
//execute query
}
|
|
|
 |
Ivo
|
| Posted: 06/01/2003, 6:56 AM |
|
I have it working, but is there someone who knows how to use this with also the option to update the fields? Now it is only possible to delete a field. In the ASP version it is also possible to update.
I'm using PHP4/templates and CC.
I hope there is someone who can help me. Maybe Nicole or Alex?
Kind Regards,
Ivo
|
|
|
 |
|