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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.