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)
<?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
12
Other forums
FTP Programs
Here is a list of commonly suggested FTP Programs to use:
FileZilla
SmartFTP
CuteFTP
understanding functions and classes
Code: [Select]
class person {
var $name = "Jimmy Goe";
function get_nam
Display the user's weight lost in the past week
Hello everyone,
I am working on a weight loss app for my site, and I want to display the user
Gantt Chart Tool
Does anyone know of a good free gantt chart creator tool
Thanks
Bar charts using Graphical Framework.
I am using Graphical Frameworks(GFW) to create a chart Graphic . There is no problem with the data d
regex for quoted text within a string
I am still getting the hang of regex expressions, but I cant seem to figure out how I would escape q
Problem with umlauts and UTF-8
Hello every1,
I'm creating my own little CMS at the moment and got some problems with the cha
Multiple Do / While Statements?
I'm still very new to PHP, and running in to a problem when trying to execute a do/while loop inside
Giving the below syntax error
Dear Experts,
I have used 2 buttons in gui status as display and cjhange.When the user wi
Scene graph using Direct3D?
There are several C++ scene graph based packages available for OpenGl, like say OSG,
http://w