Page 1 of 1
Rearranging the events
Posted: Tue Feb 07, 2012 7:44 pm
by ryojinaiseki
Hello,
Is this code correct for rearranging the event according to date?
$data = mysql_query("SELECT * FROM contact_id by date_id DESC");
Re: Rearranging the events
Posted: Tue Feb 07, 2012 7:58 pm
by Celauran
You're missing ORDER
Code: Select all
SELECT column1, column2 FROM tablename WHERE condition ORDER BY something DESC
Re: Rearranging the events
Posted: Tue Feb 07, 2012 8:01 pm
by ryojinaiseki
right after "date_id" ?
Re: Rearranging the events
Posted: Tue Feb 07, 2012 8:03 pm
by Celauran
Right before.
Code: Select all
SELECT * FROM contact_id ORDER BY date_id DESC
Also, you should avoid SELECT *
Re: Rearranging the events
Posted: Tue Feb 07, 2012 8:14 pm
by ryojinaiseki
I see... you know where can I put that code on this part?
Code: Select all
$category = trim($_GET['category']);
$type = trim($_GET['type']);
$eventId = trim($_GET['eventId']);
$dateId = trim($_GET['dateId']);
$agencyId = trim($_GET['agencyId']);
$sessionId = trim($_GET['sessionId']);
$institution = trim($_GET['institution']);
$_SESSION['dateId'] = $dateId;
$_SESSION['eventId'] = $eventId;
$_SESSION['agencyId'] = $agencyId;
$_SESSION['sessionId'] = $sessionId;
$_SESSION['display'] = trim($_GET['display']);
$display = "<b>Display Criteria:</b> ". stripslashes(trim($_GET['display']))
Re: Rearranging the events
Posted: Tue Feb 07, 2012 8:22 pm
by Celauran
I don't see any query in there, so it doesn't look like it would fit anywhere.
Re: Rearranging the events
Posted: Tue Feb 07, 2012 11:07 pm
by ryojinaiseki
I couldn't send the file wherein the code that I was asking that's why just I couldn't tell which part.