• Home
  • Systems
  • Networking
  • WordPress
  • Web
  • Geekery

Analysis and Review

HOW TO RESOLVE MYSQL 1064 ERRORS

March 30, 2016 by Kurt Turner

NOTE BOTH OF THESE SEGMENTS OF CODE GIVE MYSQL 1064 ERRORS BUT NO HELPFUL DOCUMENTATION FOUND ON HOW TO RESOLVE OR EVEN WHAT THE SPECIFIC ERROR IS.6.14.13

CREATE VIEW wp_search_publications as

SELECT wp_pods_publications.name, wp_pods_publications.publisher, wp_pods_publications.pub_author, wp_pods_publications.publication_date, wp_pods_publications.pub_id,

wp_pods_publications.volume_number, wp_pods_publications.edition, wp_pods_publications.subjects, wp_pods_publications.location, wp_pods_publication_type.media_type

FROM

wp_pods_publications, wp_pods_publication_type, wp_podsrel

WHERE

wp_pods_publications.id = wp.pods.publication_type.id and wp_podsrel.item_id = wp_pods_publications.publications.id;

CREATE VIEW wp_search_publications

[(title, publisher, author, publication_date, pub_id, volume_number, edition, subjects, location, media_type)]

as

SELECT wp_pods_publications.name, wp_pods_publications.publisher, wp_pods_publications.pub_author, wp_pods_publications.publication_date, wp_pods_publications.pub_id,

wp_pods_publications.volume_number, wp_pods_publications.edition, wp_pods_publications.subjects, wp_pods_publications.location, wp_pods_publication_type.media_type

FROM

wp_pods_publications, wp_pods_publication_type, wp_podsrel

WHERE wp_pods_publications.id = wp.pods.publication_type.id, and wp_podsrel.item_id = wp_pods_publications.publications.id

——————————————————————-

WHEN THE ‘WHERE’ CLAUSE IS REMOVED THE CODE WILL RUN BUT NO RECORDS ARE RETURNED…STRANGE….

So I need to create a join on the tables before I can create a VIEW to run the search for the users? Or actually relate the tables in MySQL instead of relying on the WordPress application relationships?


CREATE VIEW wp_search_publications

as

SELECT wp_pods_publications.name, wp_pods_publications.publisher, wp_pods_publications.pub_author, wp_pods_publications.publication_date, wp_pods_publications.pub_id,

wp_pods_publications.volume_number, wp_pods_publications.edition, wp_pods_publications.subjects, wp_pods_publications.location

FROM

wp_pods_publications

Any query you have executed can be stored as a bookmark on the page where the results are displayed. You will find a button labeled ‘Bookmark this query’ just at the end of the page.
As soon as you have stored a bookmark, it is related to the database you run the query on. You can now access a bookmark dropdown on each page, the query box appears on for that database.

Since phpMyAdmin 2.5.0 you are also able to store variables for the bookmarks. Just use the string /*[VARIABLE]*/ anywhere in your query. Everything which is put into the value input box on the query box page will replace the string “/*[VARIABLE]*/” in your stored query. Just be aware of that you HAVE to create a valid query, otherwise your query won’t be even able to be stored in the database.
Also remember, that everything else inside the /*[VARIABLE]*/ string for your query will remain the way it is, but will be stripped of the /**/ chars. So you can use:

/*, [VARIABLE] AS myname */

which will be expanded to

, VARIABLE as myname

in your query, where VARIABLE is the string you entered in the input box. If an empty string is provided, no replacements are made.

A more complex example. Say you have stored this query:

SELECT Name, Address FROM addresses WHERE 1 /* AND Name LIKE '%[VARIABLE]%' */

Say, you now enter “phpMyAdmin” as the variable for the stored query, the full query will be:

SELECT Name, Address FROM addresses WHERE 1 AND Name LIKE '%phpMyAdmin%'

You can use multiple occurrences of /*[VARIABLE]*/ in a single query (that is, multiple occurrences of the same variable).
NOTE THE ABSENCE OF SPACES inside the “/**/” construct. Any spaces inserted there will be later also inserted as spaces in your query and may lead to unexpected results especially when using the variable expansion inside of a “LIKE ”” expression.
Your initial query which is going to be stored as a bookmark has to yield at least one result row so you can store the bookmark. You may have that to work around using well positioned “/**/” comments.

 

 

SELECT `wp_pods_publications`.`name`, `wp_pods_publications`.`publisher`, `wp_pods_publications`.`pub_author`, `wp_pods_publications`.`publication_date`, `wp_pods_publications`.`pub_id`, `wp_pods_publications`.`volume_number`, `wp_pods_publications`.`edition`, `wp_pods_publications`.`subjects`, `wp_pods_publications`.`location`

FROM `wp_pods_publications`

WHERE (`wp_pods_publications`.`name` LIKE '%[VARIABLE]%')

ORDER BY `wp_pods_publications`.`name` ASC

THIS STILL DOES NOT PROMPT USER TO ENTER CRITERIA WHEN QUERY IS RUN

 

SELECT `wp_pods_publications`.`name`

FROM `wp_pods_publications`

WHERE (`wp_pods_publications`.`name` LIKE "?%")

 

RETURNS EMPTY QUERY RESULT

DOES NOT PROMPT USER TO ENTER SEARCH CRITERIA

 

 

SELECT `wp_pods_publications`.`name`

FROM `wp_pods_publications`

WHERE (`wp_pods_publications`.`name` like '%[variable]%')

 

RETURNS EMPTY QUERY RESULT

DOES NOT PROMPT USER TO ENTER SEARCH CRITERIA

 

SELECT `wp_pods_publications`.`name`

FROM `wp_pods_publications`

WHERE (`wp_pods_publications`.`name` like '&wp_pods_publications.name')

 

RETURNS EMPTY QUERY RESULT

DOES NOT PROMPT USER TO ENTER SEARCH CRITERIA

 

SELECT `wp_pods_publications`.`name`

FROM `wp_pods_publications`

WHERE (`wp_pods_publications`.`name` LIKE ":Enter_name")

ZERO ROWS RETURNED DOES NOT PROMPT USER TO ENTER NAME

 

 

SELECT `wp_pods_publications`.`name`

FROM `wp_pods_publications`

WHERE (`wp_pods_publications`.`name` LIKE "?%")

NO ROWS RETURNED; DID NOT PROMPT USER TO ENTER CRITERIA

 

SELECT `wp_pods_publications`.`name`, `wp_pods_publications`.`subjects`, `wp_pods_publications`.`location`

FROM `wp_pods_publications`

WHERE (`wp_pods_publications`.`subjects` like 'train')

NO ROWS RETURNED; DID NOT PROMPT USER TO ENTER CRITERIA

Filed Under: Web

Latest and Greatest

Apache vs Nginx for WordPress

Certbot Lets Encrypt And WordPress MU Multi-Site

How To Find and Replace Multiple File in MS Word

How To Get Stretch Res on Windows 10 AMD Radeon For Game Play

This is the ASUS Chromebox we've been running for 2 years as our "brain" for our home grown digital display kiosk.

DIY Digital Signage Bulletin Board or Kiosk

© Copyright Analysis And Review · All Rights Reserved ·