Re-Order by ID Number


Posted on 16th Feb 2014 07:03 pm by admin

I have a cms set up for inputting an image, thumb, title, pdf, and eps. When input the database assigns an ID number. The front end displays each upload by ID number. I'm trying to set up the back end so that a user can re-order by changing the ID number. I can get it to display the ID number in an editable text area, display thumb and title for each entry. With the code below it doesn't update the database ID number when I save. What am I doing wrong here? (Just to let you know this code is a modified version of my 'delete entry' code that works)



Did you know?Explore Trending and Topic pages for more stories like this.

<?php
if($session->logged_in){


mysql_connect("localhost", "yeee", "eeeee") or die(mysql_error()) ;
mysql_select_db("eeeeee") or die(mysql_error()) ;



if(!isset($cmd))
{

$result = mysql_query("select * from test order by id");




while($r=mysql_fetch_array($result))

$title=$r["title"];
$id=$r["id"];
$thumb=$r["thumb"];

echo "<div style='display:block; width:400px; padding-left:25px;padding-right:25px; margin:auto; background-color:#ffffff;'>
<img src='images/menu-top.jpg' style='width:450px;margin-left:-25px;'><br />
<form>
<table>
<tr>
<td><input type='text' name='id' value='$id' size='3'></td><td width='350px'><strong>$title</strong></td>
</tr>
<td colspan='2' align='center'><img src='upload/test/$thumb'></td>
</table></form>";
}
}
?>
<?php
echo "<div style='text-align:center;'><a href='testorder.php?cmd=order&id=$id'>Submit</a></div>";
?>
<?php
if($cmd=="order")
{
$sql = "UPDATE test SET id='$id'";
$result = mysql_query($sql);
echo "UPDATED!";
echo "<a href='main.php'>Click here to return to the Administration Area.</a>";
}
}
else{
echo "[<a href='main.php'>Please Login</a>]";
}

?>
No comments posted yet

Your Answer:

Login to answer
214 Like 12 Dislike
Previous forums Next forums
Other forums

Trying to add functions to table
I have this list of characters and I'm trying to figure out what I have to do to put the results of

how to use two buttons with php
hi i have one form. there are three fields which are to be filled by the user. and then there are tw

php ajax - two drop down list with a submit button
i have created a form with 2 drop-down list and a submit button. I would like to know how to pass th

If statement help please.
Hello on my site I have 2 content boxes. 1 is for the main content (which is the biggest one) and th

$variable = $variable
Hello

Sorry if this is a really simple question but I have run out of ideas. Is there a reall

mysql select query problem
how can i select multiple fields from multiple table in one query like

i have table name t1 a

adding up might be solved tell us cheers.
i think i finally solved this anybody.

last time i was getting the wrong results.

Code

Page doesn't expand for content
Hi. I've been testing a query I made. It's here http://lapr1.6te.net/inquerito.php
The page doesn

pagination numbering pattern
Hello,

I have following code which works great for pagination. but i have small issue now.

Variable uses and placement
I'm new to PL/SQL and am trying to learn about variable valid uses/placement (any pointers to any do

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