Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EM_Booking#get() - wrong table usage #1

Open
XedinUnknown opened this issue Apr 17, 2019 · 0 comments
Open

EM_Booking#get() - wrong table usage #1

XedinUnknown opened this issue Apr 17, 2019 · 0 comments

Comments

@XedinUnknown
Copy link

XedinUnknown commented Apr 17, 2019

The Problem

When using EM_Booking#get(), an SQL error is thrown.

Possible Cause

get() tries to retrieve the table name from $wpdb:

$sql = "SELECT * FROM ". $wpdb->EM_BOOKINGS_TABLE ." WHERE " . implode(' AND ', $conds);

That results in a query like the following:

SELECT * FROM  WHERE 1

That's because there's no such thing as $wpdb->EM_BOOKINGS_TABLE.

Suggested Solution

Use constants, the same way as everywhere else in the plugin:

$sql = "SELECT * FROM ". EM_BOOKINGS_TABLE ." WHERE " . implode(' AND ', $conds);

Remarks

I am aware that this repo has not been updated in a long time. However, the problem still presents on 5.9.x: see trac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant