MySQL 4.0.12: query acting differently from myadmin to my php script

MySQL 4.0.12: query acting differently from myadmin to my php script

am 19.05.2003 01:44:33 von Gaby

I am working on a 4.0.12-log MySQL. (on a debian unstable/testing)
I have a like point with a query. This works with the phpmyadmin site
but not with my php script
Inside the "phpmyadmin" admin the qury returns some elements.
But with my script :
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 '(au_nom,
au_prenom) champ_3, editeurs.ed_nom champ_4 FROM livre


Here is the query
SELECT livres.li_livreId champ_0, livres.li_titre champ_1,
livres.li_titreOriginal champ_2, concat (au_nom, au_prenom) champ_3,
editeurs.ed_nom champ_4 FROM livres LEFT JOIN auteurs ON
(auteurs.au_auteurId=livres.li_auteurId) LEFT JOIN editeurs ON
(editeurs.ed_editeurId=livres.li_editeurId)


And now here is the database schema

#
# Structure de la table `auteurs`
#

CREATE TABLE auteurs (
au_auteurId bigint(20) NOT NULL auto_increment,
au_prenom varchar(80) NOT NULL default '',
au_nom varchar(80) NOT NULL default '',
au_paysId bigint(20) NOT NULL default '0',
au_langueId bigint(20) NOT NULL default '0',
PRIMARY KEY (au_auteurId),
KEY aut_prenom (au_prenom)
) TYPE=MyISAM COMMENT='Les auteurs de livres';
# --------------------------------------------------------

#
# Structure de la table `collections`
#

CREATE TABLE collections (
co_collectionId bigint(20) NOT NULL auto_increment,
co_editeurId bigint(20) NOT NULL default '0',
co_libelle varchar(80) NOT NULL default '',
PRIMARY KEY (co_collectionId),
KEY co_editeurId (co_editeurId)
) TYPE=MyISAM COMMENT='Collections chez les éditeurs';
# --------------------------------------------------------

#
# Structure de la table `editeurs`
#

CREATE TABLE editeurs (
ed_editeurId bigint(20) NOT NULL auto_increment,
ed_nom varchar(50) NOT NULL default '',
ed_paysId bigint(20) NOT NULL default '1',
PRIMARY KEY (ed_editeurId)
) TYPE=MyISAM COMMENT='Les editeurs';
# --------------------------------------------------------

#
# Structure de la table `etatlivre`
#

CREATE TABLE etatlivre (
et_etatId bigint(20) NOT NULL auto_increment,
et_etatLibelle varchar(50) NOT NULL default '',
PRIMARY KEY (et_etatId)
) TYPE=MyISAM COMMENT='permet de décrire sommairement un exemplaire';
# --------------------------------------------------------

#
# Structure de la table `exemplairelivre`
#

CREATE TABLE exemplairelivre (
ex_exemplaireId bigint(20) NOT NULL auto_increment,
ex_livreId bigint(20) default '0',
ex_nbExemplaires int(11) default '1',
ex_etatId int(11) default '5',
ex_prix double default '0',
PRIMARY KEY (ex_exemplaireId),
KEY livreId (ex_livreId,ex_etatId,ex_prix)
) TYPE=MyISAM COMMENT='tous les exemplaires concrets des livres';
# --------------------------------------------------------

#
# Structure de la table `groupes`
#

CREATE TABLE groupes (
gr_id int(11) NOT NULL auto_increment,
gr_nom varchar(20) NOT NULL default '',
gr_comment varchar(100) default NULL,
UNIQUE KEY gr_id (gr_id,gr_nom),
KEY gr_id_2 (gr_id)
) TYPE=MyISAM;
# --------------------------------------------------------

#
# Structure de la table `langues`
#

CREATE TABLE langues (
la_langueId bigint(20) NOT NULL auto_increment,
la_libelle varchar(50) NOT NULL default '',
PRIMARY KEY (la_langueId),
KEY lan_libelle (la_libelle)
) TYPE=MyISAM COMMENT='langues ';
# --------------------------------------------------------

