MyBB-Plugins Forums

Full Version: Development: little mysql question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok i've done sth completely wrong lmao!
i used an update_query when i needed insert =/
could you tell me how to use that?
PHP Code:
                    $db->update_query("plaza_dns", array('totalds' => $newamount), "ID='1'"); 
* Shadows interpretes it as: insert into table plaza_dns (totalds,id) values(1, $newamount)
well that's what it should be.. No idea what $db-> things mybb uses.
Is there also a general.php file for this?
this is for my Donations module. It is NOT the same as the donate module. I will not tell more at the moment.
btw: once i get the admin working for PM's in steal money plugin i'll release the steal money plugin.
another question.
I need to take info from a DB for the description of an item, is this possible? I had done this:
(in _activate() )
PHP Code:
    //ADD DB ROW FoR TOTAL - drop if already exists
    CREATE  TABLE  `" 
TABLE_PREFIX "plaza_dns` (  `totalds` int( 255 )  NOT NULL, `id` int( 255 ) NOT NULL )");
$query $db->simple_select("plaza_dns""*");
$array $db->fetch_array($query);
$totalds $array['totalds'];
$total my_format_money($totalds);

"name"            => 'Donate to board.',
"description"    =>  "Donate money to this site, for showing how grateful you are. Total donations: " $total,
"cost"            => 0.00,
"htmlextra"     => '<input type="text" name="amount" value="amount" size="30" />',
*ignore the escapes, i did not escape it yet, once everything works without escaping i'll do it*

Thank you,
- Shadows.
why don't you take a look at existing modules?
Search for "insert" in mycompany and you will find out how to insert things, you can also check mycompany on how to create tables.
for getting info i would do it this way:
PHP Code:
$money $db->fetch_field($db->simple_select("plaza_dns""money"'uid='.$mybb->user['uid']), 'money); 

that will get the money field money from plaza_dns where uid = $mybb->user['uid']
ok, didn't know which module had this lmao..
- Shadows.
My item description is
"......" . $total;
But actually i get total here:
PHP Code:
                            //GET TOTAL FOR DESCRIPTION
$query $db->simple_select("plaza_dns""*");
$array $db->fetch_array($query);
$totalds $array['totalds'];
$total my_format_money($totalds); 
So how do i get it?