Table sorting


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

I'm trying to modify the following in order to make the output table sorted alphabetically according to $event_name but so far have not succeeded. Any pointers?

Did you know?Explore Trending and Topic pages for more stories like this.
Code: function display_all_events(){
global $wpdb;
$events_detail_tbl = get_option('events_detail_tbl');
$curdate = date("Y-m-d");
$paypal_cur = get_option('paypal_cur');

$sql = "SELECT * FROM ". $events_detail_tbl;

$result = mysql_query ($sql);

echo "<table width = '100%'>";
while ($row = mysql_fetch_assoc ($result))
{
$event_id = $row['id'];
$event_name=$row['event_name'];
$event_identifier=$row['event_identifier'];
$cost=$row['event_cost'];
$active=$row['is_active'];

echo "<tr><td width='100%'>".$event_name." - ".$paypal_cur." ".$cost."</p><hr></td><td>";
echo "<form name='form' method='post' action='".$_SERVER['REQUEST_URI']."'>";
echo "<input type='hidden' name='regevent_action' value='register'>";
echo "<input type='hidden' name='event_id' value='".$row['id']."'>";
echo "<input type='SUBMIT' value='REGISTER'></form></td></tr>";

}
echo "</table>";
}

Am relatively new to php so please excuse me for posting stuff that may seem obvious to others but I really need to sort this out as the workaround is very time consuming...

Thanks
No comments posted yet

Your Answer:

Login to answer
297 Like 53 Dislike
Previous forums Next forums
Other forums

Motivational Posters
Hello,

I wonder how can i do them in php. Are there any sample codes that you can show me?

Parse Error
Hi Guys,

I have a function in my class which returns a string link variable. The problem is i

mod_rewrite.c on windows ??
why it's not working on windows while it's working on other hosts???

this is the code i got

radio button reamains checked
Hello i'm trying to keep the state off my radio buttons so it shows which ones where clicked after t

storing video files into mysql in php
hi

i have my video files in my folder ,
i have to store the path of the videos into db an

Sort a two dimensional array.
Hi. I've set up a two dimensional array that reads as follows:

Code: $modifiedData = array(

Can't seem to capture a variable in a chained select
I'm *this* close to having a chained select running but for some reason it doesn't seem to be pickin

MII Trends - add data onto chart object
Hello,

Can anyone please provide some thoughts on my current requirement:
its pretty

using explode() to fill in checkboxes
Hi

I have a field stored in a table that contains regions in the UK separated by commas. Ther

Forgot password won't work
My forgot password thing is not working properly. It is giving me this errorMailbox unavailable. The

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash