Jump to content

displaying results in a specific order


digitalgod

Recommended Posts

hey ken,

here's the code I'm currently using, it kind of works when you first decide on the order but if you go back and change the order it won't work anymore.

Here's what I got
[code]
<?php
//echo '<pre>' . print_r($_POST,true) . '</pre>';
$NAList = implode ("','", $_POST['NA']);
$DAList = implode ("','", $_POST['DA']);
$type = $_POST['type'];
$dj = $_POST['dj'];
foreach($_POST['order'] as $k => $val) {
echo $_POST['NA'][$val] . '<br>';
echo $k;
mysql_query("UPDATE " . $prefix . "news SET orderList='".$k."' WHERE headline='".$_POST['NA'][$val]."'") or die(query_error());
}
$_SESSION['add_result']=mysql_query("SELECT * FROM ".$prefix."news WHERE headline IN('$NAList') ORDER by orderList") or die(query_error());
?>
[/code]

and in the newsletter_preview.php I got

[code]
<?php
$result = $_SESSION['add_result'];
while ($row=mysql_fetch_array($result)) {
//display the articles in html
}
?>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.