PHP - Error No. 1064 In Php But Its Working Directly In Mysql5.5.8
I'm getting the err msg
Error . "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$sqry' at line 1 " while executing query from php5.3.5 but its working directly in mysql5.5.8 Help? Similar TutorialsI have been pulling my hair out for the lasy 3 hours i am trying to update a MySql table but i cant get it too work, i just keep getting MySql error #1064 - You have an error in your SQL syntax; if i just update 1 field it works fine but if i try to update more than 1 field it dosent work, Help Please! <?php $root = $_SERVER['DOCUMENT_ROOT']; require("$root/include/mysqldb.php"); require("$root/include/incpost.php"); $con = mysql_connect("$dbhost","$dbuser","$dbpass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("$dbame", $con); mysql_query("UPDATE Reg_Profile_p SET build='$build' col='$col' size='$size' WHERE uin = '$uinco'"); ?> Hello all,
Appreciate if you folks could pls. help me understand (and more importantly resolve) this very weird error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ASC, purchase_later_flag ASC, shopper1_buy_flag AS' at line 3' in /var/www/index.php:67 Stack trace: #0 /var/www/index.php(67): PDO->query('SELECT shoplist...') #1 {main} thrown in /var/www/index.php on line 67
Everything seems to work fine when/if I use the following SQL query (which can also be seen commented out in my code towards the end of this post) :
$sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id";However, the moment I change my query to the following, which essentially just includes/adds the ORDER BY clause, I receive the error quoted above: $sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master ORDER BY purchased_flag ASC, purchase_later_flag ASC, shopper1_buy_flag ASC, shopper2_buy_flag ASC, store_name ASC) WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id";In googling for this error I came across posts that suggested using "ORDER BY FIND_IN_SET()" and "ORDER BY FIELD()"...both of which I tried with no success. Here's the portion of my code which seems to have a problem, and line # 67 is the 3rd from bottom (third last) statement in the code below: <?php /* $sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id"; */ $sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master ORDER BY FIND_IN_SET(purchased_flag ASC, purchase_later_flag ASC, shopper1_buy_flag ASC, shopper2_buy_flag ASC, store_name ASC) WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id"; $result = $pdo->query($sql); // foreach ($pdo->query($sql) as $row) { foreach ($result as $row) { echo '<tr>'; print '<td><span class="filler-checkbox"><input type="checkbox" name="IDnumber[]" value="' . $row["idnumber"] . '" /></span></td>';Thanks I have a pdo prepared statement that fetches records from mysql database. The records show up on the page. However if there are no records on a page, I get this error message.
"QLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10' at line 4"
Here is my statement
$getCategoryId = $_GET['id']; $limit = 10; $offset = ($page - 1) * $limit; $statement = $db->prepare("SELECT records.*, categories.* FROM records LEFT JOIN categories ON records.category_id = categories.category_id WHERE records.category_id = :category_id ORDER BY record_id DESC LIMIT {$limit} OFFSET ".$offset); $statement->bindParam('category_id', $getCategoryId); $statement->execute(); $results = $statement->fetchAll(PDO::FETCH_ASSOC);If I remove try and catch block, it'll tell me exactly which line is giving the issue. So from the above code, the error has to do with "$statement->execute();". This is where the error occurs. As far as I know, the above pdo statement is correct. Can you tell me if something is wrong with it? Edited by helloworld001, 16 December 2014 - 04:14 PM. Hi guys,
I am having a hard time trying to figure out why this gives me an error?
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 10
/** * Baobab (an implementation of Nested Set Model) * * Copyright 2010 Riccardo Attilio Galli <riccardo@sideralis.org> [http://www.sideralis.org] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * .. note:: * Each occurrence of the word "GENERIC" across this file is meant to be * replaced with the name of the tree (which must be a valid string to use * as SQL table name). */ /* ############################### */ /* ###### TABLES AND VIEWS ####### */ /* ############################### */ CREATE TABLE IF NOT EXISTS GENERIC ( tree_id INTEGER UNSIGNED NOT NULL, id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, lft INTEGER NOT NULL CHECK (lft > 0), rgt INTEGER NOT NULL CHECK (rgt > 1), INDEX(tree_id), INDEX(lft), CONSTRAINT order_okay CHECK (lft < rgt) ) ENGINE INNODB; DROP VIEW IF EXISTS GENERIC_AdjTree; CREATE VIEW GENERIC_AdjTree (tree_id,parent,child,lft) AS SELECT E.tree_id,B.id, E.id, E.lft FROM GENERIC AS E LEFT OUTER JOIN GENERIC AS B ON B.lft = ( SELECT MAX(lft) FROM GENERIC AS S WHERE E.lft > S.lft AND E.lft < S.rgt AND E.tree_id=S.tree_id) AND B.tree_id=E.tree_id ORDER BY lft ASC; /* ##### LIST OF TREE NAMES IN USE ##### */ CREATE TABLE IF NOT EXISTS Baobab_ForestsNames ( name VARCHAR(200) PRIMARY KEY ) ENGINE INNODB DEFAULT CHARSET=utf8; INSERT INTO Baobab_ForestsNames(name) VALUES ('GENERIC') ON DUPLICATE KEY UPDATE name=name; /* ##################################### */ /* ########################### */ /* ###### ERRORS CONTROL ##### */ /* ########################### */ CREATE TABLE IF NOT EXISTS Baobab_Errors ( code INTEGER UNSIGNED NOT NULL PRIMARY KEY, name VARCHAR(50) NOT NULL, msg TINYTEXT NOT NULL, CONSTRAINT unique_codename UNIQUE (name) ) ENGINE INNODB; INSERT INTO Baobab_Errors(code,name,msg) VALUES (1000,'VERSION','1.3.1'), (1100,'ROOT_ERROR','Cannot add or move a node next to root'), (1200,'CHILD_OF_YOURSELF_ERROR','Cannot move a node inside his own subtree'), (1300,'INDEX_OUT_OF_RANGE','The index is out of range'), (1400,'NODE_DOES_NOT_EXIST',"Node doesn't exist"), (1500,'VERSION_NOT_MATCH',"The library and the sql schema have different versions") ON DUPLICATE KEY UPDATE code=code,name=name,msg=msg; DROP FUNCTION IF EXISTS Baobab_getErrCode; CREATE FUNCTION Baobab_getErrCode(x TINYTEXT) RETURNS INT DETERMINISTIC RETURN (SELECT code from Baobab_Errors WHERE name=x); /* ########################## */ /* ######## DROP TREE ####### */ /* ########################## */ DROP PROCEDURE IF EXISTS Baobab_GENERIC_DropTree; CREATE PROCEDURE Baobab_GENERIC_DropTree ( IN node INTEGER UNSIGNED, IN update_numbers INTEGER) LANGUAGE SQL DETERMINISTIC MODIFIES SQL DATA BEGIN DECLARE drop_tree_id INTEGER UNSIGNED; DECLARE drop_id INTEGER UNSIGNED; DECLARE drop_lft INTEGER UNSIGNED; DECLARE drop_rgt INTEGER UNSIGNED; /* declare exit handler for not found rollback; declare exit handler for sqlexception rollback; declare exit handler for sqlwarning rollback; */ /* save the dropped subtree data with a singleton SELECT */ START TRANSACTION; /* save the dropped subtree data with a singleton SELECT */ SELECT tree_id, id, lft, rgt INTO drop_tree_id, drop_id, drop_lft, drop_rgt FROM GENERIC WHERE id = node; /* subtree deletion is easy */ DELETE FROM GENERIC WHERE tree_id=drop_tree_id AND lft BETWEEN drop_lft and drop_rgt; IF update_numbers = 1 THEN /* close up the gap left by the subtree */ UPDATE GENERIC SET lft = CASE WHEN lft > drop_lft THEN lft - (drop_rgt - drop_lft + 1) ELSE lft END, rgt = CASE WHEN rgt > drop_lft THEN rgt - (drop_rgt - drop_lft + 1) ELSE rgt END WHERE tree_id=drop_tree_id AND (lft > drop_lft OR rgt > drop_lft); END IF; COMMIT; END; /* ########################## */ /* ###### APPEND CHILD ###### */ /* ########################## */ /* Add a new child to a parent as last sibling If parent_id is 0, insert a new root node, moving the previous root (if any) as his child. If choosen_tree is 0, use the first available integer as id. If choosen_tree is not present as tree_id in the table, it is used. */ DROP PROCEDURE IF EXISTS Baobab_GENERIC_AppendChild; CREATE PROCEDURE Baobab_GENERIC_AppendChild( IN choosen_tree INTEGER UNSIGNED, IN parent_id INTEGER UNSIGNED, OUT new_id INTEGER UNSIGNED, OUT cur_tree_id INTEGER UNSIGNED) LANGUAGE SQL DETERMINISTIC BEGIN DECLARE num INTEGER UNSIGNED; START TRANSACTION; SET cur_tree_id = IF(choosen_tree > 0, choosen_tree, IFNULL((SELECT MAX(tree_id)+1 FROM GENERIC),1) ); IF parent_id = 0 THEN /* inserting a new root node*/ UPDATE GENERIC SET lft = lft+1, rgt = rgt+1 WHERE tree_id=cur_tree_id; SET num = IFNULL((SELECT MAX(rgt)+1 FROM GENERIC WHERE tree_id=cur_tree_id),2); INSERT INTO GENERIC(tree_id, id, lft, rgt) VALUES (cur_tree_id, NULL, 1, num); ELSE /* append a new node as last right child of his parent */ SET num = (SELECT rgt FROM GENERIC WHERE id = parent_id ); UPDATE GENERIC SET lft = CASE WHEN lft > num THEN lft + 2 ELSE lft END, rgt = CASE WHEN rgt >= num THEN rgt + 2 ELSE rgt END WHERE tree_id=cur_tree_id AND rgt >= num; INSERT INTO GENERIC(tree_id, id, lft, rgt) VALUES (cur_tree_id,NULL, num, (num + 1)); END IF; SELECT LAST_INSERT_ID() INTO new_id; COMMIT; END; /* ############################### */ /* ###### INSERT NODE AFTER ###### */ /* ############################### */ DROP PROCEDURE IF EXISTS Baobab_GENERIC_insertAfter; CREATE PROCEDURE Baobab_GENERIC_insertAfter( IN sibling_id INTEGER UNSIGNED, OUT new_id INTEGER UNSIGNED, OUT error_code INTEGER UNSIGNED) LANGUAGE SQL DETERMINISTIC main:BEGIN IF 1 = (SELECT lft FROM GENERIC WHERE id = sibling_id) THEN BEGIN SELECT Baobab_getErrCode('ROOT_ERROR') INTO error_code; LEAVE main; END; ELSE BEGIN DECLARE lft_sibling INTEGER UNSIGNED; DECLARE choosen_tree INTEGER UNSIGNED; START TRANSACTION; SELECT tree_id,rgt INTO choosen_tree,lft_sibling FROM GENERIC WHERE id = sibling_id; IF ISNULL(lft_sibling) THEN BEGIN SELECT Baobab_getErrCode('NODE_DOES_NOT_EXIST') INTO error_code; LEAVE main; END; END IF; UPDATE GENERIC SET lft = CASE WHEN lft < lft_sibling THEN lft ELSE lft + 2 END, rgt = CASE WHEN rgt < lft_sibling THEN rgt ELSE rgt + 2 END WHERE tree_id=choosen_tree AND rgt > lft_sibling; INSERT INTO GENERIC(tree_id,id,lft,rgt) VALUES (choosen_tree,NULL, (lft_sibling + 1),(lft_sibling + 2)); SELECT LAST_INSERT_ID() INTO new_id; COMMIT; END; END IF; END; /* ################################ */ /* ###### INSERT NODE BEFORE ###### */ /* ################################ */ DROP PROCEDURE IF EXISTS Baobab_GENERIC_insertBefore; CREATE PROCEDURE Baobab_GENERIC_insertBefore( IN sibling_id INTEGER UNSIGNED, OUT new_id INTEGER UNSIGNED, OUT error_code INTEGER UNSIGNED) LANGUAGE SQL DETERMINISTIC main:BEGIN IF 1 = (SELECT lft FROM GENERIC WHERE id = sibling_id) THEN BEGIN SELECT Baobab_getErrCode('ROOT_ERROR') INTO error_code; LEAVE main; END; ELSE BEGIN DECLARE rgt_sibling INTEGER UNSIGNED; DECLARE choosen_tree INTEGER UNSIGNED; START TRANSACTION; SELECT tree_id,lft INTO choosen_tree,rgt_sibling FROM GENERIC WHERE id = sibling_id; IF ISNULL(rgt_sibling) THEN BEGIN SELECT Baobab_getErrCode('NODE_DOES_NOT_EXIST') INTO error_code; LEAVE main; END; END IF; UPDATE IGNORE GENERIC SET lft = CASE WHEN lft < rgt_sibling THEN lft ELSE lft + 2 END, rgt = CASE WHEN rgt < rgt_sibling THEN rgt ELSE rgt + 2 END WHERE tree_id=choosen_tree AND rgt >= rgt_sibling ORDER BY lft DESC; /* order by is meant to avoid uniqueness violation on update */ INSERT INTO GENERIC(tree_id,id,lft,rgt) VALUES (choosen_tree,NULL, rgt_sibling, rgt_sibling + 1); SELECT LAST_INSERT_ID() INTO new_id; COMMIT; END; END IF; END; /* ################################### */ /* ###### INSERT CHILD AT INDEX ###### */ /* ################################### */ /* Add a new child to parent 'parent_id' at index 'index'. index is the new child position, 0 will put the new node as first. index can be negative, where -1 will put the new node before the last one */ DROP PROCEDURE IF EXISTS Baobab_GENERIC_InsertChildAtIndex; CREATE PROCEDURE Baobab_GENERIC_InsertChildAtIndex( IN parent_id INTEGER UNSIGNED, IN idx INTEGER, OUT new_id INTEGER UNSIGNED, OUT error_code INTEGER UNSIGNED) LANGUAGE SQL DETERMINISTIC BEGIN DECLARE nth_child INTEGER UNSIGNED; DECLARE cur_tree_id INTEGER UNSIGNED; SET error_code=0; SET new_id=0; CALL Baobab_GENERIC_getNthChild(parent_id,idx,nth_child,error_code); IF NOT error_code THEN CALL Baobab_GENERIC_insertBefore(nth_child,new_id,error_code); ELSE IF idx = 0 AND error_code = (SELECT Baobab_getErrCode('INDEX_OUT_OF_RANGE')) THEN BEGIN SET error_code = 0; CALL Baobab_GENERIC_AppendChild((SELECT tree_id FROM GENERIC WHERE id = parent_id), parent_id, new_id, cur_tree_id); END; END IF; END IF; END; /* ########################### */ /* ###### GET NTH CHILD ###### */ /* ########################### */ DROP PROCEDURE IF EXISTS Baobab_GENERIC_getNthChild; CREATE PROCEDURE Baobab_GENERIC_getNthChild( IN parent_id INTEGER UNSIGNED, IN idx INTEGER, OUT nth_child INTEGER UNSIGNED, OUT error_code INTEGER UNSIGNED) LANGUAGE SQL DETERMINISTIC main:BEGIN DECLARE num_children INTEGER; SET error_code=0; SELECT COUNT(*) INTO num_children FROM GENERIC_AdjTree WHERE parent = parent_id; IF num_children = 0 OR IF(idx<0,(-idx)-1,idx) >= num_children THEN /* idx is out of range */ BEGIN SELECT Baobab_getErrCode('INDEX_OUT_OF_RANGE') INTO error_code; LEAVE main; END; ELSE SELECT child INTO nth_child FROM GENERIC_AdjTree as t1 WHERE (SELECT count(*) FROM GENERIC_AdjTree as t2 WHERE parent = parent_id AND t2.lft<=t1.lft AND t1.tree_id=t2.tree_id ) = (CASE WHEN idx >= 0 THEN idx+1 ELSE num_children+1+idx END ) LIMIT 1; END IF; END; /* ###################################### */ /* ###### MOVE SUBTREE BEFORE NODE ###### */ /* ###################################### */ DROP PROCEDURE IF EXISTS Baobab_GENERIC_MoveSubtreeBefore; CREATE PROCEDURE Baobab_GENERIC_MoveSubtreeBefore( IN node_id_to_move INTEGER UNSIGNED, IN reference_node INTEGER UNSIGNED, OUT error_code INTEGER UNSIGNED) LANGUAGE SQL DETERMINISTIC main:BEGIN DECLARE node_revised INTEGER UNSIGNED; DECLARE move_as_first_sibling BOOLEAN; DECLARE ref_left INTEGER UNSIGNED; DECLARE ref_node_tree INTEGER UNSIGNED; SET error_code=0; /* 0 means no error */ SET move_as_first_sibling = TRUE; SELECT tree_id,lft INTO ref_node_tree,ref_left FROM GENERIC WHERE id = reference_node; IF ref_left = 1 THEN BEGIN /* cannot move a parent node before or after root */ SELECT Baobab_getErrCode('ROOT_ERROR') INTO error_code; LEAVE main; END; END IF; /* if reference_node is the first child of his parent, set node_revised to the parent id, else set node_revised to NULL */ SET node_revised = ( SELECT id FROM GENERIC WHERE tree_id=ref_node_tree AND lft = -1+ ref_left); IF ISNULL(node_revised) THEN /* if node_revised is NULL we must find the previous sibling */ BEGIN SET node_revised= (SELECT id FROM GENERIC WHERE tree_id=ref_node_tree AND rgt = -1 + ref_left); SET move_as_first_sibling = FALSE; END; END IF; CALL Baobab_GENERIC_MoveSubtree_real( node_id_to_move, node_revised , move_as_first_sibling, error_code ); END; /* ##################################### */ /* ###### MOVE SUBTREE AFTER NODE ###### */ /* ##################################### */ DROP PROCEDURE IF EXISTS Baobab_GENERIC_MoveSubtreeAfter; CREATE PROCEDURE Baobab_GENERIC_MoveSubtreeAfter( IN node_id_to_move INTEGER UNSIGNED, IN reference_node INTEGER UNSIGNED, OUT error_code INTEGER UNSIGNED) LANGUAGE SQL DETERMINISTIC BEGIN SELECT 0 INTO error_code; /* 0 means no error */ CALL Baobab_GENERIC_MoveSubtree_real( node_id_to_move,reference_node,FALSE,error_code ); END; /* ##################################### */ /* ####### MOVE SUBTREE AT INDEX ####### */ /* ##################################### */ DROP PROCEDURE IF EXISTS Baobab_GENERIC_MoveSubtreeAtIndex; CREATE PROCEDURE Baobab_GENERIC_MoveSubtreeAtIndex( IN node_id_to_move INTEGER UNSIGNED, IN parent_id INTEGER UNSIGNED, IN idx INTEGER, OUT error_code INTEGER) LANGUAGE SQL DETERMINISTIC main:BEGIN DECLARE nth_child INTEGER UNSIGNED; DECLARE num_children INTEGER; DECLARE parent_of_node_to_move INTEGER UNSIGNED; DECLARE s_lft INTEGER UNSIGNED; DECLARE current_idx INTEGER; SET error_code=0; SELECT COUNT(*) INTO num_children FROM GENERIC_AdjTree WHERE parent = parent_id; IF idx < 0 THEN SET idx = num_children + idx; ELSEIF idx > 0 THEN BEGIN SELECT parent, lft INTO parent_of_node_to_move, s_lft FROM GENERIC_AdjTree WHERE child = node_id_to_move; IF parent_of_node_to_move = parent_id THEN BEGIN SELECT count(*) INTO current_idx FROM GENERIC_AdjTree WHERE parent = parent_id AND lft < s_lft; IF idx > current_idx THEN SET idx = idx + 1; END IF; END; END IF; END; END IF; SET idx = IF(idx<0,num_children+idx,idx); IF idx = 0 THEN /* moving as first child, special case */ CALL Baobab_GENERIC_MoveSubtree_real(node_id_to_move,parent_id,TRUE,error_code); ELSE BEGIN /* search the node before idx, and we wil move our node after that */ CALL Baobab_GENERIC_getNthChild(parent_id,idx-1,nth_child,error_code); IF NOT error_code THEN CALL Baobab_GENERIC_MoveSubtree_real(node_id_to_move,nth_child,FALSE,error_code); END IF; END; END IF; END; /* ####################################### */ /* ####### MOVE SUBTREE REAL LOGIC #######*/ /* ####################################### */ /* If move_as_first_sibling is FALSE, move node_id_to_move after reference_node, else reference_node is the new father of node_id_to_move */ SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_UNSIGNED_SUBTRACTION'; DROP PROCEDURE IF EXISTS Baobab_GENERIC_MoveSubtree_real; CREATE PROCEDURE Baobab_GENERIC_MoveSubtree_real( IN node_id_to_move INTEGER UNSIGNED, IN reference_node INTEGER UNSIGNED, IN move_as_first_sibling BOOLEAN, OUT error_code INTEGER ) LANGUAGE SQL DETERMINISTIC main:BEGIN DECLARE s_lft INTEGER UNSIGNED; DECLARE s_rgt INTEGER UNSIGNED; DECLARE ref_lft INTEGER UNSIGNED; DECLARE ref_rgt INTEGER UNSIGNED; DECLARE source_node_tree INTEGER UNSIGNED; DECLARE ref_node_tree INTEGER UNSIGNED; DECLARE diff_when_inside_sourcetree BIGINT SIGNED; DECLARE diff_when_next_sourcetree BIGINT SIGNED; DECLARE ext_bound_1 INTEGER UNSIGNED; DECLARE ext_bound_2 INTEGER UNSIGNED; SET error_code=0; START TRANSACTION; /* select tree, left and right of the node to move */ SELECT tree_id,lft, rgt INTO source_node_tree, s_lft, s_rgt FROM GENERIC WHERE id = node_id_to_move; /* select left and right of the reference node If moving as first sibling, ref_lft will become the new lft value of node_id_to_move, (and ref_rgt is unused), else we're saving left and right value of soon to be previous sibling */ SELECT tree_id, IF(move_as_first_sibling,lft+1,lft), rgt INTO ref_node_tree, ref_lft, ref_rgt FROM GENERIC WHERE id = reference_node; IF move_as_first_sibling = TRUE THEN IF s_lft <= ref_lft AND s_rgt >= ref_rgt AND source_node_tree=ref_node_tree THEN /* cannot move a parent node inside his own subtree */ BEGIN SELECT Baobab_getErrCode('CHILD_OF_YOURSELF_ERROR') INTO error_code; LEAVE main; END; ELSE IF s_lft > ref_lft THEN BEGIN SET diff_when_inside_sourcetree = -(s_lft-ref_lft); SET diff_when_next_sourcetree = s_rgt-s_lft+1; SET ext_bound_1 = ref_lft; SET ext_bound_2 = s_lft-1; END; ELSEIF s_lft = ref_lft and source_node_tree = ref_node_tree THEN BEGIN /* we have been asked to move a node to his same position */ LEAVE main; END; ELSE BEGIN SET diff_when_inside_sourcetree = ref_lft-s_rgt-1; SET diff_when_next_sourcetree = -(s_rgt-s_lft+1); SET ext_bound_1 = s_rgt+1; SET ext_bound_2 = ref_lft-1; END; END IF; END IF; ELSE /* moving after an existing child */ IF ref_lft = 1 THEN /* cannot move a node before or after root */ BEGIN SELECT Baobab_getErrCode('ROOT_ERROR') INTO error_code; LEAVE main; END; ELSEIF s_lft < ref_lft AND s_rgt > ref_rgt AND source_node_tree=ref_node_tree THEN /* cannot move a parent node inside his own subtree */ BEGIN SELECT Baobab_getErrCode('CHILD_OF_YOURSELF_ERROR') INTO error_code; LEAVE main; END; ELSE IF s_lft > ref_rgt THEN BEGIN SET diff_when_inside_sourcetree = -(s_lft-ref_rgt-1); SET diff_when_next_sourcetree = s_rgt-s_lft+1; SET ext_bound_1 = ref_rgt+1; SET ext_bound_2 = s_lft-1; END; ELSE BEGIN SET diff_when_inside_sourcetree = ref_rgt-s_rgt; SET diff_when_next_sourcetree = -(s_rgt-s_lft+1); SET ext_bound_1 = s_rgt+1; SET ext_bound_2 = ref_rgt; END; END IF; END IF; END IF; IF source_node_tree <> ref_node_tree THEN BEGIN CALL Baobab_GENERIC_MoveSubtree_Different_Trees( node_id_to_move,reference_node,move_as_first_sibling); LEAVE main; END; END IF; UPDATE GENERIC SET lft = lft + CASE WHEN lft BETWEEN s_lft AND s_rgt THEN diff_when_inside_sourcetree WHEN lft BETWEEN ext_bound_1 AND ext_bound_2 THEN diff_when_next_sourcetree ELSE 0 END , rgt = rgt + CASE WHEN rgt BETWEEN s_lft AND s_rgt THEN diff_when_inside_sourcetree WHEN rgt BETWEEN ext_bound_1 AND ext_bound_2 THEN diff_when_next_sourcetree ELSE 0 END WHERE tree_id=source_node_tree; COMMIT; END; SET sql_mode=@OLD_SQL_MODE; DROP PROCEDURE IF EXISTS Baobab_GENERIC_MoveSubtree_Different_Trees; CREATE PROCEDURE Baobab_GENERIC_MoveSubtree_Different_Trees( IN node_id_to_move INTEGER UNSIGNED, IN reference_node INTEGER UNSIGNED, IN move_as_first_sibling BOOLEAN ) LANGUAGE SQL DETERMINISTIC main:BEGIN DECLARE s_lft INTEGER UNSIGNED; DECLARE s_rgt INTEGER UNSIGNED; DECLARE ref_lft INTEGER UNSIGNED; DECLARE ref_rgt INTEGER UNSIGNED; DECLARE source_node_tree INTEGER UNSIGNED; DECLARE ref_node_tree INTEGER UNSIGNED; START TRANSACTION; /* select tree, left and right of the node to move */ SELECT tree_id,lft, rgt INTO source_node_tree, s_lft, s_rgt FROM GENERIC WHERE id = node_id_to_move; /* The current select will behave differently whether we're moving the node as first sibling or not. If move_as_first_sibling, ref_lft will have the value of the "lft" field of node_id_to_move at end of move (ref_rgt here is discarded) else ref_lft and ref_rgt will have the values of the node before node_id_to_move at end of move */ SELECT tree_id, IF(move_as_first_sibling,lft+1,lft), rgt INTO ref_node_tree, ref_lft, ref_rgt FROM GENERIC WHERE id = reference_node; IF (move_as_first_sibling) THEN BEGIN /* create a gap in the destination tree to hold the subtree */ UPDATE GENERIC SET lft = CASE WHEN lft < ref_lft THEN lft ELSE lft + s_rgt-s_lft+1 END, rgt = CASE WHEN rgt < ref_lft THEN rgt ELSE rgt + s_rgt-s_lft+1 END WHERE tree_id=ref_node_tree AND rgt >= ref_lft; /* move the subtree to the new tree */ UPDATE GENERIC SET lft = ref_lft + (lft-s_lft), rgt = ref_lft + (rgt-s_lft), tree_id = ref_node_tree WHERE tree_id = source_node_tree AND lft >= s_lft AND rgt <= s_rgt; END; ELSE BEGIN /* create a gap in the destination tree to hold the subtree */ UPDATE GENERIC SET lft = CASE WHEN lft < ref_rgt THEN lft ELSE lft + s_rgt-s_lft+1 END, rgt = CASE WHEN rgt <= ref_rgt THEN rgt ELSE rgt + s_rgt-s_lft+1 END WHERE tree_id=ref_node_tree AND rgt > ref_rgt; /* move the subtree to the new tree */ UPDATE GENERIC SET lft = ref_rgt+1 + (lft-s_lft), rgt = ref_rgt+1 + (rgt-s_lft), tree_id = ref_node_tree WHERE tree_id = source_node_tree AND lft >= s_lft AND rgt <= s_rgt; END; END IF; /* close the gap in the source tree */ CALL Baobab_GENERIC_Close_Gaps(source_node_tree); COMMIT; END; /* ########################## */ /* ####### CLOSE GAPS ####### */ /* ########################## */ DROP PROCEDURE IF EXISTS Baobab_GENERIC_Close_Gaps; CREATE PROCEDURE Baobab_GENERIC_Close_Gaps( IN choosen_tree INTEGER UNSIGNED) LANGUAGE SQL DETERMINISTIC BEGIN UPDATE GENERIC SET lft = (SELECT COUNT(*) FROM ( SELECT lft as seq_nbr FROM GENERIC WHERE tree_id=choosen_tree UNION ALL SELECT rgt FROM GENERIC WHERE tree_id=choosen_tree ) AS LftRgt WHERE tree_id=choosen_tree AND seq_nbr <= lft ), rgt = (SELECT COUNT(*) FROM ( SELECT lft as seq_nbr FROM GENERIC WHERE tree_id=choosen_tree UNION ALL SELECT rgt FROM GENERIC WHERE tree_id=choosen_tree ) AS LftRgt WHERE tree_id=choosen_tree AND seq_nbr <= rgt ) WHERE tree_id=choosen_tree; END help - can you tell me why this is giving the following error
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DROP TABLE IF EXISTS `admin`' at line 8
i am trying to import a data file ... first few lines of which are
-- MySQL dump 10.10 -- -- Host: localhost Database: bromleyone -- ------------------------------------------------------ -- Server version 5.0.22-Debian_0ubuntu6.06.10-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; use bromleyone -- -- Table structure for table `admin` -- DROP TABLE IF EXISTS `admin`; CREATE TABLE `admin` ( `id` int(11) NOT NULL auto_increment, `username` varchar(30) NOT NULL default '', `password` varchar(30) NOT NULL default '', `name` varchar(40) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; I’ve just read several manual pages and forum comments on "Error number 1064" but I still don’t understand what’s going on with the problem I'm having now … Also, I'm surprised that the error message mentions two different line numbers (1 and 35). Here is the error message I get : And here are the contents of my "one_more_visit_to_topic.php" file : <?php include("includes/model/database_searches/see_readings.php"); include("includes/model/database_searches/see_watchings.php"); function one_more_visit_to_topic($user_id,$topic_id) { global $db; $request_string='UPDATE forum_topic '. 'SET topic_vu = topic_vu + 1 WHERE topic_id = :topic'; $query=$db->prepare($request_string); $query->bindValue(':topic',$topic_id,PDO::PARAM_INT); $query->execute(); $query->CloseCursor(); // Remember that topic has been read by user if(!(see_if_user_has_read_topic($user_id,$topic_id))) { $request_string='INSERT INTO forum_read (fr_topic_id,fr_user_id) '. 'VALUES (:topic,:user)'; $query=$db->prepare($request_string); $query->bindValue(':topic',$topic_id,PDO::PARAM_INT); $query->bindValue(':user',$user_id,PDO::PARAM_INT); $query->execute(); $query->CloseCursor(); } // If user has already received a warning by mail, // the "alert" value needs to be toggled in the fw_watch table if(see_if_user_has_been_warned($user_id,$topic_id)) { $request_string='UPDATE forum_read SET fw_alert = :alt '. 'WHERE fw_topic_id = :topic AND fw_user_id= :user)'; $query=$db->prepare($request_string); $query->bindValue(':topic',$topic_id,PDO::PARAM_INT); $query->bindValue(':user',$user_id,PDO::PARAM_INT); $one=(int)1; $query->bindValue(':alt',$one,PDO::PARAM_INT); $query->execute(); $query->CloseCursor(); } return; } ?> Hi, I have some jQuery tabs. I would like to be able to link to them directly, but I can't work out how to do this. I have the following code: <div class="container-outer">How could I link directly to each of the tabs? Thanks! I hope someone can help me out with this. What I would like to do is import a text file dircetly to a text area. I can't seem to find any examples on this (Yes I did search Google). I know how to upload but I'm not interested in storing files on the server - but rather just importing them directly to a textarea. Can anyone point me in the right direction? I can upload: <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> I can read: $myFile = "testFile.txt"; $fh = fopen($myFile, 'w') But I'm not interested in either of these as they are unnecessary steps (or are they?). Is there not a way to simply browse/import a text file directly to a textarea (or anywhere for that matter) without having to actually save the file to the server? Something like this: <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> //uploader.php if (isset($_POST['submit'])) { $content = $_POST['"grab the contents of the file"']; echo "<textarea>"; echo $content; echo "</textarea>"; } Hi, im using colorbox(basically like lightbox) for some links on my site. When a user clicks the link it opens this lightbox. But if they type the link into the address bar manually it takes them to the actual page(which isnt formatted properly). Is there a way to open up the lightbox when they enter the address manually? or a work around? I'm trying to figure out a way to post data directly to a URL. For example: <?php if (isset($_POST["pass"]) && ($_POST["pass"]=="$password")) { echo "You did it"; ?> <?php } else { echo "<form method=\"post\"><p align=\"left\">"; echo "<input name=\"pass\" type=\"text\" size=\"25\" maxlength=\"40\"><input value=\"Enter Pass\" type=\"submit\"></form>"; exit; } ?> Let's assume $password is 'password'. Why can't I simply pass the information through the URL to access the page with something like this: Code: [Select] http://mypage.com/the-same-page.php?pass=password I am making a pos(point of sale) application using object oriented php. I have found thermal receipt printers support ESC/POS . i want that when i will press button to print directly , it will do automatically. anyone can help me please. Thanks in advance. Hi all, i want to download a file from the server but instead of storing it in the downloads i want it to store it directly in the folder i want and i also dont want to show any download window that appears while we download any file. Friend please help..... Hello, I have found the following code which creates a sitemap from the home directory of files. Please could you point me in the right direction for changing this so that it looks up from my sql database and for each name within the database creates an entry in the sitemap (e.g. www.mysite.com/[NAME]). Thanks for your help, Stu Code: [Select] <?php /******************************************************************************\ * Author : Binny V Abraham * * Website: http://www.bin-co.com/ * * E-Mail : binnyva at gmail * * Get more PHP scripts from http://www.bin-co.com/php/ * ****************************************************************************** * Name : PHP Google Search Sitemap Generator * * Version : 1.00.A * * Date : Friday 17 November 2006 * * Page : http://www.bin-co.com/php/programs/sitemap_generator/ * * * * You can use this script to create the sitemap for your site automatically. * * The script will recursively visit all files on your site and create a * * sitemap XML file in the format needed by Google. * * * * Get more PHP scripts from http://www.bin-co.com/php/ * \******************************************************************************/ // Please edit these values before running your script. //////////////////////////////////// Options //////////////////////////////////// $url = "http://www.WEBSITE_NAME.com/"; //The Url of the site - the last '/' is needed $root_dir = ''; //Where the root of the site is with relation to this file. $file_mask = '*.php'; //Or *.html or whatever - Any pattern that can be used in the glob() php function can be used here. //The file to which the result is written to - must be writable. The file name is relative from root. $sitemap_file = 'sitemap.xml'; // Stuff to be ignored... //Ignore the file/folder if these words appear in the name $always_ignore = array( 'local_common.php','images' ); //These files will not be linked in the sitemap. $ignore_files = array( '404.php','error.php','configuration.php','include.inc' ); //The script will not enter these folders $ignore_folders = array( 'Waste','php_uploads','images','includes','lib','js','css','styles','system','stats','CVS','.svn' ); //The default priority for all pages - the priority of all pages will increase/decrease with respect to this. $starting_priority = ($_REQUEST['starting_priority']) ? $_REQUEST['starting_priority'] : 70; /////////////////////////// Stop editing now - Configurations are over //////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// function generateSiteMap() { global $url, $file_mask, $root_dir, $sitemap_file, $starting_priority; global $always_ignore, $ignore_files, $ignore_folders; global $total_file_count,$average, $lowest_priority_page, $lowest_priority; /////////////////////////////////////// Code //////////////////////////////////// chdir($root_dir); $all_pages = getFiles(''); $xml_string = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.google.com/schemas/sitemap/0.84" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd"> <?php # '; $modified_priority = array(); for ($i=30;$i>0;$i--) array_push($modified_priority,$i); $lowest_priority = 100; $lowest_priority_page = ""; //Process the files foreach ($all_pages as $link) { //Find the modified time. $handle = fopen($link,'r'); $info = fstat($handle); fclose($handle); $modified_at = date('Y-m-d\Th:i:s\Z',$info['mtime']); $modified_before = ceil((time() - $info['mtime']) / (60 * 60 * 24)); $priority = $starting_priority; //Starting priority //If the file was modified recently, increase the importance if($modified_before < 30) { $priority += $modified_priority[$modified_before]; } if(preg_match('/index\.\w{3,4}$/',$link)) { $link = preg_replace('/index\.\w{3,4}$/',"",$link); $priority += 20; } //These priority detectors should be different for different sites :TODO: if(strpos($link,'example')) $priority -= 30; //If the page is an example page elseif(strpos($link,'demo')) $priority -= 30; if(strpos($link,'tuorial')) $priority += 10; if(strpos($link,'script')) $priority += 5; if(strpos($link,'other') !== false) $priority -= 20; //Priority based on depth $depth = substr_count($link,'/'); if($depth < 2) $priority += 10; // Yes, I know this is flawed. if($depth > 2) $priority += $depth * 5; // But the results are better. if($priority > 100) $priority = 100; $loc = $url . $link; if(substr($loc,-1,1) == '/') $loc = substr($loc,0,-1);//Remove the last '/' char. $total_priority += $priority; if($lowest_priority > $priority) { $lowest_priority = $priority;//Find the file with the lowest priority. $lowest_priority_page = $loc; } $priority = $priority / 100; //The priority is given in decimals $xml_string .= " <url> <loc>$loc</loc> <lastmod>$modified_at</lastmod> <priority>$priority</priority> </url>\n"; } $xml_string .= "</urlset>"; if(!$hndl = fopen($sitemap_file,'w')) { //header("Content-type:text/plain"); print "Can't open sitemap file - '$sitemap_file'.\nDumping result to screen...\n<br /><br /><br />\n\n\n"; print '<textarea rows="25" cols="70" style="width:100%">'.$xml_string.'</textarea>'; } else { print '<p>Sitemap was written to <a href="' . $url.$sitemap_file .'">'. $url.$sitemap_file .'></a></p>'; fputs($hndl,$xml_string); fclose($hndl); } $total_file_count = count($all_pages); $average = round(($total_priority/$total_file_count),2); } ///////////////////////////////////////// Functions ///////////////////////////////// // File finding function. function getFiles($cd) { $links = array(); $directory = ($cd) ? $cd . '/' : '';//Add the slash only if we are in a valid folder $files = glob($directory . $GLOBALS['file_mask']); foreach($files as $link) { //Use this only if it is NOT on our ignore lists if(in_array($link,$GLOBALS['ignore_files'])) continue; if(in_array(basename($link),$GLOBALS['always_ignore'])) continue; array_push($links, $link); } //asort($links);//Sort 'em - to get the index at top. //Get All folders. $folders = glob($directory . '*',GLOB_ONLYDIR);//GLOB_ONLYDIR not avalilabe on windows. foreach($folders as $dir) { //Use this only if it is NOT on our ignore lists $name = basename($dir); if(in_array($name,$GLOBALS['always_ignore'])) continue; if(in_array($dir,$GLOBALS['ignore_folders'])) continue; $more_pages = getFiles($dir); // :RECURSION: if(count($more_pages)) $links = array_merge($links,$more_pages);//We need all thing in 1 single dimentional array. } return $links; } //////////////////////////////// Display ///////////////////////////// ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.1 Transitional//EN"> <html> <head> <title>Sitemap Generation Using PHP</title> <style type="text/css"> a {color:blue;text-decoration:none;} a:hover {color:red;} </style> </head> <body> <h1>PHP Google Search Sitemap Generator Script</h1> <?php if($_POST['action'] == 'Create Sitemap') { generateSiteMap(); ?> <h2>Sitemap Created...</h2> <h2>Statastics</h2> <p><strong><?php echo $total_file_count; ?></strong> files were found and indexed.<br /> Lowest priority of <strong><?php echo $lowest_priority; ?></strong> was given to <a href='<?php echo $lowest_priority_page; ?>'><?php echo $lowest_priority_page; ?></a></p> Average Priority : <strong><?php echo $average; ?></strong><br /> <h2>Redo</h2> <?php } else { ?> <p>You can use this script to create the sitemap for your site automatically. The script will recursively visit all files on your site and create a sitemap XML file in the format needed by Google. </p> <p>You can customize the result by changing the starting priorities.</p> <h2>Set Starting Priority</h2> <?php } ?> <form action="create_sitemap.php" method="post"> Starting Priority : <input type="text" name="starting_priority" size="3" value="<?php echo $starting_priority; ?>" /> <input type="submit" name="action" value="Create Sitemap" /> </form> </body> </html> Trying to figure out what's best practice when it comes to parsing XML and echoing it into a pretty little table. should I save all the data in a array and then loop through the array? Or should I just echo the data directly from the XML file? Any thoughts would be welcomed. Hi there I've recently been working on a Laravel project. It's a project I've been drafted in to work on and I've not used Laravel before. My question is one of what is considered good practice. In this project the controllers pass whole models back to the view. For instance, its the norm on the project to pass back a whole booking model just to get at a couple of attributes like booking->id and booking->name. As these attributes represent database columns it feels a bit wrong to pass these around because you're effectively coupling the view to the structure of the database. I know behind the scenes Laravel is using a magic method to access the properties so you could argue they are wrapped in a method and therefore don't expose the direct database structure to views. So the question is, would you pass database models directly to views in this way? Or is it 'better' to map those models to an intermediary model that is dedicated to the view (a sort of dto)? Thanks,
Drongo I'm working with a lightbox plugin to show images when thumbnails are clicked on. The plugin works by wrapping the thumbnail in an anchor tag that has the href as the direct path to the full-size image. This acts as a non-js fallback, so that if JS isn't present for whatever reason, the user still sees the image. When JS is enabled, the image is shown in the lighbox, resized to fit in the lightbox, which is a variable size depending on the browser.
I need to keep a record of the number of times that the image has been clicked on, as thumbnails will be ordered by the number of views. The problem of course is that I'm directly linking to the image, so I can't put a script on this page.
I've tried two things instead, neither of which worked:
1) Instead setting the target as the path to the image, I set it to a PHP script, then outputted the image in an <img/> tag. The problem was that the image is then not resized according to the size of the lighbox. So this is no good.
2) I set the target of the lightbox as a PHP script which recorded the viewing of the image, and redirected to the image page. This didn't work either, as the lightbox showed the data for the image (text) instead of the image itself.
So, I've hit a bit of a barrier. I'm wondering if I can set something up in my PHP settings that will automatically call a script when hitting images, or maybe something in an .htaccess file that will do the same, but I'm not aware of if this can be done, nor how to do it, and I haven't found anything yet with my googling. Does anyone have any thoughts?
Thanks.
Edited by haku, 26 August 2014 - 07:00 PM. Hi,
I need to create a landing page with a form. That form needs to be recorded somewhere instead of sent to email. I know I can write it to a SQL database, and then to an excel file. But I only need a temporary solution so I figured I'd just go straight to CSV.
Is this bad practice? What potential problems might I encounter other than security issues?
Hi all, ive been trying to code a "Create A Crew" for my website which just basicly lets users be in a group, but at the moment ive got as far as coding it where they buy one. When I tryed running my script it just displayed a White Page with no Errors.. I tryed looking though agian but still couldn't work out what the error was. <?php session_start(); include ("includes/config.php"); include ("includes/functions.php"); logincheck(); ini_set ('display_errors', 1); error_reporting (E_ALL); $username = $_SESSION['username']; // Select , Crew, money, crew limit etc from db $mysql1 = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'") or die ("Error, Line 10 " . mysql_error()); // Doing User Query $userfetch = mysql_fetch_object($mysql1); // Getting User Object $mysql2 = mysql_query("SELECT * FROM `crews` WHERE `username` = '$username'") or die ("Error, Line 13 " . mysql_error()); // Doing Crew Query $crewfetch = mysql_fetch_object($mysql2); // Getting Crew Object $allcrews = mysql_num_rows(mysql_query("SELECT * FROM `crews`")); // Lets start! // If the user who wants to buy the crew is in one.. Lets say. if ($userfetch->crew != "0"){ echo ("You must leave your current crew before creating your own!"); } $crewname = $_POST['crewname']; // Name of the crew wanted if (strip_tags($_POST['submit']) || strip_tags($_POST['crewname'])){ $price = 50000000; // 50mil // Now, See if the posted crew name is allready taken, if so say.. if ($crewname){ $freeornot = mysql_query("SELECT * FROM `crews` WHERE `name` = '$crewname'"); // Selecting the crew if it exicts $number = mysql_num_rows($freeornot); if ($number != "0"){ echo ("The Crew Name Allready Made!"); // Crew name done. }elseif (ereg('[^A-Za-z]', $crewname){ echo ("Crew Names can only contain Letters!"); // Letters only. Done! }elseif ($userfetch->money < $price){ echo ("You do not have enouth money to buy a Crew!"); // Money check. Done! }else{ // Every check is done, and if all are good, we insert the crew into the db! =) // Insert mysql_query("INSERT INTO crews (`id`,`name`,`size`,`profile`,`bank`,`boss`,`underboss`,`recruiter`,`recruiter1`,`coowner`,`members`,`garage`,`garagesize`) VALUES ('','$crewname','10','','','$username','','','','','','','')") or die ("Error , line 42 " . mysql_error()); mysql_query("UPDATE users SET crew = '$crewname' WHERE username= '$username'") or die ("Error , Line 43 " . mysql_error()); $moneyleft = $userfetch->money - $price; mysql_query("UPDATE users SET money = '$moneyleft' WHERE username='$username'") or die ("Error , Line 45 " . mysql_error()); echo ("Crew Made!"); } } } // Submit ?> <html> <head> <title>Crews || SD</title> </head> <body class='body'> <?php if ($allcrews < 51){ echo (" <table width='40%' align='center' class='table' cellpadding='0' cellspacing='0' border='1'> <tr> <td class='header' align='center'>Crew Create</td> </tr> <tr> <td class='omg' align='center'>Crew Name:</td> </tr> <tr> <td><input type='text' name='crewname' id='crewname' maxlength='50' class='input'></td> </tr> <tr> <td>When creating a crew it will have a member limit of <strong>10</strong> you will have chance to upgrade this though the Control Panel!</td> </tr> <tr> <td align='center' class='omg'><input type='button' name='submit' class='button' value='Create Crew'></td> </tr> </table>"); }elseif ($allcrews > 50){ echo ("<table width='40%' align='center' class='table' cellpadding='0' cellspacing='0' border='1'> <tr> <td class='header' align='center'>Crew Create</td> </tr> <tr> <td>Sorry, but the limit of crews have been reached. Please wait untill one is deleted.</td> </tr> </table>"); } ?> </body> </html> Anyone see why its just displaying a White Page? Thanks for any help given. Hi there, Can anybody help me to write php/javascript code which will allow users to open files directly from web browser into desktop application? Here is the specification: I have a photo editing business with many people working in Photoshop. I am currently developing a web based application (joblist) using Javascript and PHP which should allow the photoshop designers to browse and open files/images directly from joblist/web browser into photoshop. The reason I want this instead of browsing folder is that I have a database where I store who worked on which file, when and how long it took. The concept is that, designers will select a file and click on start, as soon as they click on start the original file will open in Photoshop and there will be an entry into database (using PHP). Once they finish the task they will close the file and click on Finish button. My joblist application will be published in a local server and the file will be open on a local network, so when they save the file it will be saved where the source file is located in (local server). The application should work in both PC and Mac. I have already done all other part of the application except file opening directly from browser to desktop application functionality. Anybody can help me to write the code (PHP or Javascript) which can open the file from browser (local server) directly into desktop application e.g. PHotoshop or Illustrator? Thank you very much I look forward to someone's real help! Best regards Mr. Sumon example:
pulling a 5x5 array of data from a database
time differences:
components (unbuilt):13400101661682
elements (built):13817119598389
How I'm stealing the elements from the PHP code:
ob_start();
...
ob_end_clean();
|