$db from Load - How to delete from db table?
Permalink
Ive been able to select and update using $db but cannot Delete a row! Amazing ... and can't find any documentation online that will provide a nice how and/or samples on how to do CRUD, etc. Is there any documentation as reference to see how to use the $db object?
Anyway
$sql = "delete from aa_wall_block";
$v = $db->Execute($sql);
OR
$sql = "delete from aa_wall_block";
$v = $db->query($sql);
does NOT work! What am I missing for this simple query?
thanks
Anyway
$sql = "delete from aa_wall_block";
$v = $db->Execute($sql);
OR
$sql = "delete from aa_wall_block";
$v = $db->query($sql);
does NOT work! What am I missing for this simple query?
thanks
Thanks for answer but that is the code I have and will not work. when I run the sql in mysql it deletes. So it seems I have correct sytax but does not work even though selects, update, etc. work.
Well, it's just bizarre that this doesn't work but other db actions do.
I've have to use my own db class to bypass this.
Are there any web pages with lots of sample code for using the $db object?
thanks
Well, it's just bizarre that this doesn't work but other db actions do.
I've have to use my own db class to bypass this.
Are there any web pages with lots of sample code for using the $db object?
thanks
Hm, that is strange. The concrete5 documentation on database access is here:
http://www.concrete5.org/documentation/introduction/database-access...
It uses ADODB, so I have also used the following site as a reference:
http://phplens.com/lens/adodb/docs-adodb.htm...
http://www.concrete5.org/documentation/introduction/database-access...
It uses ADODB, so I have also used the following site as a reference:
http://phplens.com/lens/adodb/docs-adodb.htm...
thanks for the help. I'll figure this out one way or another.
Could it be server or mysql access permissions, outside of c5?
instead of
try
("delete from aa_wall_block")
try
('delete from aa_wall_block')
Hey Guys, thanks so much for the responses.
THE PROBLEM WAS WITH THE OBJECT TYPING ON THE KEYBOARD!!!!
It was problem with my code elsewhere in the page ... it happens!
Thanks!
THE PROBLEM WAS WITH THE OBJECT TYPING ON THE KEYBOARD!!!!
It was problem with my code elsewhere in the page ... it happens!
Thanks!
If so, you should just be able to do:
Also, on some platforms I believe your query is case sensitive so you will want to double check that the case of your table name is correct.