public function getFoods($fid) { $food = new Foods(); $res = mysql_query("SELECT * FROM food WHERE id=" . $fid); if (mysql_num_rows($res) > 0) { while ($userRow = mysql_fetch_array($res)) { $food->setId($userRow['id']); $food->setFood($userRow['food']); $food->setImgs($userRow['imgs']); $food->setPrice($userRow['price']); $food->setIngredients($userRow['ingredients']); $food->setDescription($userRow['description']); $food->setType($userRow['type']); $food->setMeal($userRow['meal']); $food->setVeg($userRow['veg']); $food->setSpicy($userRow['spicy']); $food->setStock($userRow['stock']); $food->setDelivery($userRow['delivery']); $food->setDtime($userRow['dtime']); } } return $food; }
header("location:".$_SERVER['PHP_SELF']); }*/ $food = new Foods(); $food->setId($_POST['id']); $food->setFood(mysql_real_escape_string($_POST['food'])); $food->setPrice(mysql_real_escape_string($_POST['price'])); $food->setIngredients(mysql_real_escape_string($_POST['ingredients'])); $food->setDescription(mysql_real_escape_string($_POST['description'])); $food->setType(mysql_real_escape_string($_POST['types'])); $food->setMeal(mysql_real_escape_string($_POST['meal'])); $food->setStock(mysql_real_escape_string($_POST['stock'])); $food->setVeg(mysql_real_escape_string($_POST['veg'])); $food->setSpicy(mysql_real_escape_string($_POST['spicy'])); $food->setDelivery(mysql_real_escape_string($_POST['delivery'])); $food->setDtime(mysql_real_escape_string($_POST['dtime'])); $food->setImgs($filepath); $processfood = new Processfood(); $msg_register = $processfood->updateFood($food); if ($msg_register == 0) { // header("Location: myfood.php"); } } ?> <section id="form" style="margin-top: 0px"><!--form--> <div class="container"> <div class="row"> <div class="col-sm-10 col-sm-offset-1"> <div class="login-form" ><!--login form--> <h2>Edit food item</h2>
public function getProduct($f) { $id = $f->getId(); $res = mysql_query("SELECT *,food.id AS fid, seller.id AS sid FROM food INNER JOIN seller ON seller.id=food.seller_id WHERE food.id='" . $id . "'"); $userRow = mysql_fetch_array($res); $food = new Foods(); $seller = new Seller(); $review = new Review(); $food->setId($userRow['fid']); $food->setFood($userRow['food']); $food->setImgs($userRow['imgs']); $food->setPrice($userRow['price']); $food->setIngredients($userRow['ingredients']); $food->setDescription($userRow['description']); $food->setType($userRow['type']); $food->setMeal($userRow['meal']); $food->setVeg($userRow['veg']); $food->setSpicy($userRow['spices']); $food->setStock($userRow['stock']); $food->setDelivery($userRow['delivery']); $food->setDtime($userRow['dtime']); $seller->setId($userRow['sid']); $seller->setCompany($userRow['company']); $seller->setAddress($userRow['address']); $seller->setCity($userRow['city']); $seller->setPostalcode($userRow['postalcode']); $seller->setDescription($userRow['description']); $seller->setLogo($userRow['logo']); $seller->setUser_id($userRow['user_id']); $resR = mysql_query("SELECT * FROM review WHERE food_id='" . $f->getId() . "'"); $userRowR = mysql_fetch_array($resR); $review->setId($userRowR['id']); $review->setName($userRowR['name']); $review->setEmail($userRowR['email']); $review->setComment($userRowR['comment']); $review->setRtime($userRowR['rtime']); $review->setRday($userRowR['rday']); $review->setFood_id($userRowR['food_id']); $objs = array(); $objs[] = $food; $objs[] = $seller; $objs[] = $review; return $objs; }