I'm building a web application using PhalconPHP 1.3.4 and I'm trying to select data from multiple tables at the same time since some values are stored in another table through a relationship.

My query works fine in MySQL workbench, but when I try to execute the query using PhalconPHP, I get the following error:

Scanning error before 'Bookings, Trips]...' when parsing: SELECT count(bkId) AS bookings FROM [Bookings, Trips] WHERE ((bkUserId = :userId:) AND (CURDATE() > tripFromDate)) AND (CURDATE( ) < DATE_ADD(tripFromDate, INTERVAL 2 WEEK)) (172)

my php code:

$query = new Builder();$query->columns("count(bkId) AS bookings");$query->from('Bookings, Trips');$query->where("bkUserId = :userId:");$query->andWhere("CURDATE() > tripFromDate");$query->andWhere("CURDATE() < DATE_ADD(tripFromDate, INTERVAL 2 WEEK)");$result = $query->getQuery()- >execute(["userId"=> $userId])->bookings;return ($result > 0);

I've read that this might be a bug, but it should be fixed in version 1.3.2, am I doing something wrong at the moment?

I would like to thank you in advance for your help here.

Solution:

I don't think two columns in from is the correct syntax. In the documentation there is the following example:

$builder->from('Robots') ->addFrom('Parts', 'p');

So your example should look like this

$query = new Builder(); $query->columns("count(b.bkId) AS bookings"); $query->from('Bookings', 'b'); $query->addFrom('Trips' ); $query->where("b.bkUserId = :userId:"); $query->andWhere("CURDATE() > b.tripFromDate"); $query->andWhere("CURDATE() < DATE_ADD(b .tripFromDate, INTERVAL 2 WEEK)");

Either do that, or better convert to using joins.

