These will delete
all data in the tables. The difference is that truncate will reset all id settings (eg auto_increment), delete from will keep all ids at the same values
TRUNCATE [i]table_name[/i]
or
DELETE FROM [i]table_name[/i]
As for inserting data, lots of ways
Inserting one record
INSERT INTO [i]table_name[/i] VALUES([i]column_data1[/i], [i]column_data2[/i])
- This is the very basic sql. However, all of the columns in the table must be accounted for in the VALUES() part, with columns seperated by commas. If you add or delete a column then your sql will have to change because the number of columns has changed.
INSERT INTO [i]table_name[/i]([i]column_name1[/i], [i]column_name2[/i]) VALUES([i]column_data1[/i], [i]column_data2[/i])
- Much better way. You specify the column names and then the corresponding values in the VALUES() part. The columns can be in any order. This is much safer, if you add a column, the script will not crash, because you've specified which columns will have data.
As for using Mybb to do it.
$db->query("INSERT INTO ....");
Will do the trick. If you want it to continue if there are any mysql errors then use
$db->query("INSERT INTO ....", TRUE);
(If you are selecting data, you will need to capture the query_result by using "$result = $db->query("SELECT * FROM ....");")
You can also use the new function (PR2)
$data_array = new array();
$data_array['[i]column_name1[/i]'] = [i]column_data1[/i];
$data_array['[i]column_name1[/i]'] = [i]column_data1[/i];
$db->insert_query([i]table_name[/i], $column_data);
It takes a table name and an array of data. It uses the keys as the columns and the values as the values. Very useful.