column does not exist

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    column does not exist

    hello, anyone has this table of trivia?
    PHP Code:
    $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'

    #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
    Wapchat4u


    Topsites4u

    Comment


      #3
      do not understand, as I do?
      PHP Code:
      --
      -- 
      Dumping data for table `trivia`
      --
      LOCK TABLES `triviaWRITE;
      /*!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` (
        `
      idint(11NOT NULL auto_increment,
        `
      uidtext NOT NULL,
        `
      mesajtext NOT NULL,
        `
      identificaretext,
        `
      raspunstext,
        `
      timptext NOT NULL,
        `
      validtext,
        
      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 `trivia1WRITE;
      /*!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` (
        `
      idint(11NOT NULL auto_increment,
        `
      uidtext NOT NULL,
        `
      mesajtext NOT NULL,
        `
      identificaretext,
        `
      raspunstext,
        `
      timptext NOT NULL,
        `
      validtext,
        
      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 `trivia3WRITE;
      /*!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` (
        `
      idint(11NOT NULL auto_increment,
        `
      uidtext NOT NULL,
        `
      mesajtext NOT NULL,
        `
      identificaretext,
        `
      raspunstext,
        `
      timptext NOT NULL,
        `
      validtext,
        
      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 `trivia5WRITE;
      /*!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` (
        `
      idint(11NOT NULL auto_increment,
        `
      uidtext NOT NULL,
        `
      mesajtext NOT NULL,
        `
      identificaretext,
        `
      raspunstext,
        `
      timptext NOT NULL,
        `
      validtext,
        
      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 `trivia6WRITE;
      /*!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` (
        `
      idint(11NOT NULL auto_increment,
        `
      uidtext NOT NULL,
        `
      mesajtext NOT NULL,
        `
      identificaretext,
        `
      raspunstext,
        `
      timptext NOT NULL,
        `
      validtext,
        
      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 `trivia7WRITE;
      /*!40000 ALTER TABLE `trivia7` DISABLE KEYS */;
      /*!40000 ALTER TABLE `trivia7` ENABLE KEYS */;
      UNLOCK TABLES

      Comment


        #4
        You are missing the trivia table try this

        PHP Code:
        CREATE TABLE `trivia` (
          `
        trivia_idint(4unsigned zerofill NOT NULL auto_increment,
          `
        questiontext NOT NULL,
          `
        answervarchar(100NOT NULL default '',
          `
        alternative1varchar(100) default NULL,
          `
        alternative2varchar(100) default NULL,
          
        PRIMARY KEY  (`trivia_id`)
        ); 
        Last edited by wap2k; 12.06.11, 13:05.

        Comment


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

          Comment


            #6
            Originally posted by Leviathan73 View Post
            Now I checked this
            Unknown column 'catname' in 'field list'
            Run this command

            PHP Code:
            ALTER TABLE `triviaADD `catnameTEXT NOT NULL 
            or delete the old table and replace with

            PHP Code:
            CREATE TABLE `trivia` (
              `
            trivia_idint(4unsigned zerofill NOT NULL auto_increment,
              `
            questiontext NOT NULL,
              `
            answervarchar(100NOT NULL default '',
              `
            alternative1varchar(100) default NULL,
              `
            alternative2varchar(100) default NULL,
              `
            catnamevarchar(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.
            Last edited by wap2k; 12.06.11, 14:23.

            Comment


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

              Comment


                #8
                Originally posted by Leviathan73 View Post
                it replaced, now there is this
                Unknown column 'catid' in 'field list'
                Originally posted by Leviathan73 View Post
                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

                PHP Code:
                ALTER TABLE `triviaADD `catidINT255 NOT NULL 
                or delete the old table and replace with

                PHP Code:
                CREATE TABLE `trivia` (
                  `
                trivia_idint(4unsigned zerofill NOT NULL auto_increment,
                  `
                questiontext NOT NULL,
                  `
                answervarchar(100NOT NULL default '',
                  `
                alternative1varchar(100) default NULL,
                  `
                alternative2varchar(100) default NULL,
                  `
                catnamevarchar(100) default NULL,
                  `
                catidint(255NOT 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.

                Comment


                  #9
                  wap2k Thank you for your patience, it works

                  Comment

                  Working...
                  X