mysql-error-1064

sql error errno: 121

CREATE TABLE `users` ( `UID` INT UNSIGNED NOT NULL AUTO_INCREMENT , `username` VARCHAR(45) NOT NULL , `password` VARCHAR(100) NULL , `name` VARCHAR(100) NULL , `gender` BIT NULL , `email` VARCHAR(255) NULL , `phone` VARCHAR(30) NOT NULL , `verified` BIT NOT NULL DEFAULT 0 , `time_zone` INT NULL , `time_register` DAT...

problem using aggregate functions with multipul table joins

My goal is to make an aggregate function (sum) and group the elements , but there is an error this is all the steps that i have done 1- first step code SELECT ca.question_id , ca.choice_0 ,ca.choice_1 ,ca.choice_2 ,ca.choice_3 ,ca.choice_4 ,q.headline_id FROM closed_answers ca INNER JOIN questions q ON ca.question_id...

How to delete from multiple tables in MySQL?

I am trying to delete from a few tables at once. I've done a bit of research, and came up with this DELETE FROM `pets` p, `pets_activities` pa WHERE p.`order` > :order AND p.`pet_id` = :pet_id AND pa.`id` = p.`pet_id` However, I am getting this error Uncaught Database_Exception [ 1064 ]: You have ...

MySQL error when using send() method of Email component in CakePHP

I've followed the tutorial here: http://book.cakephp.org/view/1286/Sending-a-basic-message, which I have successfully used before with 1.2. However, in 1.3, with a different application, I get the following error: Warning (512): SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL ser...

Mysql assigning default causes error

Hi, I am trying to run the below query to create a table in mysql and I am getting an error. create table newtable ( version_id int(11) auto_increment not null, test_id int(11) default version_id, primary key(version_id) ); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corr...

mysql create procedure syntax issue line 1

Hello All. I get a syntax error on line 1 of the following procedure: DELIMITER | CREATE PROCEDURE sp_autocallFillCallQueue BEGIN DECLARE maxCalls TINYINT(1); SELECT autocall_maxCalls INTO maxCalls FROM `options` LIMIT 0,1; REPEAT INSERT INTO `callQueue` (`phoneNumber`, 'waiting') SELECT `phoneNumber` FR...

SQL Syntax Error

Hi, I am trying to upload a members database with login and create user facilities. Whenever I upload the .sql file to the host i am getting an error at the bottom of the page saying: MySQL said: 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 'ÿþ/' ...

Error in phpmyadmin though runs fine in php script

Ok so this one is strange and I'm thinking there must be a problem in my sql query but I don't see anything wrong with it. What is happening is that I have a script that I am running in a php script that retrieves all categories that a user has signed up for as well as how many other people have signed up for the same category. When I ru...

Trying to use a SQL function in MySQL

I'm trying to use this script (which extracts the domain from a URL): CREATE FUNCTION [dbo].[parseURL] (@strURL varchar(1000)) RETURNS varchar(1000) AS BEGIN IF CHARINDEX('http://',@strURL) > 0 OR CHARINDEX('https://',@strURL) > 0 SELECT @strURL = REPLACE(@strURL,'https://','') SELECT @strURL = REPLACE(@strURL,'http://','') SELECT @str...

Install script MySQL syntax error "You have an error in your SQL syntax; [...] "

I have an install script on my website, and when i run it, it gives me thsi 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 'CREATE TABLE active_guests ( ip varchar(15) collate latin1_general_' at line 2 Here is the code where it seems to b...

Displaying query output from a php file on the browser; Use of undefined constant localhost - assumed 'localhost'

Hello, I am very new to php and trying to work stuff around as they come across. I am trying to display the output of a query on the web page. Following is the code. <?php $username="xxxxxxxxx"; $password="xxxxxxxxx"; $database="xxxxxxxxx"; mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "Unable...

How do I search "many LIKE" in the database (mysql)?

I want to search number of strings in the Database (type: MYSQL) and I did this: SELECT * FROM `rooms` WHERE `dates` LIKE '%09/08/10%' OR '%08/08/10%' Why doesnt it work? when I removed the part of OR '%08/08/10%' it was working well, I think I use it not good. How should I do it? ...

Errors with MySQL stored function creation ERROR 1064 & 1327

I am using MySQL v5.1.36 and I am trying to create a stored function using this code. DELIMITER // CREATE FUNCTION `modx`.getSTID (x VARCHAR(255)) RETURNS INT DETERMINISTIC BEGIN DECLARE y INT; SELECT id INTO y FROM `modx`.coverage_state WHERE `coverage_state`.name = x; RETURN y; END// When entered into the...

MySQL Join question...

Hi, I'm setting up a small system that keeps track of which person is assigned to a request. My table structure looks like this: Table: requests RequestID RequestDetails Table:request_staff RequestID StaffUserID Obviously RequestID is used to link to the two tables. I want to select all requests for a staff member. My underst...

Is there a way to increment the value of a sql column without reading it

Hello, I wanted to know if there is a way I can directly increment the value of a column without reading the current value. something like: update table `user` set cnt = cnt+1 The above statement gave me a syntax error, but I am sure there has to be something for it. Thanks ...

mySql error 1064

This drives me craze, whatever i do in SqlQueryBrowser i have the same 1064 error: CREATE Function surname (uid int(11)) Returns TEXT 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 1 What is the problem ? Thanks ...

Lost connection to MySQL server during query - PHP, MySQL

Hello, I have this php code, the files are hosted on another server and db else where $hostname_xxx = "xxxdb.db.234141.mysqldbhosted.com"; $database_xxx = "xx11xx"; $username_xxx = "xx11xx"; $password_xxx = "xx332211xx"; $shasown = mysql_pconnect($hostname_xxx, $username_xxx, $password_xxx) or trigger_error(mysql_error(),E_USER_ERROR);...

Having a problem with a basic join

I have a table called tblSport which contains the columns pkSportID and fldName. I have a table called tblRespondentSport which contains the columns fkRespondentID and fkSportID. I want to return the sport ID, the name of the sport, and the number of respondents. Here's my query: SELECT s.pkSportID AS id, s.fldSport AS sport, r.COUNT(...

mysql query - contains?

how can i search for a particular string in mysql? I tried using contains- gives me error: SELECT r.name , r.network , r.namestring , i.name , r.rid , i.id , d.dtime , d.ifInOctets , d.description FROM router AS r INNER JOIN interface AS i ON r.rid = i.rid INNER JOIN 1278993600_1_60 AS d ON i.id =...

Using concat in clause MATCH AGAINST - mysql

I really hope that someone can help me with my problem. I would like to realize a match against query with group_concat. I need something like this: Select c.id, p.place from content c join place p on p.object_id = c.id where match(group_concat(p.place)) AGAINST('"string1" "string2" "string3"', IN BOOLEAN MODE) and not ma...