|
Posted by Dominik Szczurek on 02/04/06 16:52
Hello to anyone who is tring to help me :-)
As I was writed in the topic I have problem when somone input 0 value in the
form.
PHP is losting this value when it try to write it to mySQL.
I have php version 4.3.11 mysql 4.1.14 and apache 2.0.53
Please help because I don't know what is wrong.
The column type in database is float. When I try to add some record thru the
phpmyadmin for exapmle, everything is all right.
It is also right when the value is 0.0 but mysql save it as 0
Below is code from php (first the form in html, second sql statement in php)
--html--
<tr class=wiersz_2 valign="center" align="center" >
<td align="right">ZasadowoΆζ typu p :</td>
<td>
<input maxlength="6" size="6" name="zasadowosc_typu_p" tabindex="3">
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
--html--
--php--
if(!empty($_POST['zasadowosc_typu_p'])) $zasadowosc_typu_p_b =
(double)$_POST['zasadowosc_typu_p'];
else
|
$zasadowosc_typu_p_b = -1; (I even try to change
temporary type of this variable)
if(!empty($_POST['twardosc_ogolna_w'])) $twardosc_ogolna_w_b =
$_POST['twardosc_ogolna_w'];
else
$twardosc_ogolna_w_b = -1;
..
..
..
$SQL = "INSERT INTO pomiary (obiekt, nazwa_pomiaru, wartosc, id_datap)";
$SQL .= " (SELECT '{$_SESSION['obiekt_b']}', 'zasadowosc_typu_p',
$zasadowosc_typu_p_b, datap.id";
$SQL .= " FROM datap";
$SQL .= " WHERE datap.id = (SELECT max(datap.id) from datap))";
$ResultSQL = mysql_query($SQL);
$SQL = "INSERT INTO pomiary (obiekt, nazwa_pomiaru, wartosc, id_datap)";
$SQL .= " (SELECT '{$_SESSION['obiekt_b']}', 'twardosc_ogolna_w',
$twardosc_ogolna_w_b, datap.id";
$SQL .= " FROM datap";
$SQL .= " WHERE datap.id = (SELECT max(datap.id) from datap))";
$ResultSQL = mysql_query($SQL);
--php--
Navigation:
[Reply to this message]
|