Here is my code:
DATABASE SETUP
<?php
$user="k*********";
$password="*********";
$database="**********";
mysql_connect("localhost",$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "CREATE TABLE rn (
PID INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(PID),
dait CHAR(10),
rnfl INT ,
)";
mysql_query($query);
mysql_close();
?>
database update
<?php
// Connect to MySQL
mysql_connect("localhost", "*********", "**************") or die(mysql_error());
mysql_select_db("********") or die(mysql_error());
$dait="31/7/2014";
$rnfl=12.9;
// Update
$result = mysql_query("UPDATE rn SET dait='$dait', rnfl='$rnfl' WHERE id=1")
or die(mysql_error());
$result = mysql_query("SELECT * FROM rn WHERE id=1")
or die(mysql_error());
// get the first (and hopefully only) entry from the result
$row = mysql_fetch_array( $result );
echo $row['dait']." - ";
printf('(%5.2d mm)', $row['rnfl']);
?>
THIS IS WHAT I GET AFTER RUNNING THE UPDATE:
31/7/2014 - ( 13 mm)
what I am looking for is: -
31/7/2014 - (12.9 mm)
%finstead of%d.mysql_*functions; use MySQLi or PDO instead. Also, when you debug, remove those error-suppressing@mysql_function is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used.