Jump to content

Archived

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

AV1611

blank query result when using order by

Recommended Posts

this works fine, but not in the correct order
[code]
("Select * From bible where `$WhichBook` Like '$BOOK' and `chapter` like $CHAPTER")
[/code]
this HAS NO RETURNS!
[code]
("Select * From bible where `$WhichBook` Like '$BOOK' and `chapter` like $CHAPTER" ORDER BY `key` ASC)
[/code]


here is the table structure:

[code]
CREATE TABLE `bible` (
  `key` int(6) NOT NULL default '0',
  `book` varchar(255) default NULL,
  `chapter` varchar(255) default NULL,
  `verse` varchar(255) default NULL,
  `scripture` longtext,
  `spbook` varchar(255) default NULL,
  `spanish` longtext,
  `scripture2` longtext,
  PRIMARY KEY  (`key`),
  UNIQUE KEY `MAIN` (`key`),
  UNIQUE KEY `SECOND` (`book`,`chapter`,`verse`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 1418240 kB; InnoDB free: 1415168 kB; InnoDB fre'

[/code]

Share this post


Link to post
Share on other sites
turn on error reporting and add ... or die("Error: ". mysql_error() ... what does that output?

Share this post


Link to post
Share on other sites
you missed the closing " quote off the end of your query, as you put the ORDER BY outside of your original quote:

[code]
("Select * From bible where `$WhichBook` Like '$BOOK' and `chapter` like $CHAPTER ORDER BY `key` ASC");
[/code]

Share this post


Link to post
Share on other sites
That would explain why mysql_error missed it....

Thanks...

That's what happens when you are tired...

[!--quoteo(post=354850:date=Mar 14 2006, 07:16 AM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Mar 14 2006, 07:16 AM) [snapback]354850[/snapback][/div][div class=\'quotemain\'][!--quotec--]
you missed the closing " quote off the end of your query, as you put the ORDER BY outside of your original quote:

[code]
("Select * From bible where `$WhichBook` Like '$BOOK' and `chapter` like $CHAPTER ORDER BY `key` ASC");
[/code]
[/quote]

Share this post


Link to post
Share on other sites

×

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.