| 
	
 | 
 Posted by Paul Lautman on 02/10/07 21:47 
ZMAN wrote: 
> CREATE TABLE coupons ( 
>  id int(11) NOT NULL auto_increment, 
>  data longtext NOT NULL, 
>  display_coupon varchar(10) NOT NULL default '', 
>  position tinyint(20) NOT NULL default '0', 
>  usetemp tinyint(10) NOT NULL default '0', 
>  KEY id (id) 
> ) TYPE=MyISAM; 
> 
> I have an auto dealership website I do. 
> This table allows them to add or remove dealership discount coupons as 
> needed. They do this through an admin form 
> I built for them. 
> They have asked me to allow them to be able to place the order in 
> which they appear on the html page. 
> I created a position field for this, SELECT ..etc... ORDER BY 
> position. 
> So, for example there are 4 coupons. 
> If they change coupon in position 3 to be in position 2, how do I 
> renumber all the position fields in order. 
> I can't for the life of me figure out how to do this with a sql call. 
> 
> Any help would be greatly appreciated. 
> Thanks in advance! 
> 
> ZMAN 
 
Here's a whizzy way to make it drag'n'drop with Ajax 
http://www.phpriot.com/d/articles/client-side/sortable-lists-with-php-and-ajax/index.html
 
  
Navigation:
[Reply to this message] 
 |