Hello There, Guest! › Register

MySubscriptions 2.2 released.
Looking for a custom plugin for your site? Ask here for a quote.

Development: little mysql question
#1

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
        
$db->drop_table("plaza_dns");
    
db_write_query("
    CREATE  TABLE  `" 
TABLE_PREFIX "plaza_dns` (  `totalds` int( 255 )  NOT NULL, `id` int( 255 ) NOT NULL )");
                            
//GET TOTAL FOR DESCRIPTION
                            
$query $db->simple_select("plaza_dns""*");
                            
$array $db->fetch_array($query);
                            
$totalds $array['totalds'];
                            
$total my_format_money($totalds);

    
myplaza_add_item(array(
        
"name"            => 'Donate to board.',
        
"description"    =>  "Donate money to this site, for showing how grateful you are. Total donations: " $total,
        
//MUST ALSO SHOW TOTAL DONATIONS FROM TABLE..
        
"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.
#2

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.
lol
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']
To download our paid plugins and receive support you must be a paid subscriber. Click here for more information.
#3

ok, didn't know which module had this lmao..
- Shadows.
EDIT:
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?




Users browsing this thread: 1 Guest(s)