Login | Register | FAQ
Anonymous

MySQL JQuery Drag Resize Problem

+ Post a reply

4 posts Page 1 of 1


MySQL JQuery Drag Resize Problem

by themenaceman » Thu May 17, 2012 12:53 pm

Hello all, Can anyone tell me what im doing wrong. I'm trying to create a dynamic page where the divs are created according to the data in my database such as width, height, top and left, I then want the divs dragable and resizable. I can Create a dynamic page and can create a dragable and resizable static page but connot combine the two. Here is my code...

<?php
session_start();
include ("connect_to_mysql.php");
mysql_select_db("LEFT BLANK ON PURPOSE", $con);
//$userid = $_SESSION['id'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css"
href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"/>
</head>
<body>
<?php
$divnum = 0;
$result = mysql_query("SELECT * FROM Divs WHERE pageid= '1'");
while($row = mysql_fetch_array($result))
{
$divnum = $divnum + 1;
$pos_x = $row['pos_x'];
$pos_y = $row['pos_y'];
$width = $row['width'];
$height = $row['height'];
$bg_colour = $row['bg_colour'];
?>
<div id="<?php echo 'Div '.$divnum ?>" style=" position:absolute; top: <?php echo $pos_y ?>; left:<?php echo $pos_x ?>; width:<?php echo $width ?>; height:<?php echo $height ?>; background-color:<?php echo $bg_colour ?>; "><?php echo 'Div '.$divnum ?></div>
<script type="text/javascript">
$('#<?php echo 'Div '.$divnum ?>')
.draggable()
.resizable();
</script>
<? } ?>


</body>
</html>

Any help is much appreciated oh and here is the URL. http://monsterwebdesigns.co.uk/sqldiv.php
User avatar

themenaceman

  • Posts: 5
  • Joined: Sat Mar 31, 2012 10:44 pm

Re: MySQL JQuery Drag Resize Problem

by XainPro » Thu May 17, 2012 2:26 pm

would you please like to share the table dump/asl as well .. ?
its good goal to get that ll div's top left and height width will come from database..
User avatar

XainPro

  • Posts: 3933
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: MySQL JQuery Drag Resize Problem

by themenaceman » Thu May 17, 2012 3:44 pm

User avatar

themenaceman

  • Posts: 5
  • Joined: Sat Mar 31, 2012 10:44 pm

Re: MySQL JQuery Drag Resize Problem

by XainPro » Sat May 19, 2012 6:54 am

yah exectly that's called dump any how i like the idea to move the div by jquery and its coordinates such as left top should be saved in database its good idea i will work on it..
User avatar

XainPro

  • Posts: 3933
  • Joined: Fri Feb 17, 2012 8:10 pm


+ Post a reply

Page 1 of 1