PHP isn't updating with the MYSQL database -
the code below shows connection reach mysql database, reason once grabs details database doesn't update php page after that. example, table lastwinner string datatype contains "david". after saving php file output shows david, if change value in mysql database output doesn't change afterwards.
<div id="navigation"> <?php $host = "localhost"; $username = "db_user"; $password = "password"; $db_name = "db_name"; $message = "the last person win lottery is: "; mysql_connect("$host", "$username", "$password") or die (mysql_error ()); mysql_select_db("$db_name") or die(mysql_error()); $total = "select lastwinner total info"; $rs = mysql_query($total); while($row = mysql_fetch_array($rs)) { echo $message.$row['total']; } mysql_close(); ?> </div>
heres code sends data database itself.
public static boolean updateinfo() { try { if (settings.disablemysql == true) return false; statement stmt = connection.createstatement(); if (lottery.getcurrentlotterywinner() == null && lottery.getlastlotterywinner() == null) stmt.executeupdate("update info set lastwinner = 'there current isn't lottery winner!'"); else if (lottery.getcurrentlotterywinner() != null && lottery.getlastlotterywinner() == null) stmt.executeupdate("update info set lastwinner = '" + lottery.getcurrentlotterywinner() + "'"); else stmt.executeupdate("update info set lastwinner = '" + lottery.getlastlotterywinner() + "'"); stmt.executeupdate("update info set moneyearned = '" + lottery.options.size() + "'"); } catch (throwable e) { if (system.currenttimemillis() - lastconnection > 10000) { destroyconnection(); createconnection(); lastconnection = system.currenttimemillis(); } } return false; }
my webhost having difficulties , did made work.
Comments
Post a Comment