Topic awaiting preservation: mysql query'n |
|
---|---|
Author | Thread |
Nervous Wreck (II) Inmate From: Kansas, just this side of the rainbow |
posted 07-02-2005 06:48
Perhaps I'm attempting the impossible the way I have this set up, please tell me if I am: code: if ($_GET[chap_id]) { $get_storyid = "SELECT * FROM chapter_db, story_db WHERE chapter_db.storyid = story_db.id ORDER BY story_id"; $call_chapter = mysql_query($get_storyid, $db) or die (mysql_error()); while ($result = mysql_fetch_array($call_chapter)) { $chaptid = $result['chapt_id']; $storyid = $result['story_id']; $id = $result['id']; $chaptername = $result['chaptername']; $display .= "$chaptername - $id || "; } }
|
Paranoid (IV) Inmate From: beyond the gray sky |
posted 07-02-2005 08:53 |
Nervous Wreck (II) Inmate From: Kansas, just this side of the rainbow |
posted 07-03-2005 05:10
If I am following what you are saying, I think I already have this in the code. Where it says "chapter_db.storyid = story_db.id". Would I need to put another set like that again? I am confused. The problem I have is that if one chapter is called, I want all other chapters that are in that story to be listed. So, what else can I do to (is this the right term in DB?) Normalize the information and get out the columns I am wanting? |
Maniac (V) Inmate From: under the bed |
posted 07-03-2005 05:51
Shouldn't this - code: chapter_db.storyid = story_db.id
code: chapter_db.story_id = story_db.id
|
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 07-04-2005 01:54
IXI's question is that this query will group ALL chapter id's with their story ids. So to get the correct query need an additional query to get the correct story_id first, probably on the previous page where you are getting the chapter id to begin with. so you can do something like so: |
Maniac (V) Inmate From: Cell 53, East Wing |
posted 07-05-2005 01:40
OK (assuming I've understood the problem) just off the top of my head: |
Nervous Wreck (II) Inmate From: Kansas, just this side of the rainbow |
posted 07-15-2005 04:35
Sorry about the long time since my last post. Emperor, you got the nail on the head. I know I am setting up so that story 4, chapter 7 is listed as chapter 56, and I agree your way probably would be a far superior, but alas, that is why I'm only learning this as asking questions here. ::grin:: |
Maniac (V) Inmate From: Cell 53, East Wing |
posted 07-22-2005 21:44
dade: OK so its is working then? Good to hear quote:
|