+ Reply to Thread
Results 1 to 1 of 1

Thread: PHP SQL Query not working correctly

  1. #1
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    PHP SQL Query not working correctly

    http://new.monmouthchineseschool.com...e/textbook.php

    if you take a look at 'C1'
    一 十 十一 十二 十三 二 三 四 五 六 七 八 九
    that is how all the links look like.
    this is the mysql db for that class
    Code:
    CREATE TABLE IF NOT EXISTS `mon_textbook` (
      `id` int(11) NOT NULL auto_increment,
      `class` varchar(255) NOT NULL,
      `ch` varchar(255) NOT NULL,
      `sTitle` varchar(255) NOT NULL,
      `fTitle` varchar(255) NOT NULL,
      `text` longtext NOT NULL,
      UNIQUE KEY `id` (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=117 ;
    
    --
    -- Dumping data for table `mon_textbook`
    --
    
    INSERT INTO `mon_textbook` (`id`, `class`, `ch`, `sTitle`, `fTitle`, `text`) VALUES
    (14, 'C1', '1', '一', '第一課', ''),
    (15, 'C1', '2', '二', '第二課', ''),
    (16, 'C1', '3', '三', '第三課', ''),
    (17, 'C1', '4', '四', '第四課', ''),
    (18, 'C1', '5', '五', '第五課', ''),
    (19, 'C1', '6', '六', '第六課', ''),
    (20, 'C1', '7', '七', '第七課', ''),
    (21, 'C1', '8', '八', '第八課', ''),
    (22, 'C1', '9', '九', '第九課', ''),
    (23, 'C1', '10', '十', '第十課', ''),
    (24, 'C1', '11', '十一', '第十一課', ''),
    (25, 'C1', '12', '十二', '第十二課', ''),
    (26, 'C1', '13', '十三', '第十三課', '');
    the sql query that calls it
    PHP Code:
    $sql 'SELECT * FROM '.dbPre.'textbook WHERE `class`="'.$textbookClass[$ii].'" ORDER BY `ch` ASC'
    instead of looking like how it is above, it should look like this
    一 二 三 四 五 六 七 八 九 十 十一 十二 十三


    Edit:
    I got it fixed.
    http://stackoverflow.com/questions/2...ing-the-column
    `ch` needed to be an integer type
    Last edited by diabolo; 02-06-2010 at 07:55 PM.

+ Reply to Thread

Similar Threads

  1. PHP mail() stopped working
    By wbaptist in forum Free Hosting
    Replies: 1
    Last Post: 02-05-2010, 11:57 AM
  2. tons of PHP Resources
    By Chris S in forum Scripts & 3rd Party Apps
    Replies: 10
    Last Post: 01-16-2009, 10:07 AM
  3. Zend Optimizer not working on PHP v2?
    By civilr in forum Free Hosting
    Replies: 3
    Last Post: 02-19-2008, 01:14 AM
  4. Replies: 6
    Last Post: 11-26-2007, 06:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers