mysql error 1064 can some help solve?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
jlinderman
Forum Newbie
Posts: 5
Joined: Tue Sep 02, 2003 9:01 am

mysql error 1064 can some help solve?

Post by jlinderman »

Can some one help solve this one

MySQL error 1064
You have an error in your SQL syntax near 'Resident AS qf5,PMEtable0.PO Address AS qf6,PMEtable0.Allot No AS qf7,PMEtable0.' at line 1
phpMyEdit error: invalid SQL query jkl1
SELECT PMEtable0.ID AS qf0,PMEtable0.fname1 AS qf1,PMEtable0.relation1 AS qf2,PMEtable0.lname1 AS qf3,PMEtable0.fname2 AS qf4,PMEtable0.Distrect of Resident AS qf5,PMEtable0.PO Address AS qf6,PMEtable0.Allot No AS qf7,PMEtable0.Id no AS qf8,PMEtable0.Acct No AS qf9,PMEtable0.Date of Death AS qf10,PMEtable0.Probate no AS qf11,PMEtable0.sex AS qf12,PMEtable0.Birth date AS qf13,PMEtable0.Tribe AS qf14,PMEtable0.Degree of Blood AS qf15,PMEtable0.Marital Status AS qf16,PMEtable0.Father AS qf17,PMEtable0.father AL or ID No AS qf18,PMEtable0.spouse1 AS qf19,PMEtable0.spouse1 AL or ID No AS qf20,PMEtable0.spouse2 AS qf21,PMEtable0.spouse2 AL or ID No AS qf22,PMEtable0.Mother AS qf23,PMEtable0.Mother AL or ID No AS qf24,PMEtable0.Remarks AS qf25,PMEtable0.date entered AS qf26,PMEtable0.FirstName AS qf27,PMEtable0.lname2 AS qf28,PMEtable0.relation2 AS qf29,PMEtable0.fname3 AS qf30,PMEtable0.lname3 AS qf31,PMEtable0.relation3 AS qf32 FROM card AS PMEtable0 ORDER BY PMEtable0.ID,PMEtable0.fname1 LIMIT 0,1560.256 miliseconds

/*
* Main list_table() query
*
* Each row of the HTML table is one record from the SQL query. We must
* perform this query before filter printing, because we want to use
* mysql_field_len() function. We will also fetch the first row to get
* the field names.
*/
$query = $this->query_make($qparts);
$res = $this->myquery($query, __LINE__);
if ($res == false) {
$this->error('invalid SQL query jkl1', $query);
return false;
}
$row = @mysql_fetch_array($res, MYSQL_ASSOC);

/* FILTER {{{
*
* Draw the filter and fill it with any data typed in last pass and stored
* in the array parameter keyword 'filter'. Prepare the SQL WHERE clause.
*/
if ($this->fl) {
// Filter row retrieval
$fields = false;
$filter_row = $row;
if (! is_array($filter_row)) {
unset($qparts['where']);
$query = $this->query_make($qparts);
$res = $this->myquery($query, __LINE__);
if ($res == false) {
$this->error('invalid SQL query jkl2', $query);
return false;
}
$filter_row = @mysql_fetch_array($res, MYSQL_ASSOC);
}

also I did notice the __LINE__ entry in several commands but cant find any documentation on the way to solve.

From A poor one man IT department with 150 stations

:->

_________________
Milamber; The Ancient Huge Red Dragon;

I Like My meat well done!! :wink:
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Well, on the first look, this looks wierd...

Code: Select all

PMEtable0.PO Address AS qf6,PMEtable0.Allot No AS qf7
-- shouldn't that be:
PMEtable0.PO.Address AS qf6,PMEtable0.Allot.No AS qf7
Edited to clarify my point.
The usage should be: <field> as <your name>
You have: <field> <another field> as <your name>

That extra space breaks it I think.
dekemp
Forum Newbie
Posts: 3
Joined: Fri Sep 05, 2003 5:41 am
Location: The Netherlands

Post by dekemp »

SELECT PMEtable0.ID AS qf0
,PMEtable0.fname1 AS qf1
,PMEtable0.relation1 AS qf2
,PMEtable0.lname1 AS qf3
,PMEtable0.fname2 AS qf4
,PMEtable0.Distrect of Resident AS qf5 // illegal! spaces in column name and possible typo Distrect/District?
,PMEtable0.PO Address AS qf6 // illegal! spaces in column name
,PMEtable0.Allot No AS qf7 // illegal! spaces in column name
,PMEtable0.Id no AS qf8
,PMEtable0.Acct No AS qf9 // illegal! spaces in column name
,PMEtable0.Date of Death AS qf10 // illegal! spaces in column name
,PMEtable0.Probate no AS qf11 // illegal! spaces in column name
,PMEtable0.sex AS qf12 // No thank you!
,PMEtable0.Birth date AS qf13 // illegal! spaces in column name
,PMEtable0.Tribe AS qf14
,PMEtable0.Degree of Blood AS qf15 // illegal! spaces in column name
,PMEtable0.Marital Status AS qf16 // illegal! spaces in column name
,PMEtable0.Father AS qf17
,PMEtable0.father AL or ID No AS qf18 // illegal! spaces in column name
,PMEtable0.spouse1 AS qf19
,PMEtable0.spouse1 AL or ID No AS qf20 // illegal! spaces in column name
,PMEtable0.spouse2 AS qf21
,PMEtable0.spouse2 AL or ID No AS qf22 // illegal! spaces in column name
,PMEtable0.Mother AS qf23
,PMEtable0.Mother AL or ID No AS qf24 // illegal! spaces in column name
,PMEtable0.Remarks AS qf25
,PMEtable0.date entered AS qf26 // illegal! spaces in column name
,PMEtable0.FirstName AS qf27
,PMEtable0.lname2 AS qf28
,PMEtable0.relation2 AS qf29
,PMEtable0.fname3 AS qf30
,PMEtable0.lname3 AS qf31
,PMEtable0.relation3 AS qf32
FROM card AS PMEtable0
ORDER BY PMEtable0.ID
,PMEtable0.fname1
LIMIT 0,1560.256 miliseconds

General remarks:
When the Table is named card why adress it as PMEtable0
It would help readability if you would do From card as PME0

Good luck
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

dekemp, you should use

Code: Select all

alt.

Code: Select all

tags
Post Reply