Jump to content

blacknight

Members
  • Posts

    271
  • Joined

  • Last visited

Posts posted by blacknight

  1. the first end bracket would work where you have defined $balance it will allways set to what the last row output from your whale statement is

    $balance + $row['balance']; will add the total balance from all users same goes for $new_balance = $balance + $deposit; if you have it outside the last } wil it add the totals

  2. for your members security you should allways md5 there passwords

     

     $query = "INSERT INTO `members` SET (`username`,`password`) VALUES ('".$username."','".md5($password)."')";

     

    that will insert the info. when you set a field to not null you dont need to set a default value because you have to set the value.

  3. when using joins you have to define every table i think so..

    FROM `partners`

    INNER JOIN `users`

    would need something like

    FROM `partners` AS partners

    INNER JOIN `users` AS users

  4. $query = "SELECT `osh`.`comments`, ".
    "GROUP_CONCAT( DISTINCT CONCAT(`opa`.`product_options_values`)) as com ".
    "FROM ".TABLE_ORDERS_STATUS_HISTORY." AS osh ".
    "LEFT JOIN ".TABLE_ORDERS_PRODUCTS_ATTRIBUTES." AS opa ON".
    " `oap`.`orders_id` = '$row[OrderNumber]' AND `osh`.`orders_id` = '$row[OrderNumber]'".
    " ORDER BY orders_status_history_id LIMIT 1";
    
    $row['Note'] = $db->getAll($query);
    
    echo $row['Note']['comments'] .'|'.$row['Note'] ['com'][0].'|'.$row['Note']['com'][1].'<br>'; 
    

     

    that should.. work....

  5. try using this format with wamp

     

    $mysql = $wowdb->connect($db_host, $db_user, $db_passwd, $db_name);

    $db = mysql_select_db($db_name);

     

    if(!$mysql) die("Can´t connect to MySql!<br>".mysql_error()." ".mysql_errno());

    if(!$db) die("Can´t connect to MySql Database!<br>".mysql_error()." ".mysql_errno());

  6. JSON or http vars or post data can be sent to any page as longa s you know the values they are looking for ... like me from home i can run localhost/updater/u.php?cleany&opt=y&back=Y and it posts to my site telling to to run the script to clean optanize and packup my database .. the more i think about it post vars are the best way to go..

  7. 
    $result = mysql_query( "SELECT ( select `rider`.`total_points` from`rider` WHERE `rider`.`team-name` = `team`.`rider_name` ) AS `rtotal`, `team`.`rider_name`, FROM `teams` AS team
    LEFT JOIN `rider_stats` AS rider ORDER BY `rtotal` desc)
    

     

    i think this should do what you want...

    sum the points of all riders on a team and asoc it with 1 team .. then you can loop each team...

    orderd by `rtotal` desc should give you a full list of all teamd and there total points...

     

    with out testing it this is the best i can do rite now ...

  8. still not quite understanding .. but heres how to make multidementional arrays...

     

    define a var

    $title = array();

    define a key

    $title['index']=array();

    value of a key

    $title['index']['home'] = 'texthere';

     

    to call

    echo $title['index']['home'];// returns texthere to the screen hope this helps...

     

  9. i think i understand

     

    Subjects

    id | name|..

    1 | bobs | x | x

     

    Pages

    subject_id | name |..

     

    if im correct you want to list each catagory with its subcatagories? try this..

     

     

    while($row = mysql_fetch_array($result)){
       
       
       echo $row["menu_name"]."<br/>";
       
       
       
       $parent = mysql_query("SELECT * FROM `pages` WHERE `subject_id` = '".$row["id"]."' " ,$connection);
       if(!$parent){
       die("connection error : ".mysql_error());
       }
       while($rowone = mysql_fetch_array($parent)){
       echo $rowone["menu_name"];
       }
    echo '<br><hr><br>';
    }
    

    your parent query is failing because you closed $row['id'] when you closed teh where statement this will loop each subject and then list each page for it under it end with a echo '<br><hr><br> so sep them for the nest then you can do your formatting

     

    try this i could be wrong...

  10. verry simple fix

    any var that has or could have ' in it use this addslashes($varnamehere)

    ex:

    SELECT DISTINCT author FROM archives WHERE `title` = '$title' AND `year` = '$year' AND `category` = '$category' AND `group` = '$group' "
    to
    SELECT DISTINCT author FROM archives WHERE `title` = 'addslashes($title)' AND `year` = '$year' AND `category` = '$category' AND `group` = '$group' "

     

    best bet when adding stuff in to a dabatase allways use addslases() then when displaying use stripslashes() makes life easier i fond

  11. 
        $username="root";
        $password="mypassword";
        $database="mydatabase";
        mysql_connect('localhost',$username,$password);
        mysql_select_db($database) or die( "Unable to select database");
        
        function drop_empty_tables(){
            $tables = mysql_query('SHOW TABLES');
            while($table = mysql_fetch_array($tables)){
                $table = $table[0];
                $records = mysql_query("SELECT * FROM $table");
                if(mysql_num_rows($records) == 0){
                    mysql_query("DROP TABLE $table");
                    echo "DROP TABLE $table;\n";
                }
            }
        }
        
        drop_empty_tables();
    
    
    

     

    any table on the server the user has rights to with 0 row count will be droped

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.