column does not exist

Started on the old forum in June 2011 · view the original in the archive · old links redirect here

8 replies · 450 views · started 15 years ago · 1 min read

3 participants
Leviathan73 Senior · 260 posts #1

hello, anyone has this table of trivia?

$sql2 = mysql_query("SELECT trivia_id, question, answer, alternative1, alternative2 from trivia where trivia_id = $trivia_id");

when I add the questions tells me .. Unknown column 'trivia_id' in 'field list'

nclemale36 Lead · 537 posts #2

id suggest adding the field to your table .looks like the id field to me with trivia_ added to the start lol . make sure its auto increment

Leviathan73 Senior · 260 posts #3

do not understand, as I do?

--
-- Dumping data for table `trivia`
--
LOCK TABLES `trivia` WRITE;
/*!40000 ALTER TABLE `trivia` DISABLE KEYS */;
/*!40000 ALTER TABLE `trivia` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `trivia1`
--
DROP TABLE IF EXISTS `trivia1`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `trivia1` (
  `id` int(11) NOT NULL auto_increment,
  `uid` text NOT NULL,
  `mesaj` text NOT NULL,
  `identificare` text,
  `raspuns` text,
  `timp` text NOT NULL,
  `valid` text,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2427700 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `trivia1`
--
LOCK TABLES `trivia1` WRITE;
/*!40000 ALTER TABLE `trivia1` DISABLE KEYS */;
/*!40000 ALTER TABLE `trivia1` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `trivia3`
--
DROP TABLE IF EXISTS `trivia3`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `trivia3` (
  `id` int(11) NOT NULL auto_increment,
  `uid` text NOT NULL,
  `mesaj` text NOT NULL,
  `identificare` text,
  `raspuns` text,
  `timp` text NOT NULL,
  `valid` text,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2429498 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `trivia3`
--
LOCK TABLES `trivia3` WRITE;
/*!40000 ALTER TABLE `trivia3` DISABLE KEYS */;
/*!40000 ALTER TABLE `trivia3` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `trivia5`
--
DROP TABLE IF EXISTS `trivia5`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `trivia5` (
  `id` int(11) NOT NULL auto_increment,
  `uid` text NOT NULL,
  `mesaj` text NOT NULL,
  `identificare` text,
  `raspuns` text,
  `timp` text NOT NULL,
  `valid` text,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2330753 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `trivia5`
--
LOCK TABLES `trivia5` WRITE;
/*!40000 ALTER TABLE `trivia5` DISABLE KEYS */;
/*!40000 ALTER TABLE `trivia5` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `trivia6`
--
DROP TABLE IF EXISTS `trivia6`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `trivia6` (
  `id` int(11) NOT NULL auto_increment,
  `uid` text NOT NULL,
  `mesaj` text NOT NULL,
  `identificare` text,
  `raspuns` text,
  `timp` text NOT NULL,
  `valid` text,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2401144 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `trivia6`
--
LOCK TABLES `trivia6` WRITE;
/*!40000 ALTER TABLE `trivia6` DISABLE KEYS */;
/*!40000 ALTER TABLE `trivia6` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `trivia7`
--
DROP TABLE IF EXISTS `trivia7`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `trivia7` (
  `id` int(11) NOT NULL auto_increment,
  `uid` text NOT NULL,
  `mesaj` text NOT NULL,
  `identificare` text,
  `raspuns` text,
  `timp` text NOT NULL,
  `valid` text,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2330752 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `trivia7`
--
LOCK TABLES `trivia7` WRITE;
/*!40000 ALTER TABLE `trivia7` DISABLE KEYS */;
/*!40000 ALTER TABLE `trivia7` ENABLE KEYS */;
UNLOCK TABLES;

 
wap2k Developer · 168 posts #4

You are missing the trivia table try this

CREATE TABLE `trivia` (
  `trivia_id` int(4) unsigned zerofill NOT NULL auto_increment,
  `question` text NOT NULL,
  `answer` varchar(100) NOT NULL default '',
  `alternative1` varchar(100) default NULL,
  `alternative2` varchar(100) default NULL,
  PRIMARY KEY  (`trivia_id`)
);
Leviathan73 Senior · 260 posts #5

Now I checked this Unknown column 'catname' in 'field list'

wap2k Developer · 168 posts #6

Leviathan73 wrote: Now I checked this Unknown column 'catname' in 'field list'

Run this command

ALTER TABLE `trivia` ADD `catname` TEXT NOT NULL

or delete the old table and replace with

CREATE TABLE `trivia` (
  `trivia_id` int(4) unsigned zerofill NOT NULL auto_increment,
  `question` text NOT NULL,
  `answer` varchar(100) NOT NULL default '',
  `alternative1` varchar(100) default NULL,
  `alternative2` varchar(100) default NULL,
  `catname` varchar(100) default NULL,
  PRIMARY KEY  (`trivia_id`)
); 

I could fix it for you with the script just have to look through it. Could create a full table as is required.

Leviathan73 Senior · 260 posts #7

it replaced, now there is this Unknown column 'catid' in 'field list'

wap2k Developer · 168 posts #8

Leviathan73 wrote: it replaced, now there is this Unknown column 'catid' in 'field list'

Leviathan73 wrote: it replaced, now there is this Unknown column 'catid' in 'field list'

it is the same thing missing fields in the SQL run this command

ALTER TABLE `trivia` ADD `catid` INT( 255 ) NOT NULL

or delete the old table and replace with

CREATE TABLE `trivia` (
  `trivia_id` int(4) unsigned zerofill NOT NULL auto_increment,
  `question` text NOT NULL,
  `answer` varchar(100) NOT NULL default '',
  `alternative1` varchar(100) default NULL,
  `alternative2` varchar(100) default NULL,
  `catname` varchar(100) default NULL,
  `catid` int(255) NOT NULL,
  PRIMARY KEY  (`trivia_id`)
); 

I could fix it for you with the script just have to look through it. Could create a full table as is required.

Leviathan73 Senior · 260 posts #9

😊wap2k Thank you for your patience, it works

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close