Jump to content


Photo

blank query result when using order by


  • Please log in to reply
3 replies to this topic

#1 AV1611

AV1611
  • Members
  • PipPipPip
  • Advanced Member
  • 997 posts

Posted 14 March 2006 - 01:14 AM

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


here is the table structure:

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'



#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 14 March 2006 - 02:57 AM

turn on error reporting and add ... or die("Error: ". mysql_error() ... what does that output?
Legend has it that reading the manual never killed anyone.
My site

#3 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 14 March 2006 - 12:16 PM

you missed the closing " quote off the end of your query, as you put the ORDER BY outside of your original quote:

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

"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#4 AV1611

AV1611
  • Members
  • PipPipPip
  • Advanced Member
  • 997 posts

Posted 14 March 2006 - 01:01 PM

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) View Post[/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:

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users