#
# Structure de la table `livres`
#

CREATE TABLE livres (
li_livreId bigint(20) NOT NULL auto_increment,
li_auteurId bigint(20) default NULL,
li_titre varchar(120) NOT NULL default '',
li_titreOriginal varchar(120) NOT NULL default '',
li_editeurId bigint(20) default NULL,
li_collectionId bigint(20) default NULL,
li_ISBN varchar(20) default NULL,
li_formatId bigint(20) NOT NULL default '1',
li_nbPages int(11) NOT NULL default '0',
li_poids double NOT NULL default '1',
li_anneeParution int(11) default NULL,
li_anneePremiereParution int(11) NOT NULL default '0',
li_langueId bigint(20) default NULL,
li_langueOrigineId bigint(20) default NULL,
PRIMARY KEY (li_livreId),
KEY auteurId (li_auteurId,li_titre,li_editeurId,li_collectionId),
KEY li_titreOriginal (li_titreOriginal)
) TYPE=MyISAM COMMENT='livres de la base';
# --------------------------------------------------------

#
# Structure de la table `pays`
#

CREATE TABLE pays (
pa_paysId bigint(20) NOT NULL auto_increment,
pa_paysLibelle varchar(80) NOT NULL default '',
PRIMARY KEY (pa_paysId),
KEY paysLibelle (pa_paysLibelle)
) TYPE=MyISAM COMMENT='Les pays';






--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org

Re: MySQL 4.0.12: query acting differently from myadmin to my php script

am 19.05.2003 02:55:27 von Jocelyn Fournier

Hi,

This is not a MySQL bug and this lists is only dedicated to fully repeatable
mysql bugs ;).
To solve your problem, you have to remove the space between 'concat' and
'('.

Regards,
Jocelyn


----- Original Message -----
From: "Gaby"
To:
Sent: Tuesday, May 20, 2003 3:36 AM
Subject: MySQL 4.0.12: query acting differently from myadmin to my php
script


