Jump to content

Texan78

Members
  • Posts

    272
  • Joined

  • Last visited

Posts posted by Texan78

  1. it's likely they are not exactly the same errors/line numbers as what you posted at the top of this thread.

     

     

    They are EXACTLY the same line numbers. I copy and pasted them into a notepad to save for later then commented out the DB connection to stop it from making connections. 

     

    This.... 

    /* Lets connect to the database */     
    //include('dbconn.php');
    

    Has zero to do with the error as I still get the SAME error regardless if it is commented out or not. So ignore it even exists. Had I not posted that part at all then I am sure I would be getting completely different responses. 

     

    No worries, thanks for the help. Its apparent no one is looking BEYOND what I am saying and only focusing on that being commented out instead of listening to what I am saying that it doesn't matter. I get the same error regardless even with waiting a couple hours which is plenty of time for the varnish cache to clear. 

  2. So I guess I just fantasized that someone gained root access via shell.

     

    So I guess it is completely valid to comment out the entire query which renders the entire script useless. 

     

    So I guess that if I uncomment the DB connection it will work perfectly fine with no errors correct? That is what you're saying right? 

     

    Guess what, it is uncommented, the errors have returned. So now what all mighty know it all? What does your magic 8 ball have to say about that? 

     

    Cool story bro? Yeah stick it keyboard warrior.

  3. Again, the errors were happening BEFORE I commented out the code. I commented it out because it was throwing errors in the logs BEFORE commenting it out. It was also causing performance and resource issues on my host which was causing the page not to load. I commented it out in the script AND on the page it was being included on until I could resolve the issue. Once I did both those things the page loaded AND the errors went away. 

  4. I have a serious issue. I am not sure if I have been hacked or what but my site is completely messed up. I have a ton of these errors in the error log and I am not sure what is causing this. I don't recall this being part of the script

     

     

    PHP Notice:  Undefined variable: mysqli in /home2/mesquiu0/public_html/stream/inc/streamNotify.php on line 9

    PHP Fatal error:  Call to a member function query() on a non-object in /home2/mesquiu0/public_html/stream/inc/streamNotify.php on line 9

     

    Which is referring to this line. 

    //lets execute the query
    $executingFetchQuery = $mysqli->query("SELECT `StreamStatus` FROM streamdb WHERE 1");
    if($executingFetchQuery)
    {
       while($arr = $executingFetchQuery->fetch_assoc())
       {
            $resultArr[] = $arr['StreamStatus'];//storing values into an array
       }
    }
    

    This is the full code. 

    /* Lets connect to the database */     
    //include('dbconn.php');
              
    $resultArr = array();//to store results
    
    
    //lets execute the query
    $executingFetchQuery = $mysqli->query("SELECT `StreamStatus` FROM streamdb WHERE 1");
    if($executingFetchQuery)
    {
       while($arr = $executingFetchQuery->fetch_assoc())
       {
            $resultArr[] = $arr['StreamStatus'];//storing values into an array
       }
    }
    
    
         $counts = array_count_values($resultArr);//lets count the results
         $online = $counts['true'];
    
    
    // Let's assign the table some styles
         $divStyle = "padding:5px; margin:auto; margin-bottom:20px";
    
    
    // Lets assemble the banners to display
         $notifyOffline = "<div class='alert alert-danger' style='{$divStyle}' role='alert' data-toggle='tooltip' data-placement='top' title='There are currently no chasers streaming at this time.'> There are currently no chasers streaming at this time.</div>";
    
    
         $notify1Online = "<div class='alert alert-success' style='{$divStyle}' role='alert' data-toggle='tooltip' data-placement='top' title='There is currently 1 chaser streaming LIVE...'> There is currently 1 chaser streaming LIVE... </div>";
    
    
         $notifyOnline = "<div class='alert alert-success' style='{$divStyle}' role='alert' data-toggle='tooltip' data-placement='top' title='There are currently ".$online." chasers streaming LIVE...'> There are currently ".$online." chasers streaming LIVE... </div>";
    
    
    
    
    //lets display the banners
    if ( $online == "1" ) {
        echo $notify1Online;
    } elseif ( $online >= "2" ) {
        echo $notifyOnline;
    } else {
        echo $notifyOffline;
    }

    Any and ALL help would be greatly welcomed. 

     

    -THANKS!

  5. yes, $type is one variable, it's an array variable. it has more than one dimension. each array index references a different element of the array variable.

     

    there is a posted example showing how to use the $type array, for one of the stated purposes, of replacing the switch/case statement. that example would be this code - 

    $alertID = '';
    $alertClass = '';
    if(isset($type[$event]))
    {
        list($alertID,$alertClass) = $type[$event];
    }

    i'm guessing you don't understand what that is doing?

     

    $type is the array that has been defined and has had four elements assigned to it.

     

    the 'Tornado Warning', 'Severe Thunderstorm Warning', 'Flash Flood Warning', and 'Flood Warning' are the array indexes.

     

    supplying a literal array index name - $type['Flash Flood Warning'] in some code would reference the id and class values that are stored/assigned for the flash flood warning array index value.

     

    supplying a variable array index name - $type[$event] (assuming that $event is a string, rather than an simplexmlelement object) in some code would use the value in $event as the array index and would reference the id and class values that are stored/assigned for whatever is in $event.

     

    using isset($type[$event]) is testing if the element in the array $type, given by the array index name in $event is set.

     

    using list($alertID,$alertClass) = $type[$event]; is referencing the element in the array $type, given by the array index name in $event, and assigning the id and class values that are stored for that array index name to the $alertID and $alertClass variables.

     

    note: once your code has parsed and filtered the xml data so that only data having those four types is being processed and displayed, there's no need for the if(...){...} conditional logic or initializing the $alertID and $alertClass to empty strings. the event types in the data being looped over will be in the $type array and you only need the - list($alertID,$alertClass) = $type[$event]; line of code.

     

     

    Should I guess how to implement those snippets or you going to show me an example of how to implement it into my current code since you're not making any sense or listening to anything I am saying. I also can't ditch the IF statement because it is doing two different things as it is suppose to. 

     

    Have you ever heard of the KISS method? 

  6. don't know what that is referring to, since nothing posted is doing that.

     

    This is doing just that. What is set in the array is style classes and IDs. From what I can tell that is assigning it to the same variable $type.  This is the alert or event ['Tornado Warning'] and these are styles array('Tornado', 'AlertTornado');

    $type = array();
    $type['Tornado Warning'] = array('Tornado', 'AlertTornado');
    $type['Severe Thunderstorm Warning'] = array('SevereThunderstorm','AlertSevereThunderstorm');
    $type['Flash Flood Warning'] = array('FlashFlood','AlertFlood');
    $type['Flood Warning'] = array('FlashFlood','AlertFlood');
    

     

     

    the errors you are getting, which you didn't post, but i'll guess anyway, are either due to this - $type = array($event);, which isn't what i posted, that's creating an array with $event as the value in it

     

     

    How else am I going to pass the values to it to filter out what I want? It's not just going to know if you don't pass something to it to filter through. 

     

    Like I said, those snippets would probably be useful it you included examples of how to implement it into my current code.

  7. lastly, i'm sure in one or more of your threads, it has been suggested (by me) to not write out php logic just to map one value to another. you should use a simple mapping array. see the following - 

    // define a map of the event type string, to any other values. the two entries are the alertID and the alertClass
    // this defining array is also used in the parsing code to control what event types are kept - if $type[$event] isset(), keep the data
    // is it also used when displaying the data. the order of the entries here controls the output order, by looping over the keys (see array_keys() ) from this array to access the parsed data in the same order
    $type = array();
    $type['Tornado Warning'] = array('Tornado', 'AlertTornado');
    $type['Severe Thunderstorm Warning'] = array('SevereThunderstorm','AlertSevereThunderstorm');
    $type['Flash Flood Warning'] = array('FlashFlood','AlertFlood');
    $type['Flood Warning'] = array('FlashFlood','AlertFlood');

     

     

    Why on Gods green earth would you ever want to assign your style classes and IDs to the same variable that's outputting data?  

    Lastly, the switch is being used in more than just once script on other areas of the site. Which is why it is being used in a included file so I can pull what I need instead of having to write the logic out every single time across multiple scripts. Which BTW, was something that was suggested by a member of this forum several years ago when that script was originally created. As I have mentioned before as well, that is the thing about PHP and online forums. You will get multiple ways to do the same thing and not everyone is going to agree. 

     

    Those snippets would probably be useful it you included how to implement it into my current code because this below doesn't work and throws tons of errors. 

    // get path info & protect for cross-site scripting vulnerability
    $sri = ($_SERVER['REQUEST_URI']) ? str_replace('#SA', '', htmlspecialchars(strip_tags($_SERVER['REQUEST_URI']))) : '';
    
    $error = false;
    
    //Set initial output to false
    $AlertData = false;
    $entries = simplexml_load_file($data);
    if(count($entries)):
        //Registering NameSpace
        $entries->registerXPathNamespace('prefix', 'http://www.w3.org/2005/Atom');
        $result = $entries->xpath("//prefix:entry");
    if(!$result){
    $error = true;
    }
        foreach ($result as $entry):
            $updated = $entry->updated;
    if($updated == ''){
    $error = true;
    }
            $Updated = date("D, M d, g:i a", strtotime($updated));
            $summary = $entry->summary;
    if($summary == ''){
    $error = true;
    }
    
      // Replaces all triple periods with single periods
            $summary = trim(str_replace('...', '.', $summary), '.') . '.';
    
    
      //now capitalize every letter after a . ? and ! followed by space
            $Summary = preg_replace_callback('/([.!?*])\s*(\w)/', function ($matches) {
                return strtoupper($matches[1] . ' ' . $matches[2]);
                }, ucfirst(strtolower($summary)));
            $event = $entry->children("cap", true)->event;
              if($event == ''){
            $error = true;
            }       
            $updated = $entry->updated;
            $link = $entry->link;
            $effective = $entry->children("cap", true)->effective;
            $expires = $entry->children("cap", true)->expires;
            $updated = date("l M jS, g:i A", strtotime($updated));
            $effectiveDate = date("l M jS, g:i A", strtotime($effective));
            $expiresDate = date("D M jS, g:i A", strtotime($expires));
            $status = $entry->children("cap", true)->status;
            $severity = $entry->children("cap", true)->severity;
            $urgency = $entry->children("cap", true)->urgency;
            $area = $entry->children("cap", true)->areaDesc;
    
            //include ('alertColors.php');
            
            $type = array($event);
              $type['Tornado Warning'] = array('Tornado', 'AlertTornado');
              $type['Severe Thunderstorm Warning'] = array('SevereThunderstorm','AlertSevereThunderstorm');
              $type['Flash Flood Warning'] = array('FlashFlood','AlertFlood');
              $type['Flood Warning'] = array('FlashFlood','AlertFlood');
              
            $alertID = '';
            $alertClass = '';
               if(isset($type[$event]))
           {
               list($alertID,$alertClass) = $type[$event];
           }
            
       // Let's assign the table some styles
         $divNoStorms = "padding:5px; width:50%; margin:auto; margin-top:5px; margin-bottom:5px";
    
      // If no storms were in the source, set no storm message
    if($error) {
         $AlertData .= "<div style='{$divNoStorms}' class='alert alert-danger' role='alert' data-toggle='tooltip' data-placement='top' title='There are currently no active severe weather alerts.'>\n";
         $AlertData .= "{$noStormMessage}\n";
         $AlertData .= "</div>\n";
    } else {
        $AlertData .= "<div class='col-md-3'>\n";
        $AlertData .= "<div id='{$alertID}' class='individualAlert'>\n";
        $AlertData .= "<div class='text_alert'>\n";
        $AlertData .= "<span class='title {$alertClass}'><i class='fa fa-exclamation-triangle severe-icon__tornado'></i>{$type}</span>\n";
        $AlertData .= "<span class='state'>{$stateShort}</span>\n";
        $AlertData .= "<span class='counties'>{$area}</span>\n";
        $AlertData .= "<span class='expires'>Expires: {$expiresDate}</span>\n";
        $AlertData .= "</div>\n";
        $AlertData .= "<div class='alert__view'>\n";
        $AlertData .= "<span class='fa fa-eye'></span>\n";
        $AlertData .= "</div>\n";
        $AlertData .= "</div>\n";
    }
        $AlertData .= "</div>\n";
    
           endforeach;
    endif;
    
    echo $AlertData;
    
  8. Well one brain fart solved. This seems to work for producing 4 columns per row. Will need to keep an eye on it to see if it messes up when there isn't equal number of entries. 

    // If no storms were in the source, set no storm message
    if($error) {
         $AlertData .= "<div class='alert alert-danger' style='padding:5px;' role='alert' data-toggle='tooltip' data-placement='top' title='There are currently no active severe weather alerts.'>\n";
         $AlertData .= "{$noStormMessage}\n";
         $AlertData .= "</div>\n";
    } else {
        $AlertData .= "<div class='col-md-3'>\n";
        $AlertData .= "<div id='{$alertID}' class='individualAlert'>\n";
        $AlertData .= "<div class='text_alert'>\n";
        $AlertData .= "<span class='title {$alertClass}'><i class='fa fa-exclamation-triangle severe-icon__tornado'></i> {$event}</span>\n";
        $AlertData .= "<span class='state'>{$stateShort}</span>\n";
        $AlertData .= "<span class='counties'>{$area}</span>\n";
        $AlertData .= "<span class='expires'>Expires: {$expiresDate}</span>\n";
        $AlertData .= "</div>\n";
        $AlertData .= "<div class='alert__view'>\n";
        $AlertData .= "<span class='fa fa-eye'></span>\n";
        $AlertData .= "</div>\n";
        $AlertData .= "</div>\n";
    }
        $AlertData .= "</div>\n";
    
           endforeach;
    endif;
    
    echo $AlertData;
    
                     <div class="panel-body" style="background-color: #878787; padding: 5px;">
                        <div class='row'>
                           <div id="alerts"></div>
                        </div>
                     </div> 
    

    So last issue is only pulling certain events or in this case "alerts" and prioritizing them so they will show in a certain order. This one seems to be puzzling me.

  9. Parsing the XML file is not my issue. The specific nodes I am parsing are in my original post within the first code block. I am able to do that just fine and create variables to insert into the HTML. The issues are as follows... 

     

    1. Only show certain events and sort them by priority to show certain ones first.

    $event = $entry->children("cap", true)->event;
    if($event == 'Tornado Warning, Severe Thunderstorm Warning, Flash Flood Warning, Flood Warning') 

    2. Dynamically create the Bootstrap columns (4) for each row to display the parsed information. 

  10. Quick update since it won't let me edit my original post. If I put the Bootstrap in the PHP like so...

    // If no storms were in the source, set no storm message
    if($error) {
         $AlertData .= "<div class='alert alert-danger' style='padding:5px;' role='alert' data-toggle='tooltip' data-placement='top' title='There are currently no active severe weather alerts.'>\n";
         $AlertData .= "{$noStormMessage}\n";
         $AlertData .= "</div>\n";
    } else {
        $AlertData .= "<div class='row'>\n";
        $AlertData .= "<div class='col-md-3'>\n";
        $AlertData .= "<div id='Tornado' class='individualAlert'>\n";
        $AlertData .= "<div class='text_alert'>\n";
        $AlertData .= "<span class='title AlertTornado'><i class='fa fa-exclamation-triangle severe-icon__tornado'></i> {$event}</span>\n";
        $AlertData .= "<span class='state'>TX</span>\n";
        $AlertData .= "<span class='counties'>{$area}</span>\n";
        $AlertData .= "<span class='expires'>Expires: {$expiresDate}</span>\n";
        $AlertData .= "</div>\n";
        $AlertData .= "<div class='alert__view'>\n";
        $AlertData .= "<span class='fa fa-eye'></span>\n";
        $AlertData .= "</div>\n";
        $AlertData .= "</div>\n";
        $AlertData .= "</div>\n";
        $AlertData .= "</div>\n";
    }
    
           endforeach;
    endif;
    
    echo $AlertData;
    

    With it in the HTML page like so....

                     <div class="panel-body" style="background-color: #878787; padding: 5px;">
                        <?php include ('inc/alerts.php'); ?>
                     </div>
    

    It still prints it out down instead of columns of 4 across. 

  11. Hello, I am trying to repurpose some old code and update it to use Bootstrap. This is a two part question so I will try to keep it short. First part. I am parsing an XML URL with simpleXML and setting variables to return values to use in some HTML code. This worked great when it was first written years ago but, I need to sort through the values in this case "event" and only show certain events and then sort those show it shows certain ones first before others. For brevity I am only showing the relevant code.

    // get path info & protect for cross-site scripting vulnerability
    $sri = ($_SERVER['REQUEST_URI']) ? str_replace('#SA', '', htmlspecialchars(strip_tags($_SERVER['REQUEST_URI']))) : '';
    
    $error = false;
    
    //Set initial output to false
    $AlertData = false;
    $entries = simplexml_load_file($data);
    if(count($entries)):
        //Registering NameSpace
        $entries->registerXPathNamespace('prefix', 'http://www.w3.org/2005/Atom');
        $result = $entries->xpath("//prefix:entry");
    if(!$result){
    $error = true;
    }
        foreach ($result as $entry):
            $updated = $entry->updated;
    if($updated == ''){
    $error = true;
    }
            $Updated = date("D, M d, g:i a", strtotime($updated));
            $summary = $entry->summary;
    if($summary == ''){
    $error = true;
    }
    
      // Replaces all triple periods with single periods
            $summary = trim(str_replace('...', '.', $summary), '.') . '.';
    
    
      //now capitalize every letter after a . ? and ! followed by space
            $Summary = preg_replace_callback('/([.!?*])\s*(\w)/', function ($matches) {
                return strtoupper($matches[1] . ' ' . $matches[2]);
                }, ucfirst(strtolower($summary)));
            $event = $entry->children("cap", true)->event;
    if($event == 'Tornado Warning, Severe Thunderstorm Warning, Flash Flood Warning'){
    $error = true;
    }       $updated = $entry->updated;
            $effective = $entry->children("cap", true)->effective;
            $expires = $entry->children("cap", true)->expires;
            $updated = date("l M jS, g:i A", strtotime($updated));
            $effectiveDate = date("l M jS, g:i A", strtotime($effective));
            $expiresDate = date("l M jS, g:i A", strtotime($expires));
            $status = $entry->children("cap", true)->status;
            $severity = $entry->children("cap", true)->severity;
            $urgency = $entry->children("cap", true)->urgency;
            $area = $entry->children("cap", true)->areaDesc; 

     Take notice to this insert below from the code above where I have defined what events to show. So it should only show those events but, instead it still shows all of them. 

    $event = $entry->children("cap", true)->event;
    if($event == 'Tornado Warning, Severe Thunderstorm Warning, Flash Flood Warning')
    

    Second part is I need this to show in 4 columns across in one row but, it just displays them down. I have experimented with some but not sure how to currently place the bootstrap code so it displays 4 columns per row then starts a new row. The image below shows the output going down. The yellow and green are hard coded for example of what I am wanting it to do. 

     

    bootstrap.png

     

     

    Here is the code for the output in red that is going down when it should be going across. 

    // If no storms were in the source, set no storm message
    if($error) {
         $AlertData .= "<div class='alert alert-danger' style='padding:5px;' role='alert' data-toggle='tooltip' data-placement='top' title='There are currently no active severe weather alerts.'>\n";
         $AlertData .= "{$noStormMessage}\n";
         $AlertData .= "</div>\n";
    } else {
        $AlertData .= "<div id='Tornado' class='individualAlert'>\n";
        $AlertData .= "<div class='text_alert'>\n";
        $AlertData .= "<span class='title AlertTornado'><i class='fa fa-exclamation-triangle severe-icon__tornado'></i> {$event}</span>\n";
        $AlertData .= "<span class='state'>TX</span>\n";
        $AlertData .= "<span class='counties'>{$area}</span>\n";
        $AlertData .= "<span class='expires'>Expires: {$expiresDate}</span>\n";
        $AlertData .= "</div>\n";
        $AlertData .= "<div class='alert__view'>\n";
        $AlertData .= "<span class='fa fa-eye'></span>\n";
        $AlertData .= "</div>\n";
        $AlertData .= "</div>\n";
    }
    
           endforeach;
    endif;
    
    echo $AlertData;
    

    Then the raw HTML code.

    <div class="row">
                          <div class="col-md-3">
                                            <!-- <span>Active Tornado Warnings</span> -->
                                            <?php include ('inc/alerts.php'); ?>
                          </div>
                          <div class="col-md-3">
                                            <!-- <span>Active Severe Thunderstorm Warnings</span> -->
                                            <div id="SevereThunderstorm" class="individualAlert">
                                                <div class="text_alert">
                                                    <span class="title AlertSevereThunderstorm"><i class="fa fa-exclamation-triangle severe-icon__thunderstorm"></i> SEVERE THUNDERSTORM WARNING TEST</span>
                                                    <span class="state">TX</span>
                                                    <span class="counties">DALLAS</span>
                                                    <span class="expires">Expires: 12:00 PM CST</span>
                                                </div>
                                                <div class="alert__view">
                                                    <span class="fa fa-eye"></span>
                                                </div>
                                            </div>
                          </div>
                          <div class="col-md-3">
                                            <!-- <span>Active Flash Flood Warnings</span> -->
                                           <div id="FlashFlood" class="individualAlert">
                                                <div class="text_alert">
                                                    <span class="title AlertFlood"><i class="fa fa-exclamation-triangle severe-icon__flood"></i> FLASH FLOOD WARNING TEST</span>
                                                    <span class="state">TX</span>
                                                    <span class="counties">DALLAS</span>
                                                    <span class="expires">Expires: 12:00 PM CST</span>
                                                </div>
                                                <div class="alert__view">
                                                    <span class="fa fa-eye"></span>
                                                </div>
                                           </div>
                          </div>                  
                          <div class="col-md-3">
                                            <!-- <span>Active Flash Flood Warnings</span> -->
                                           <div id="FlashFlood" class="individualAlert">
                                                <div class="text_alert">
                                                    <span class="title AlertFlood"><i class="fa fa-exclamation-triangle severe-icon__flood"></i> FLASH FLOOD WARNING TEST</span>
                                                    <span class="state">TX</span>
                                                    <span class="counties">DALLAS</span>
                                                    <span class="expires">Expires: 12:00 PM CST</span>
                                                </div>
                                                <div class="alert__view">
                                                    <span class="fa fa-eye"></span>
                                                </div>
                                           </div>
                          </div>                  
                        </div>
    
    

    I am sure I need to add <div class="row"> <div class="col-md-3"> in my PHP code but I am not sure how and the things I have tried had not worked.

     

    -Thanks

  12. Never mind, I got it sorted with the following. 

    <div class="right">
       <h3 class="panel-title">
          <?php if ($ncopeland['streamStatus'] == 'true' ) { echo '<span class="label label-success"><i class="fa fa-video-camera" title="Stream Online"></i> LIVE</span> <i class="fa fa-eye" aria-hidden="true" title="Current Viewers ' . $ncopeland['CurrentViewers'] . '"> <span style="font-size:12px;font-weight:bold; font-family: arial,helvetica;">' . $ncopeland['CurrentViewers'] . '</span>'; } else { echo '<span class="label label-important"><i class="material-icons" style="vertical-align:-4px; font-size:14px;" title="Steam Offline">videocam_off</i> OFFLINE</span>'; } ?></i>
       </h3>
    </div>
    
  13. For what I am trying to do this is not simplified, especially when using it in javascript versus using just $variable. Anyways, I am just going to roll with it and learn it as for what I am doing at this very moment it is sleek and compact for making unique variables and prevents duplicates when make multiple queries on a single page.

     

    With that said, I am not sure how to put this into HTML like I was doing before with this new method. How would I go about replacing the $CurrentViewers with $ksaunders['CurrentViewers'] as there is two places I need to add it and it's being used in HTML. Can I get an example please on how to properly insert and escape this? 

    <div class="right">
       <h3 class="panel-title">
          <?php if ($ksaunders['streamStatus'] == 'true' ) { echo "<span class='label label-success'><i class='fa fa-video-camera' title='Stream Online'></i> LIVE</span> <i class='fa fa-eye' aria-hidden='true' title='Current Viewers $CurrentViewers'> <span style='font-size:12px;font-weight:bold; font-family: arial,helvetica;'>$CurrentViewers</span>"; } else { echo "<span class='label label-important'><i class='material-icons' style='vertical-align:-4px; font-size:14px;' title='Steam Offline'>videocam_off</i> OFFLINE</span>"; } ?></i>
       </h3>
    </div> 

    Also would this be the proper way to add a space before a variable?

    echo ' ' .$ksaunders['DisplayName'];
    

    -Thanks

  14. I am sorry but I am having a hard time understanding what you're trying to say. None of that makes any sense to me at all. Using $row["DisplayName"] is not a simplified method versus using $DisplayName in my code nor is that a variable. Maybe you're misunderstanding what I am trying to say.  

     

    Is there more to this code that I am missing? 

    $sql = "SELECT gpsStatus, DisplayName, ChaserLocation, StreamStatus, CurrentViewers, TimeStamp FROM streamdb WHERE id = 1";
    $result = $mysqli->query($sql);
    $stream_data = $result->fetch_assoc();
    
    

    This is the only way I can get it to work for what I am needing. 

    /* Lets query the database and return the current values */  
    $sql = "SELECT gpsStatus, DisplayName, ChaserLocation, StreamStatus, CurrentViewers, TimeStamp FROM streamdb WHERE id = 2";
    $result = $mysqli->query($sql);
    $stream_data = $result->fetch_assoc();
    
    printf ("\n",$gpsStatus = $stream_data["gpsStatus"],$DisplayName = $stream_data["DisplayName"],$chaserLocation = $stream_data["ChaserLocation"],$status = $stream_data["StreamStatus"],$totalViewers = $stream_data["CurrentViewers"],$timeStamp = $stream_data["TimeStamp"]);
    
×
×
  • 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.