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

returning data from an ssh2_exec()
here's what i got.


$conn = ssh2_connect($this->_host);
ssh2_auth_password($c

Custom array sort? asc then desc
Any ideas how I could sort this array? I've been trying for a while. Maybe with usort, but I have no

word wrap in emails help needed
Hello, I understand how wordwrap works in php and have used it well before. However when I used wor

How to make a input/output field with multiple lines
Hello.
I put a input/output field on the screen but I could not change height of it. I need to

my two tables
table1 : col1 = topicid , col2 = topic

table2 : col1 = sentid, col2 = sentence

Cod

passing an array of objects after submit
How do I do this? This is what I have tried and it is not working.

<form method="

How many users online in the last 24-hours using time()?
I'm fairly new to PHP. I have a MySQL table called 'users' and a field called 'loggedin' which is in

shift numbers with paging
Hi

How would i be able to display 10 numbers 1 2 3 4 5 6 7 8 9 10
and when I click next

How would I do "Users not logged in since *** delete them"
I know how I would set this up, and delete the user roughly.
I'll create a table called "Use

Weird MySQL error, why am I recieving this?
PHP Code:


<?php require "global_settings.php"; ?>
<titl

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