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

Staff Induction System - No idea where to go from here!!!
Hi there, I'm pretty new to PHP and Mysql so could really do with being pointed in the right directi

Calling All PHPFREAKS Blackberry Users
Are you a member of PHPFreaks and have a blackberry? Well RIM just recently released Blackberry Mes

Change Age automatically
hi guys . im new to php , is it possible to change age value in mysql automatically when year change

A problem with my GD class
Hello,

I created a nice (and simple for now) GD class.
The problem is , it works great on

If statement help please.
Hello on my site I have 2 content boxes. 1 is for the main content (which is the biggest one) and th

Just a white page
Okay so, my website, when I click SignUp on it it takes me to /join.php but its a complete white pag

Problem with "dynamic" index page
Hi. I have one question. In my index.php page I have this kind of code:
Code: // listaa sivut

how to easy edit text, with box? Help.
Hi.
I have a little problem. I'm doing a webpage for my aunt and I would like to make it as easy

insert quotes
Hi,

I have an output like this:
Code: john,18,Cancer
How can I change this to
Code:

how to transport the Query and insfoset
Hi

I have created the query using SQ01........
How to created T-code for query..

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