Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Thread Tools Display Modes
Old 04-14-2014, 09:03 PM   #1
Join Date: Jan 2011
Posts: 41
Default Sorting MySQL results multiple columns

I am working on setting up a media page for a site with sermon messages. I currently have the database set up to display a drop-down of each bible book listed in the database (one per sermon). This drop-down, when a book is selected, the page is then refreshed to show the messages from that book. i would like to add the option of adding a second bible book to certain messages which could also show up in the drop-down. The way I currently have it set up, i don't see a way of doing it. the web page i am referring to is: http://www.lifeinchristministries.com/resources/media/

here is my code for sorting the passages by book:
PHP Code:
$sortbypassage2 "Select Book from Drop-Down--";
$addoption "";
$addoption "<option value='000All Books'>All Books</option>";

'<form action="../media/#messages" method="post">
                 <select name="passage" width="200" style="width: 200px" onchange="javascript: submit()">
                 <option selected="selected">' 
.$sortbypassage2'</option>' .$addoption;
//Retrieves data from MySQL 
$data mysql_query("SELECT DISTINCT passage FROM audio_messages ORDER BY passage ASC") or die(mysql_error()); 
//Puts it into an array 
while($row mysql_fetch_array$data )) 
$currentpassage $row['passage'];
$currentpassage2 substr($currentpassage3);

             <option value="' 
.$currentpassage'">' .$currentpassage2'</option>';
i set up another MySQL column with the title 'passage2' for the second book of the bible.

I thought maybe changing the column to a 'varchar' or something (sort of like a keyword field) where i could have them both in one column, but then would have to figure out how to sort separate values within a column, and would prefer to not do this option as i think I may have to update each field value.

Thank you for any help anyone can offer!
sydesign is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 10:10 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com