> I am working on a 4.0.12-log MySQL. (on a debian unstable/testing)
> I have a like point with a query. This works with the phpmyadmin site
> but not with my php script
> Inside the "phpmyadmin" admin the qury returns some elements.
> But with my script :
> 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 '(au_nom,
> au_prenom) champ_3, editeurs.ed_nom champ_4 FROM livre
>
>
> Here is the query
> SELECT livres.li_livreId champ_0, livres.li_titre champ_1,
> livres.li_titreOriginal champ_2, concat (au_nom, au_prenom) champ_3,
> editeurs.ed_nom champ_4 FROM livres LEFT JOIN auteurs ON
> (auteurs.au_auteurId=livres.li_auteurId) LEFT JOIN editeurs ON
> (editeurs.ed_editeurId=livres.li_editeurId)
>
>
> And now here is the database schema
>
> #
> # Structure de la table `auteurs`
> #
>
> CREATE TABLE auteurs (
> au_auteurId bigint(20) NOT NULL auto_increment,
> au_prenom varchar(80) NOT NULL default '',
> au_nom varchar(80) NOT NULL default '',
> au_paysId bigint(20) NOT NULL default '0',
> au_langueId bigint(20) NOT NULL default '0',
> PRIMARY KEY (au_auteurId),
> KEY aut_prenom (au_prenom)
> ) TYPE=MyISAM COMMENT='Les auteurs de livres';
> # --------------------------------------------------------
>
> #
> # Structure de la table `collections`
> #
>
> CREATE TABLE collections (
> co_collectionId bigint(20) NOT NULL auto_increment,
> co_editeurId bigint(20) NOT NULL default '0',
> co_libelle varchar(80) NOT NULL default '',
> PRIMARY KEY (co_collectionId),
> KEY co_editeurId (co_editeurId)
> ) TYPE=MyISAM COMMENT='Collections chez les éditeurs';
> # --------------------------------------------------------
>
> #
> # Structure de la table `editeurs`
> #
>
> CREATE TABLE editeurs (
> ed_editeurId bigint(20) NOT NULL auto_increment,
> ed_nom varchar(50) NOT NULL default '',
> ed_paysId bigint(20) NOT NULL default '1',
> PRIMARY KEY (ed_editeurId)
> ) TYPE=MyISAM COMMENT='Les editeurs';
> # --------------------------------------------------------
>
> #
> # Structure de la table `etatlivre`
> #
>
> CREATE TABLE etatlivre (
> et_etatId bigint(20) NOT NULL auto_increment,
> et_etatLibelle varchar(50) NOT NULL default '',
> PRIMARY KEY (et_etatId)
> ) TYPE=MyISAM COMMENT='permet de décrire sommairement un exemplaire';
> # --------------------------------------------------------
>
> #
> # Structure de la table `exemplairelivre`
> #
>
> CREATE TABLE exemplairelivre (
> ex_exemplaireId bigint(20) NOT NULL auto_increment,
> ex_livreId bigint(20) default '0',
> ex_nbExemplaires int(11) default '1',
> ex_etatId int(11) default '5',
> ex_prix double default '0',
> PRIMARY KEY (ex_exemplaireId),
> KEY livreId (ex_livreId,ex_etatId,ex_prix)
> ) TYPE=MyISAM COMMENT='tous les exemplaires concrets des livres';
> # --------------------------------------------------------
>
> #
> # Structure de la table `groupes`
> #
>
> CREATE TABLE groupes (
> gr_id int(11) NOT NULL auto_increment,
> gr_nom varchar(20) NOT NULL default '',
> gr_comment varchar(100) default NULL,
> UNIQUE KEY gr_id (gr_id,gr_nom),
> KEY gr_id_2 (gr_id)
> ) TYPE=MyISAM;
> # --------------------------------------------------------
>
> #
> # Structure de la table `langues`
> #
>
> CREATE TABLE langues (
> la_langueId bigint(20) NOT NULL auto_increment,
> la_libelle varchar(50) NOT NULL default '',
> PRIMARY KEY (la_langueId),
> KEY lan_libelle (la_libelle)
> ) TYPE=MyISAM COMMENT='langues ';
> # --------------------------------------------------------
>
> #
> # Structure de la table `livres`
> #
>
> CREATE TABLE livres (
> li_livreId bigint(20) NOT NULL auto_increment,
> li_auteurId bigint(20) default NULL,
> li_titre varchar(120) NOT NULL default '',
> li_titreOriginal varchar(120) NOT NULL default '',
> li_editeurId bigint(20) default NULL,
> li_collectionId bigint(20) default NULL,
> li_ISBN varchar(20) default NULL,
> li_formatId bigint(20) NOT NULL default '1',
> li_nbPages int(11) NOT NULL default '0',
> li_poids double NOT NULL default '1',
> li_anneeParution int(11) default NULL,
> li_anneePremiereParution int(11) NOT NULL default '0',
> li_langueId bigint(20) default NULL,
> li_langueOrigineId bigint(20) default NULL,
> PRIMARY KEY (li_livreId),
> KEY auteurId (li_auteurId,li_titre,li_editeurId,li_collectionId),
> KEY li_titreOriginal (li_titreOriginal)
> ) TYPE=MyISAM COMMENT='livres de la base';
> # --------------------------------------------------------
>
> #
> # Structure de la table `pays`
> #
>
> CREATE TABLE pays (
> pa_paysId bigint(20) NOT NULL auto_increment,
> pa_paysLibelle varchar(80) NOT NULL default '',
> PRIMARY KEY (pa_paysId),
> KEY paysLibelle (pa_paysLibelle)
> ) TYPE=MyISAM COMMENT='Les pays';
>
>
>
>
>
>
> --
> MySQL Bugs Mailing List
> For list archives: http://lists.mysql.com/bugs
> To unsubscribe: http://lists.mysql.com/bugs?unsub=joc@presence-pc.com
>
>


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org