//SELECT * FROM table WHERE id='2'; //$prod=new classProduct("2"); //Here we write this values into the database //because ID was given, will be UPDATE ID 2. /* $prod->setItem("Item A"); $prod->setItemId("item_c"); $prod->setVotes("10"); // this line will call the save from the class $prod->save(); */ // END STEP 2 echo "Step 3 - BUG, ca face un insert nou, nu update si daca nu exista, ar trebui sa exit, nu sa executre mai departe cu ID()"; //we call here the class with ID 2 //will be done //SELECT * FROM table WHERE id='2'; $prod = new classProduct("WHERE `votes`='10' AND `itemid`='item_b'"); //Here we write this values into the database //because ID was given, will be UPDATE ID 2. $prod->setVotes("100"); // this line will call the save from the class $prod->save(); //$prod=new classProduct('WHERE `votes`="2"'); // You can delete like this //$prod->delete(" WHERE `id` < '1150'"); // You can call UNDO command. //$prod->undo(); // Nu stiu ce e //$prod->debug_print_history(); //print($prod->undo()); mysql_close($cid);
$prod->setItemId("item_a"); $prod->setVotes("10"); $prod->save(); $prod = new classProduct(0); $prod->setItem("Item B"); $prod->setItemId("item_b"); $prod->setVotes("20"); $prod->save(); $prod = new classProduct(0); $prod->setItem("Item C"); $prod->setItemId("item_c"); $prod->setVotes("30"); $prod->save(); $prod = new classProduct(0); $prod->setItem("Item D"); $prod->setItemId("item_d"); $prod->setVotes("40"); $prod->save(); $prod->debug_print_history(); exit; $prod = new classProduct(11); $prod = new classProduct('WHERE `votes`="10"'); $prod->setItem("Item C"); $prod->setItemId("item_c"); $prod->setVotes("60"); $prod->save(); print_r($prod); mysql_close($link); ?>