Rearranging the events

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ryojinaiseki
Forum Newbie
Posts: 7
Joined: Tue Feb 07, 2012 7:19 pm

Rearranging the events

Post 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");
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Rearranging the events

Post by Celauran »

You're missing ORDER

Code: Select all

SELECT column1, column2 FROM tablename WHERE condition ORDER BY something DESC
ryojinaiseki
Forum Newbie
Posts: 7
Joined: Tue Feb 07, 2012 7:19 pm

Re: Rearranging the events

Post by ryojinaiseki »

right after "date_id" ?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Rearranging the events

Post by Celauran »

Right before.

Code: Select all

SELECT * FROM contact_id ORDER BY date_id DESC
Also, you should avoid SELECT *
ryojinaiseki
Forum Newbie
Posts: 7
Joined: Tue Feb 07, 2012 7:19 pm

Re: Rearranging the events

Post 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']))
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Rearranging the events

Post by Celauran »

I don't see any query in there, so it doesn't look like it would fit anywhere.
ryojinaiseki
Forum Newbie
Posts: 7
Joined: Tue Feb 07, 2012 7:19 pm

Re: Rearranging the events

Post 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.
Post Reply