Coool!
Good catch!
if you have the table name spelled right all over I don’t know...
Did the SQL command work fine in phpMyAdmin?
http://www.google.se/search?hl=en&q=Execution+of+a+query+to+the+database+failed+-+Table+doesn’t+exist&aq=f&aqi=&aql=&oq=&gs_rfai=
Did you create a TV and assigned that to your template?
Yes but is the TV dataGrid assigned to the template you use?
Other ways of retrieving data
http://modxcms.com/forums/index.php/topic,48391.msg283290.html#msg283290
// INSERT - $dbQuery = $modx->db->insert( $dbTable, $table_prefix . 'insertTableName' );
// UPDATE - $dbQuery = $modx->db->update( $dbTable, $table_prefix . 'updateTableName' );
// DELETE - $dbQuery = $modx->db->delete( $table_prefix . 'deleteFromTableName', 'some_field = 1 AND name=\''.$dbTable[name].'\'', '' );
http://modxcms.com/forums/index.php/topic,8111.0.html
Here is how to add extra form for delete entries by ID.
1. In dataGrid
@SELECT id, fullname, phone, phone2 FROM mytable
Column Names:
ID, Full Name, Phone, Phone 2
Field Names:
id, fullname, phone, phone2
2. Create a New snippet
[!PhoneListDelete!]
<?php
function PhoneListDelete( &$fields )
{
global $modx;
$id = $modx->db->escape($fields[id]);
if (is_int($id)) {
$dbQuery = $modx->db->delete('mytable', "id = $id");
}
return true;
}
return $html;
?>
3. Create a
myformDelete CHUNK
<form method="post" action="[~[*id*]~]" id="dbFormDelete" name="dbFormDelete">
<input name="formid" type="hidden" value="dbFormDelete" />
<fieldset class="form3">
<label>ID:</label>
<input name="id" class="form" size="2" type="text" eform="::0::" />
<input type="submit" name="submit" value="Delete" />
</fieldset>
</form>
Call it
[!PhoneListDelete!]
[!eForm? &noemail=`true` &formid=`dbFormDelete` &eFormOnBeforeMailSent=`PhoneListDelete` &tpl=`myformDelete` &thankyou=`thankyou`!]