Hi, Daniweb
I'm working on a website where i did a search system and then i listed the results founded. And now i want to move them with JQuery Sortable.
But i'm having dificults can someone help me please?
Here's the code:
<?php
require_once('Connections/futura.php');
?>
<?PHP
$prod=$_GET['q2'];
$query_prod="SELECT * FROM produtos WHERE nome LIKE '%".$prod."%'";
$produt=mysql_query($query_prod, $futura);
$count=mysql_num_rows($produt);
$prod_img="SELECT * FROM produtos WHERE nome LIKE '%". $prod ."%' ORDER BY referencia ASC";
$image=mysql_query($prod_img, $futura);
?>
<!----------------------------------------------------------------------------------------------------------------------->
<!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=utf-8" />
<link href="styles/style.css" rel="stylesheet" />
<title>Plásticos Futura - Pesquisa</title>
<link rel="shortcut icon" type="image/x-icon" href="imagens/plasticos.ico" />
<script type="text/javascript" src="js/java.js"></script>
<!---------------------------------------------------------------------------------------------------->
<link type="text/css" href="jquery/themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="jquery/jquery-1.3.2.js"></script>
<script type="text/javascript" src="jquery/ui.core.js"></script>
<script type="text/javascript" src="jquery/ui.sortable.js"></script>
<link type="text/css" href="jquery/demos.css" rel="stylesheet" />
<style type="text/css">
#sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 18px; }
#sortable li span { position: absolute; margin-left: -1.3em; }
</style>
<script type="text/javascript">
$(function() {
$("#sortable").sortable();
$("#sortable").disableSelection();
});
</script>
<!---------------------------------------------------------------------------------------------------->
<table width="570" border="0" cellspacing="0" cellpadding="0" >
<?PHP
$i=0;
while ($linha = mysql_fetch_array($image))
{
?>
<?PHP
if ($i==0)
{
echo '<tr class="sortable_row" id="456">';
}
?>
<?PHP
//MATERIAL
$query_categ_list = "SELECT * FROM materiais WHERE id_material='".$linha['id_material']."'";
$categ_list = mysql_query($query_categ_list, $futura) or die(mysql_error());
$row_categ_list = mysql_fetch_assoc($categ_list);
$totalRows_categ_list = mysql_num_rows($categ_list);
?> <td colspan="2" class="div_topo"><a name="cat<?php echo $row_categ_list['id_material']; ?>"></a> <strong>PRODUTOS :: <span class="texto2"><?php echo $row_categ_list['material']; ?></span></strong></td>
<?PHP
//IMAGEM
$sel_img="SELECT * FROM produtos_img WHERE id_produto = '".$linha['id_produto']."'";
$img2=mysql_query($sel_img, $futura);
$img = mysql_fetch_assoc($img2);
?>
<tr>
<td width="160" height="95" valign="top"><a href="ver_produto.php?id_produto=<?php echo $linha['id_produto']; ?>&id_categoria=<?php echo $linha['id_material']; ?>"><?php if($img['imagem']!="") { ?><img src="http://www.plasticos-futura.com/timthumb.php?src=http://www.plasticos-futura.com/produtos/<?php echo $img['imagem']; ?>&w=134px&h=98px&zc=1&q=100" width="134" height="98" style="border:1px solid #cccccc;" /><?php } else { ?><img src="imagens/futura.jpg" width="134" height="98" style="border:1px solid #cccccc;" /><?php } ?></a></td>
<td>
<table>
<tr>
<td align="left">
<strong>DESCRIÇÃO: </strong><?PHP echo $linha['nome'];?>
</td>
</tr>
<tr>
<td align="left">
<strong>REFERÊNCIA: </strong><?PHP echo $linha['referencia']; ?>
</td>
</tr>
</table>
</td>
</tr>
<?PHP
$i=$i+1;
}
?>
</table>
<?PHP
}
?>
<!----------------------------------------------------------------------------------------------------------------------->
</div></td>
<td width="178"></td>
</tr>
</table></td>
</html>
Hope you can help me.
Thank you,
PF2G