Alex Tech Adventures The webs best tutorials!

Welcome, Guest
Please Login or Register.    Lost Password?

Case Statements
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Case Statements
#394
Case Statements 2 Years ago Karma: 1
I working on a manual list order sort function, based on: www.phpfreaks.com/tutorial/php-custom-list-order

Original:
Code:

// swap the rows. Basic idea is to make $id=$swap and $swap=$id 
$sql = "UPDATE info SET usort = CASE usort WHEN $id THEN $swap WHEN $swap THEN $id END WHERE usort IN ($id, $swap)";
$result = mysql_query($sql, $conn) or die(mysql_error());



I have tried some ways of transform this into fit ZF, but I still pretty new so it don't wont to work.
First I tested:
Code:

$data = "CASE usort WHEN $id THEN $swap WHEN $swap THEN $id END";
$this->getDbTable()->update($data, array('id = ?' => $entry->id));

Skatan
Fresh Boarder
Posts: 11
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#449
Re:Case Statements 2 Years ago Karma: 16
getDbTable does not really work like that.
Which class is the code in? And do you already have resources.db.adapter anywhere in your application.ini file?
alexanderrv
Administrator
Posts: 279
graph
User Offline Click here to see the profile of this user
Gender: Male tmthv2 alexchatonly@hotmail.com Location: Freeport, Bahamas Birthdate: 1989-04-14
The administrator has disabled public write access.
 
Go to topPage: 1
Moderators: alexanderrv
You are here: Home Forum

Statistics

Members : 1388
Content : 42
Web Links : 1
Content View Hits : 190517

Poll

Interested in TinyBrowser and TinyMce plugin for ZF?
 

Who's Online

We have 40 guests online