Log in

View Full Version : re-order update mysql



ggalan
08-30-2011, 07:23 PM
im using this tutorial to make a re-arranging sql dB based on jQuery.
http://teamtutorials.com/web-development-tutorials/using-jquery-to-reorder-a-list-and-update-a-database

my question is how would i have an upload image button to work with this type of system?
i know what i am asking is a lot so i dont expect anyone to do the work or anything but just a conversation or maybe a point in direction on how this type of task could be achieved.

this is part of my upload code that works well but im stuck trying to integrate the 2


<?
$directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']);
$uploadsDirectory = $_SERVER['DOCUMENT_ROOT'] . $directory_self . 'uploaded_files/';
$uploadForm = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'index.php';
$uploadSuccess = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'index.php';
// name of the fieldname used for the file in the HTML form
$fieldname = 'file';

$uploadFilename = $uploadsDirectory . $_FILES[$fieldname]['name'];
$_SESSION['fileName'] = $_FILES[$fieldname]['name'];

@move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename);
//or error('receiving directory insuffiecient permission', $uploadForm);
header('Location: ' . $uploadSuccess);
?>

JShor
08-30-2011, 07:59 PM
Upload an image to where? Insert the actual image data into MySQL, or an I/O file system upload?

ggalan
08-30-2011, 08:16 PM
this would act as a backend cms that would look something like this http://www.2020proj.com/media/images/computer/cms.jpg
the image would upload into a folder
then each of those rows would have a unique image name associated with it
so that when you re arranged the order, the dB or xml would be affected

JShor
08-30-2011, 08:48 PM
What does your table structure look like (if you're using one)? Best practice is to store the file name into the database when uploaded. I don't know whether you want to update an existing db row, insert a new row into the db, update an XML sheet, write a new node to an XML sheet, etc.

Please be much more specific as to what you need.

ggalan
08-30-2011, 09:46 PM
i have this, which outputs a json file, but i cant seem to add the upload image button and make it work
http://bit.ly/nT1dZx


re: i re-uploaded this link. has the correct files now