Jump to content

jng

New Members
  • Posts

    2
  • Joined

  • Last visited

jng's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. jng

    Newbie needs help.

    ok, I made some code changes to fix a couple of mistake. thanks for the links-i'll keep them handy.
  2. I am a newbie and I am in need of some help. Currently, I have a email being piped to a program via cpanel "forwarder" advance tap. The parsing seeems to be doing its function but I cannot get it to insert the data into the table. HEre is hte code prior to insert. Can someone help me understand how to write this correct. The idea is that for every new alert extract the date, then insert in to the table. yOU help would be appreciated! $sql = "INSERT INTO `LOG_TABLE` (`Type`, `Symbol`, `Score`, `Timestamp`) VALUES "; foreach($alerts as $alert) { preg_match("!^Alert[1-9]+ \((MRI|QT)\):<br />(.*?)$!i", trim($alert), $m); $stocks = explode(", ", trim($m[2])); foreach($stocks as $stock) { list($symbol, $score) = explode(":", $stock); $sql .= "('".$m[1]."', '".$symbol."', '".$score."', FROM_UNIXTIME(now()), "; } } $sql = trim($sql, " ,"); if ( ! empty($sql) ) mysqli_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS); mysqli_select_db(DB); mysqli_query($sql)or die(mysql_error()); } exit(0);
×
×
  • 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.