N00B at PHP help please :)

[QUOTE=gazaweb;1027521]im glad you are here or i would be **word removed :open_mouth: **

right

i have this script that posts strings into a ajax updating shoutbox :smiley: fancy i know

now i have it reading a shoutcast xml and posting data on that

but i have it set so it posts every 3 times a post has been made in the shoutbox

i dont want it to do that

i want it to post every time the tune changes!

so

me: sup
:bot: current track: track 1
me: lalala
me: lalalalalaldfkjdfg
TRACK CHANGES TO TRACK 3
:BOT: Current: track: Track 3

i have it set so it posts the track like i said

so how would i get it to post when it changes?

[php]
//SHOUTBOX BOT
error_reporting(0);
include(’./radio/radio_stats.php’);

$status = ’ ';

if($streamstatus == “0”)
$status= ‘Offline’;
else
$status= 'Current Track: ’ . $song[0];

//$song[0]
$ls[‘frombot’] = $this->DB->buildAndFetch( array( ‘select’ => ‘*’, ‘from’ => ‘shoutbox_shouts’, ‘order’ => ‘s_id DESC’,
‘where’ => “s_ip=‘107.0.0.1’”,
‘limit’ => array(0, 1)
) );

 $ls['fromusr'] = $this->DB->buildAndFetch( array( 'select' => '*',                   'from'   => 'shoutbox_shouts',                                                  'order'  => 's_id DESC',
                    'limit'  => array(0, 1)
                                                      )              );

    $incamount = $this->settings['shoutbox_bot_frequency'];
    $botid = $ls['frombot']['s_id'];
    $recentid = $ls['fromusr']['s_id'];
    $new=$botid+$incamount;


                    if ($new < $recentid) {
            $this->DB->insert( 'shoutbox_shouts',
             array( 's_mid'     => $this->settings['shoutbox_bot_memid'],
            's_message' => $status,
              's_date'    => time(),
              's_ip'      => '107.0.0.1'
             )  );
                    }

            // ------------ End autoshoutbox mod ---------------

[/php][/QUOTE]

Sponsor our Newsletter | Privacy Policy | Terms of Service