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?

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

Add weeks in a query?
I have a SQL that summarizes the quantity per week. The weeks that has no value does not exist in th

remove a ; from emails in textarea
Code: <?php

session_start();

$database_host = "localhost&qu

Why is this query failing?
Why is this not working?
$query = "SELECT * FROM `users` WHERE `userid` = " . $USERID

PHP webpage & array print issue
I have this code running, and it works perfectly … however, see my bottom bit about what I see

Need help with a mail notify function
I was tasked with setting up a site that's been prewritten. The site is basically a form that captur

JSON SORT WITH PHP
I have two products that I want to sort by say "Id:17, value: xxx" using php
The page w

Best PHP Documentation generator
Hello guys!

I would like to hear from you what is the best PHP documentation generator. Perso

PHP Thumbnail Creation
Ok so i use this function to create thumbnails:

Code: function createthumb($name,$filename,$n

PHP switch function help
Hi, I am trying to create a search function for a directory website. On the search function on html

Socket programming
Hello all,

I have a PHP socket script. GPS trackers connect to this socket. IMEI verification

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