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

newbie question about multiple queries
hi everyone,
I'm sorry to ask such a basic question, but I'm young and trying to learn php on my

Trigger tag in aspx is not coming
hi all ,iam new to ajax, iam using file upload inside the update pannel but right now i want to use

Splitting Attributes
SQL> SELECT I_NAME, substr(I_NAME,1,instr(I_NAME,'O')) "First part",

substr(I_NAME, IN

Help with captcha script needed
Hello,

I am working on a script where reCAPTCHA or a similar form of CAPTCHA will be used, f

Save remote XML to local website folder
Hi, I hope you can help me out. I would like to be able to pull an XML file from another site and t

Can I use a loop
Hi buddies!

Once again with my doubts here.

Right now I am using this sql stat

extract data
Code: <div class="post hentry uncustomized-post-template">

Sending CC Info by email
I am a little bit less knowledgable in the security area as most developers and I know I have a lot

PECL uploadprogress for php5.2
Hey, I just installed PHP5 via .htaccess on my 1and1 Shared Hosting Account.

How would I exac

this code is strange !
Hi i got this code from the web.. It checks for live and dead socks
It is working perfectly on my

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