Jump to content

[SOLVED] Invalid query


jeff5656

Recommended Posts

I get: Invalid query: Unknown column 'f2a' in 'where clause'

 

but the table "rounder" does contain a column called service tht contains "f2a" in one of the records, so why doesn't this work?

 

<?php
$service = $_POST['service'];


$sql = "UPDATE rounder SET staff_name = '" . $_POST['staff_name'] . "' WHERE service = ".$_POST['service']."";
if (isset($sql) && !empty($sql)) {
$result = mysql_query($sql) or die ("Invalid query: " . mysql_error());
?>

 

here's my rounder table that I got from phpmyadmin:

CREATE TABLE `rounder` (

  `id_incr` int(254) NOT NULL auto_increment,

  `service` varchar(10) NOT NULL,

  `staff_name` varchar(20) NOT NULL,

  PRIMARY KEY  (`id_incr`),

  UNIQUE KEY `service` (`service`)

) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

 

--

-- Dumping data for table `rounder`

--

 

INSERT INTO `rounder` (`id_incr`, `service`, `staff_name`) VALUES

(1, 'f2a', 'jennings'),

(2, 'f2b', 'stagner');

 

 

Link to comment
https://forums.phpfreaks.com/topic/161739-solved-invalid-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.