Zero entered into mysql table upon submit
Posted: Wed Aug 30, 2006 3:43 pm
feyd | Please use
my update sql is[/syntax]
when i echo my sql i get the following : highlighted the problem area in bold
can you please help i am really lost with this
cheers in advance
Andy
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
i am trying to update my mysql table with a drop down box (changed from a text box) but when i click submit i get a zero entered instead of the id number of the option:
I am trying to update the field called "bed"
i have a table that stores a yes no value in it (will be others just trying this for testing purposes.
[syntax="sql"]
CREATE TABLE `categories` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(50) default NULL,
`description` text,
`image` varchar(50) default NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=23 ;
--
-- Dumping data for table `categories`
--
INSERT INTO `categories` VALUES (14, 'Yes', '-', '');
INSERT INTO `categories` VALUES (15, 'No', '-', '');
my update sql is[/syntax]
Code: Select all
$updateSQL = sprintf("UPDATE items SET `long`=%s, `lat`=%s, cid=%s, title=%s, price=%s, special_price=%s, description=%s, address=%s, city=%s, `state`=%s, zip=%s, bed=".GetSQLValueString($_REQUEST['bed'],"int").", bath=".GetSQLValueString($_REQUEST['bath'],"text").", subdiv=".GetSQLValueString($_REQUEST['subdiv'],"text").", schoold = ".GetSQLValueString($_REQUEST['schoold'],"text").", year = ".GetSQLValueString($_REQUEST['year'],"int").", lot_size = ".GetSQLValueString($_REQUEST['lot_size'],"double").", sqft = ".GetSQLValueString($_REQUEST['sqft'],"double")." WHERE id=".GetSQLValueString($_REQUEST['id'],"int")."",
GetSQLValueString($address['long'], "text"),
GetSQLValueString($address['lat'], "text"),
GetSQLValueString($_POST['cat'], "int"),
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['price'], "double"),
GetSQLValueString($_POST['special_price'], "double"),
GetSQLValueString($_POST['description'], "text"),
GetSQLValueString($_POST['address'], "text"),
GetSQLValueString($_POST['city'], "text"),
GetSQLValueString($_POST['state'], "text"),
GetSQLValueString($_POST['zip'], "text"),
GetSQLValueString($_POST['id'], "int")
);Code: Select all
UPDATE items SET `long`=NULL, `lat`=NULL, cid=15, title=NULL, price='25', special_price=NULL, description='Simply immaculate detached Bungalow enjoying a highly desirable semi rural location with beautiful countryside views. Situated only a few minutes drive from Taunton, the County town of Somerset, Lithe Lochan is an exclusive, private residential estate with an amenity area. With full gas fired central heating and sealed unit double glazing, the accommodation is comprehensive, all on one floor and comprises: Entrance Vestibule, Hallway, Lounge, separate Dining Room, Study, fitted dining Riverside Kitchen with Family area off, Utility Room, WC,
BEDROOMS
Master Bedroom with En-Suite Shower Room and Dressing Room, 4 further Bedrooms and family Bathroom.
B&B Price per person: £25.00 - £35.00
Rooms: 4, consisting of 3 double en-suite, 1 twin private bathroom
Dogs: no dogs
When Open/Closed: Closed Xmas
Nearest Road/s: A38, A379 Local directions: ', address='home', city='Abergele', `state`='Som', zip='T12344', [B]bed=0[/B], bath='0', subdiv='0', schoold = '0', year = 0, lot_size = '0', sqft = NULL WHERE id=12cheers in advance
Andy
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]