Jump to content

rukiddin

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Everything posted by rukiddin

  1. This is a cross between HTML, PHP, and MySQL. I'm not exactly sure which to blame (other than myself of course) I'm collecting a bid price in a standard form <input type="number" name="maxbid" value="<?php echo $maxbid ?>"/> I have recalled the value from the database where I store it and display it in the field if it exists. If the field has never been entered, the field shows nothing. It's not required that a bid be entered. There are other fields of data that may be updated and this field is left blank. On the page called by the submit button I'm retrieving the fields $maxbid=$_POST[maxbid]; Then I store the fields in the database either with an INSERT or an UPDATE if(mysql_num_rows(mysql_query("SELECT id FROM data WHERE id = '$id'"))) { echo "Updating....."; mysql_query("UPDATE data SET maxbid='$maxbid', name='$name' where id='$id'"); } else { echo "Inserting....."; mysql_query("INSERT INTO data (id, maxbid,name) VALUES ('$id','$maxbid',$'name')"); } I know I'm not handling the Numeric values correctly, and I'm having a hard time finding the correct method for doing so. Right now, if the name is entered byt the maxbid is left blank, nothing gets inserted or updated. if I enter both the maxbid and the name it works. I can't have maxbid show up as a 0, I need it to be blank if nothing is entered. Also when I check $maxbid, it's not an INTEGER (per INTVAL) when I check it, even though maxbid in the table is an INTEGER. When I pass it around, it seems to lose it's INTEGER value, but still shows as a number. I know this sounds confusing, heck I'm confused. If someone could point me to a good tutorial, I'd figure it all out, but most tutorials don't get into the data type that much, and the combination of the form, passing the variables, reading the values from the database, etc. is what's causing me grief. Any guidance would be appreciated.
×
×
  • 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.