#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    10
    Rep Power
    0

    Make value from a stdClass Object to variable?


    So my php code is right now:
    PHP Code:
    $ppi $_GET['ppi'];
    $ppt $_GET['ppt'];
    include (
    'setting_hash.php'); 
    $connect = new mysqli($d1a7ed3cca526d3e7deaff09b806edb9$ef273f920242ac583dd4e981ac13b7fe$a3602c782f6cd7fa9cdbcbdfd4258f82$efb152de55f690c7259b6ce4445c6f52);
    if (
    $connect->connect_error) { 
        die(
    'Coennection Error (' $connect->connect_errno ')' $connect->connect_error); 

    if(
    $ppi $ppt){ 
    $query "SELECT SUM(pplog) FROM xispcom_ppcal WHERE ppn>'$ppi' && ppn<='$ppt'";
    $result $connect->query($query);
    while(
    $get_row $result->fetch_object()){
        
    print_r($get_row);
    }
    }else{

    echo 
    "The pilot point you have MOST be smaller than the points you want!";

    And it returns this:
    PHP Code:
    stdClass Object ( [SUM(pplog)] => 1216 
    I can't figure out, how to get only the "1216" into a variable i can calculate with :i
    The 1216 is a changing number
    help?


    Best Regards Xkay
  2. #2
  3. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,749
    Rep Power
    9397
    Use an alias on that SUM value
    Code:
    SELECT SUM(pplog) AS ppsum...
    then you can
    PHP Code:
    $get_row->ppsum 
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    10
    Rep Power
    0
    Originally Posted by requinix
    Use an alias on that SUM value
    Code:
    SELECT SUM(pplog) AS ppsum...
    then you can
    PHP Code:
    $get_row->ppsum 
    Thank you

    Best Regards Xkay

IMN logo majestic logo threadwatch logo seochat tools logo