Ola
|
| Posted: 03/06/2002, 1:39 AM |
|
Hello,
I've tried this example from CodeCharge support, but it doesen't work.
( see : http://www.gotocode.com/disc_viewt.asp?mid=1606&s_topic=checkbox& )
I get error message when pressing "Delete" button :
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'{'' or `'$'' in Delete.php on line 36
I'm using PHP4 generated pages (without Templates) and i'am running PHP 4.1.2 on my server.
Line 36 says : $max = $db->("m"); in generated page.
I'd appriciate some useful hints!
The code entered i Delete.php under events/open is :
$sSQLm = "select max(user_id) as m from users";
$db->query($sSQLm);
$max = $db->("m");
for ($i=1; $i<= $max; $i++)
{
$on = get_param("$i");
if ($on != "")
$sSQLd = "delete from users where user_id =".$i;
$db->query($sSQLd);
}
|
|
|
 |
Nicole
|
| Posted: 03/06/2002, 2:38 AM |
|
Ola,
change line 36 to:
$max = $db->f("m");
|
|
|
 |
Ola
|
| Posted: 03/06/2002, 4:05 AM |
|
Thanks! It worked just fine now!
I've another problem though ...
Now i get this error :
Database error: Invalid SQL: select u.undefined as u_undefined from users u
MySQL Error: 1054 (Unknown column 'u.undefined' in 'field list')
Session halted.
What I want to do , is to delete the whole record for which the checkbox is marked. user_id is the primary key field in table users.
/Ola
|
|
|
 |
Nicole
|
| Posted: 03/07/2002, 1:06 AM |
|
Ola,
the error means that you haven't added any field to the form that is assigned to db. Add at least primary key field and set its type to Hidden.
|
|
|
 |
Ola
|
| Posted: 03/07/2002, 5:18 AM |
|
Thanks again Nicole!
Now, next problem :
When I hit Delete button after selected some checkboxes,
I get Default.php page returned with one empty filed and one insert button ?!
No post were deleted from database ... and yes, I'm a newbie at this.
I really appriciate the help!
/Ola
|
|
|
 |
Nicole
|
| Posted: 03/07/2002, 5:54 AM |
|
Ola,
I think the only way to help you is to look at you project.
Try to contact CC support on this issue.
|
|
|
 |
Lorenz
|
| Posted: 03/21/2002, 8:52 AM |
|
Hy OLA,
I am a very newbie at this, but, do you try to change destination page to grid form ? I had same problem, and my destination page was a record form :|
|
|
|
 |
Manny Ramirez
|
| Posted: 12/07/2003, 9:19 PM |
|
Did you manager to get this to work. As I am trying to do the same, can you send me your ccs file to look at what you did.
Thanks
Manny
|
|
|
 |
|