PhalconPHP - When parsing error.. previous scan error Related posts

  1. php-When the title exists, parse JSON from the GET response

    I am trying to json_decode the response received from my server-side API's GET request, but I get an empty string. Am I correct to assume because the response contains all the header information that the JSON decoder cannot handle? This is the complete response I got from the server:HTTP/1.1 200 OK Server: nginx/1.0.5 Date: Sun, 18 Mar 2012 19:44:43 GMT Content-Type: application/json Connection: keep-alive Vary: Accept-Encoding X-Powered-By: Servlet/3.0; JBossAS-6 Content-Length: 97 {"pid":"1620 ...

  2. c#-The form freezes when you hold down the mouse on the title bar

    In a Windows Forms application, when I put the mouse pointer on the title bar of the form, press and hold the button to the left and hold it (but don't move the pointer), the event loop freezes for a short period of time.In addition, holding the left button on the close button on the title bar freez ...

  3. php - how to set the title name of pdf. When viewing the document (new tab)

    How can we change the title name of the pdf. While viewing the DocumentI didnt use any controller are modal, I just pass the url in href tag, But I want to change the title nameSolution:Using Jquery I got the exact solution for this problem. Please have a lookHow to set title for pdf file opening in ...

  4. java-When using Flying Saucer to generate PDF, the title and body overlap

    I'm using Flying Saucer R8 to generate a PDF file. The PDF needs a title that will be repeated on every page. The title will be specified by the user, so I can't determine its height. I managed to repeat the title on every page, but the question is if The title has multiple lines of text, it will no ...

  5. phalconphp multi-module MVC structure

    Hi, I'm trying to implement multi-module MVC for front-end and back-end, like in the phalconphp documentations. But I can't make it work. About an hour but I really can't understand where the problem is.Can anyone guide me how to make a skeleton for multi-module mvc on the front and back end.Should ...

  6. Android: When the application is running in the background, the icon on the title is wrong

    99% of the device application icons on the title taskbar display no problem: imageBut on Sony Xperia Z3, Lollipop, it appears as a white square: imageFrom the application part of my manifest document:So, if you know the answer, please help, why does it only happen on xperia devices?Solution:The loll ...

  7. There is an error when using extern "C" to include the title in the c program

    I am working on a school project that needs to use sheepdog. Mogdog provides a c api that allows you to connect to the shepherd dog server. First, I use the following to create a c source file (test.c):#include "sheepdog/sheepdog.h" #include int main() { struct sd_cluster *c = sd_connect("192.168.1.104:7000"); if (!c) { fprintf(stderr, "failed to connect %m\n"); return -1; }else{ fprintf(stderr, "connected successfully %m\n"); } return 0; }Then I used the following command to compile without er ...

  8. javascript - how to hide title "City" when that div is clicked in php page?

    I am trying to hide the title"city"when someone clicks on the div. For the former if you click on the victoria div, the title"city"is hidden only for that div, the other divs are not affected. If you click on the Toronto div, it is hidden The title is"City", and the title of the Victoria div is disp ...

  9. views - What is the difference between *.volt and *.phtml files in PhalconPHP?

    In Phalcon's example project, in the views directory we have some files with suffix and phtml suffix. What is the difference between these two suffixes? When we must use Volt and when must we use phtml? Please explain for me...Solution:Use the .volt extension when the template engine set in the appl ...

  10. JavaFX TitledPane changed title background reset when mouse is entered

    I need to change the TitledPane title background at runtime based on some incoming value, otherwise reset it.All my TitledPanes are styled on CSS attached to the scene.There is no problem with changing the background. The problem is that after the background is changed, when the mouse goes above the ...

  11. c#-Xamarin.Forms MasterDetailPage with TabbedView-Tab title appears when navigating through the hamburger menu

    I use Xamarin.Forms when developing Android and iOS apps. I have a MasterDetailPage with TabbedPage (home page) as detailed information, it has 5 tabs, and on the main page (hamburger menu) I have two options, namely Home page or account.On iOS, the tabs behave as expected, and the hamburger menu sl ...

  12. javascript-The title of the data table is not full-width when the page loads

    When using the data table to load my web application page, the data table is loaded but the &lt;thead&gt; row is not the full width of the table.After editing the data or searching in the data table search, the title jumps to full width. See picture.Is there any solution or workaround?Screenshot of ...

  13. javascript - Can't change title when JQuery tooltip is enabled

    Here is the scene:I use the JQuery button widget to create a button, and add a title to it &gt; I call the JQuery tooltip widgetWhen I change the title the actual way, the tooltip updates correctly, but when I change the title while hovering the button, the title attribute doesn't change (I checked ...

  14. PhalconPHP - When parsing error.. previous scan error

    I'm building a web application using PhalconPHP 1.3.4 and I'm trying to select data from multiple tables at the same time since some values are stored in another table through a relationship.My query works fine in MySQL workbench, but when I try to execute the query using PhalconPHP, I get the follo ...

  15. java-convert object to array-IllegalArgumentException-parameter is not an array

    I have a problem with conversion and conversion,The message list belongs to the object class, and each element of the list is a different type of array, so I need a way to help me convert each element in the object component into an array.This is my code part.String query ="SELECT m.MSG_CODE, m.MSG_ ...

  16. python xlsxwriter: When adding tables, keep the title in excel

    I have a panda data frame, I write to an xslx file, and want to add a table to that data. I also want to keep the titles I have written instead of adding them again. Is that possible?example:import pandas as pdimport xlsxwriter as xw# random dataframed = {'one': pd.Series([1., 2., 3.], index=['a','b ...

Recent Posts

  1. java-Use curl to post request Https: Android

    I'm trying to execute an https post request using curl. When I execute this request, I neither get any response nor any errors or exceptions. Help or any clues as to what's going wrong here is appreciated. Thank you.Curl command line format:curl -X POST \-F '[email protected];type=image/png' \-F '...

  2. Python3 tkinter basic Text image Insert a picture into the text box

    &emsp;&emsp;&emsp;&emsp;Python: 3.7.0&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;OS: Ubuntu 18.04.1 LTS&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;IDE: PyCharm 2018.2.4&emsp;&emsp;&emsp;&emsp;&emsp;Conda: 4.5.11&emsp;&emsp;&emsp;typesetting: Markdowncode"""@Author: [email protected]: [email protected]: www.cnblogs.com/xin...

  3. java-Use libraries under GPL in my program. How should I refer to them?

    I want to distribute a java application that uses another library under the GPL. I also want to distribute mine under the GPL. Now the final runnable .jar file contains another library. But how should I cite it? Like it was mentioned somewhere?Solution:If the application contains any GPL code, all c...

  4. How to use pandas library in python to read excel table and delete columns with empty values

    After using pandas to read the relevant excel, if there are columns with empty values in the table, how to clean it? After consulting the relevant information on the Internet, I got a solutionpandas.dropna(axis=1,how='any')axis=0 refers to the row, if it is not written in the parameter, the default ...

  5. Use Python 3 to implement selective sorting and bubble sorting code detailed explanation

    Original link: https://www.jianshu.com/u/8f2987e2f9fbToday we use Python 3 version to implement selective sorting and bubble sorting.Selection sort is a simple and intuitive sorting algorithm. It works as follows. First find the smallest (large) element in the unsorted sequence, store it at the begi...

  6. 9. Basic types of Python3 (flow control [control loop])

    Control loop1 Commonly used tool functions1.1 zip() function1.2 reversed() function1.3 sorted() function2 Control loop structure2.1 break2.2 continue2.3 return1 Commonly used tool functions1.1 zip() functionUse the zip() function to"compress"the two lists into a zip object (iterable object), so that...

  7. java-Maven: surefire plug-in ignores when configured -Dgroups

    My project has some JUnit tests that I rarely want to run. For this I put them in @Category, and I did this:maven-surefire-plugin!be.test.InjectTestsI want to override the configuration in the command line to run the Inject test as follows:mvn clean install -Dgroups=be.test.InjectTestsBut this didn'...

  8. java-custom provider cannot inject filters

    I have a POJO and I want to inject resources and filters:public final class MyObject {}I implemented a custom provider for it:@Providerpublic final class MyProviderextends AbstractHttpContextInjectableimplements InjectableProvider {@Context private HttpServletRequest request; @Override public Inject...

  9. Use compilation to make my program faster

    I have made a sieve for generating prime numbers. I am doing a school project about RSA, which includes some programming. I use prime numbers for the RSA system, but since it is my thesis, security is not very important. However, Large prime numbers are more challenging, and I like this. The code I ...

  10. The terrible wild pointer in C program

    1. Point of Question Pointer is a very powerful function of the C language, and it is also a feature that makes people easy to make mistakes. If you use the wrong pointer, you will only report an error if you use the wrong pointer, or the whole system may crash in the worst case. The following is a ...