<?php require_once "./includes/session.php"; include "./includes/functions.php"; $tag1 = $_REQUEST["tag1"]; $tag2 = $_REQUEST["tag2"]; $tag3 = $_REQUEST["tag3"]; $uid = $_SESSION['login_user_uid']; //find the current user $lid = $_REQUEST["lid"]; $cid = find_category_id($lid); //find the current category the user is in //echo $tag1.",".$tag2.",".$tag3; echo save_tags($tag1, $tag2, $tag3, $uid, $lid, $cid);
function save_data($post, $tmb, $img, $twidth, $theight, $fwidth, $fheight) { $title = $post["image_title"]; $date = $post["image_date"]; $category = $post["image_category"]; $gear = $post["image_gear"]; $description = $post["image_description"]; $host = "localhost"; $user = "******"; $pass = ""; $db = "gallery"; $table = "gallery_photos"; $query = 'INSERT INTO ' . $table . ' (TITLE, DATE, CATEGORY, DESCRIPTION, GEAR, FILEPATH, THUMB, TWIDTH, THEIGHT, WIDTH, HEIGHT) VALUES ( "' . $title . '", "' . $date . '", "' . $category . '", "' . $description . '", "' . $gear . '", "' . $img . '", "' . $tmb . $img . '", "' . $twidth . '", "' . $theight . '", "' . $fwidth . '", "' . $fheight . '")'; $mysqli = new mysqli($host, $user, $pass, $db); if ($mysqli->connect_errno) { printf("Connect failed: %s\n", $mysqli->connect_error); exit; } if ($mysqli->query($query)) { $last_id = $mysqli->insert_id; foreach ($post["keys"] as &$val) { save_tags($last_id, $val); } return true; } }