mysql-error-1064

Cant Update MySQL database

I am trying to learn mysql and having some problem with updating/adding data to the table this is my code and after running this page when I go to phpmyadmin to see if the new data showed up, i dont see it there. <?php $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(!$conn) { die("Could not connect"); } $dbname = "test"; mys...

Syntax Error in Create Function

This is one of the more confusing functions I've attempted. The logic works within a select statement, but I can't seem to create a user-defined function. Here's the 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 'delimiter$$ creat...

SQL error, I don't get it

INSERT INTO `tims`.`pending_profile`(`id`, `nickname`, `location`, `role`, `yog`, `interests`, `favMoment`, `gainThisYr`, `futurePlans`, `bio`) VALUES ('1', '1', '1', '1', '', '1', '1', '1', '1', '1') ON DUPLICATE KEY UPDATE ( nickname ='1', location= '1', role= '1',yog= '1',interests= '1',favMoment= '1',gainThisYr= '1',futurePlans= '1'...

Does anyone see anything wrong with this? Mysql+PHP Error

I'm running the following line : mysql_query("INSERT INTO tags SET tag = '".$onesearch."', SET date = '".date('d-m-Y')."'") or die(mysql_error()); ...and its dieing saying this: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right synt...

MySQL/PHP update query error

I'm running a query to update a small group of 'items' in a table, from PHP. Running the code with "Sequel Pro" executes it perfectly, while running it on PHP using mysql("query here"); fails miserably. Is there anything wrong with my query? UPDATE `service_joblocation` SET `in_use` = '1', `in_use_since` = '1283488686',...

While exists in mysql

How should i use while loop in mysql? while exists (select * from table1) Do //sql statements end while Error Code : 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 while.... This what I want to do: Inserting 20K records into a table...

Executing MySQL Query from PHP error

This part of my code creates a multiple query by this: $sql = ""; $sql .= "INSERT INTO projects (project_id, project_name, project_description, project_deadline, project_status, project_priority) VALUES ('" . $project_id . "', '" . $name . "', '" . $description . "', '" . $final_deadline . "', '" . $status . "', '" . $p...

SQL Syntax Error whilst creating a table

Hi, I have recently started learning SQL, I can't determine what is causing my syntax error (see below): CREATE TABLE Users( user_id smallint not null auto_increment, username varchar(50) unique, password varchar(41), dob date, session_id varchar not null, cookie varchar not null, PRIMARY KEY(user_id), C...

MySql Error 1064 - Created using MySQL WorkBench

I created this using MySQL WorkBench CREATE TABLE IF NOT EXISTS `bakasura_new`.`cities` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NOT NULL COMMENT 'City Name' , `short_name` VARCHAR(255) NOT NULL COMMENT 'Short Name' , `country_id` INT(11) UNSIGNED NOT NULL , PRIMARY KEY (`id`) , INDEX `fk_cities...

MYSQL Error 1064 when importing stored procedures

I'm importing a stored procedure which I just exported from my development server into my production one and I ran into the following error in phymyadmin. SQL query: Documentation $$ CREATE DEFINER = `devuser`@`localhost` FUNCTION `get_refundable_amount` ( enrol_id INT ) RETURNS double( 10, 2 ) READS SQL DATA BEGIN DECLARE refundable_a...

Syntax error in MySQL WITH ROLLUP query?

Any idea why the following query syntax is wrong: SELECT year, sum(profit) FROM BASEDATA b group by year WITH rollup Error Code: 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..... MYSQL Version 5.0.77-community-log ...

Creating functions in mysql doesnt work - Error 1064

I tried this example via phpMyAdmin http://www.databasejournal.com/features/mysql/article.php/3569846/MySQL-Stored-Functions.htm mysql> DELIMITER | mysql> CREATE FUNCTION WEIGHTED_AVERAGE (n1 INT, n2 INT, n3 INT, n4 INT) RETURNS INT DETERMINISTIC BEGIN DECLARE avg INT; SET avg = (n1+n2+n3*2+n4*4)/8; RETURN avg; ...

mySQL Syntax Error

INSERT into error_log (id_user, id_error, severity, date) VALUES ('93, '1', '6', '1285886665') Throwing 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 '1', '6', '1285886794')' at line 4 Table CREATE TABLE `error_log` ( `id` int(25) N...

Unable to import MYSQL function - ERROR 1064 (42000)

I'm trying to understand why the following is failing and I'm not able to see it. The phpMyAdmin on our development server generated this exactly, but when I try importing it - I'm running into a weird parsing(?) error. mysql> DELIMITER $$ mysql> mysql> -- mysql> -- Functions mysql> -- mysql> DROP FUNCTION IF EXISTS `get_class_nextsessi...

What is wrong with this MySQL Query?

It's 12:30am and I have been coding for 9 hours straight. I really need to get this project done, but MySQL is messing with my deadline. Could you examine this snippet for me and see if you can find out what is wrong? PHP/MySQL Query $q = $this->db->query("SELECT * FROM bans WHERE ip='".$ip."'"); Keeps returning the following error.....

MySQL error with SQL AS

Hi there, I'm receiving the following error with this page while trying to retrieve information from my database; 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 'FROM catalog_product_entity cpe inner join catalog_product_entity_varchar c...

Mysql create trigger 1064 error

The sql i wrote **delimiter | CREATE DEFINER=CURRENT_USER TRIGGER set_profiletype_after_insert BEFORE INSERT ON trl_translator FOR EACH ROW BEGIN UPDATE trl_profile SET trl_profile.type = 'translator' WHERE trl_profile.profile_id = NEW.translator_id END | delimiter ;** The error given [SQL] **CREATE DEFINER=CURRENT_USER TRIGG...

MySQL SQL syntax error problem?

I get the following error below and was wondering how can I fix it? 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 '.user_id WHERE users.active IS NULL AND users.deletion = 0) WHERE users.active' at line 4 And here is my MySQL code (line breaks inse...

SQL error #1064

Trying to enter a value into a mediumblob field in a mySQL table but I'm getting: 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 'WHERE id = 40' at line 3 INSERT INTO 'Picture' VALUES (efvr) WHERE id = 40 What's wrong with this statem...

How do I get my PHP update function to work?

See something wrong in my code? I can't get the update function to work.. weird thing is the rest works correctly, and the same code works 100% on another page. <?php include("config.php"); $id = $_GET['id']; $number = $_GET['no']; $result = mysql_query("SELECT * FROM comments WHERE commentid = '$id'") or die(mysql_error()); $row ...