Unexplained MySQL Error..
| From: | Mike Gifford | Date: | Fri, 20 Jul 2001 20:36:54 +0000 |
| Subject: | Unexplained MySQL Error.. | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-10610@lists.php.net to get a copy of this message | ||
Hello,
I'm hoping that this error is clear to someone who is familiar with MySQL errors (cause it sure doesn't make sense to me):
Database error:
Invalid SQL:
UPDATE
WLPbib, WLPpublisher,WLPprofile,WLPbib2profile
SET
WLPprofile.firstName = 'asdf',
WLPprofile.middleName = '',
WLPprofile.lastName = 'asdfasdf',
WLPbib.title = 'asdf',
WLPbib.publisherID = '',
WLPpublisher.publisherID = ''
WHERE
bibID = '32' AND
WLPbib2profile.bibID = WLPbib.bibID AND
WLPbib2profile.profileID = WLPbib.profileID AND
WLPbib.publisherID = WLPbib.publisherID
MySQL Error: 1064 (You have an error in your SQL syntax near ' WLPpublisher,WLPprofile,WLPbib2profile
SET
WLPprofile.firstName = ' at line 3)
Please contact the webmaster and report the exact error message.
Session halted.
Which in the code looks like:
$q = "UPDATE WLPbib, WLPpublisher,WLPprofile,WLPbib2profile SET WLPprofile.firstName = '$ary[firstName]', WLPprofile.middleName = '$ary[middleName]', WLPprofile.lastName = '$ary[lastName]', WLPbib.title = '$ary[title]', WLPbib.publisherID = '$ary[publisherID]', WLPpublisher.publisherID = '$ary[publisherID]' WHERE bibID = '$ary[bibID]' AND WLPbib2profile.bibID = WLPbib.bibID AND WLPbib2profile.profileID = WLPbib.profileID AND WLPbib.publisherID = WLPbib.publisherID"; And in the DB looks like: CREATE TABLE WLPbib ( bibID mediumint(9) NOT NULL, languageID varchar(5), publisherID mediumint(9), categoryID smallint(6), type varchar(55), title varchar(255), pageNumber varchar(55), source_bibID varchar(55), publicationDate varchar(5), dateAdded date, publishedLanguage varchar(5), URL varchar(100), status varchar(5), PRIMARY KEY (bibID) ); CREATE TABLE WLPpublisher ( publisherID mediumint(9) NOT NULL, languageID varchar(5), addressID mediumint(9), name varchar(255), alias4publisherID mediumint(9), PRIMARY KEY (publisherID) ); CREATE TABLE WLPprofile ( profileID mediumint(9) NOT NULL, languageID varchar(5), addressID mediumint(9), firstName varchar(255), middleName varchar(255), lastName varchar(255), organization varchar(255), nationality varchar(255), professionID smallint(3), bio text, status varchar(5), PRIMARY KEY (profileID) ); CREATE TABLE WLPbib2profile ( bibID mediumint(9), profileID mediumint(9) ); What the heck am I missing? Any help would be appreciated. Mike ps. I fixed the duplication error I was getting previously (and brought to the list at that point) with the following:
$q = " SELECT
WLPbib.bibID,
WLPbib.title,
WLPbib.publicationDate,
WLPpublisher.name,
WLPaddress.city,
WLPaddress.state,
WLPcountry.name,
WLPprofile.firstName,
WLPprofile.middleName,
WLPprofile.lastName,
WLPprofile.organization
";
$q .= " FROM
WLPbib
LEFT JOIN WLPpublisher USING(publisherID),
WLPaddress
LEFT JOIN WLPcountry USING(countryID),
WLPprofile
LEFT JOIN WLPbib2profile USING(profileID)
";
$q .= " WHERE
WLPpublisher.addressID = WLPaddress.addressID AND
WLPbib2profile.bibID = WLPbib.bibID
";
Seems to be working so far.
--
Mike Gifford, OpenConcept Consulting, http://openconcept.ca
Offering everything your organization needs for an effective web site.
Abolish Nuclear Weapons Now!: http://pgs.ca/petition/
It is a miracle that curiosity survives formal education. - A Einstein