Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6916751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:38:35+00:00 2026-05-27T09:38:35+00:00

I have a long query $s = $dbh->prepare(SELECT name,type, (select count(opinionid) from fe_opinion where

  • 0

I have a long query

 $s = $dbh->prepare("SELECT name,type,
            (select count(opinionid) from fe_opinion where actor=name) as countopinion,
            (select count(commentid) from fe_comment where actor=name) as countcomment,
            (select count(commentid) from fe_reply where actor=name and replyto<>null) as countreply, 
            (select count(voteid) from fe_vote where actor=name and replyto<>null) as countvote,
            (select count(voteid) from fe_vote where actor=name and replyto<>null and vote=1) as countagree,
            (select count(voteid) from fe_vote where actor=name and replyto<>null and vote=0) as countdisagree
            from fs_actor where name=:name");

and It gives me a syntax error when I write it like this in multi line. I am unsure about the compiler because i didnt execute it. Is it supposed to work in this format or should I use heredoc?

How can I continue writing a string from next line? Should ı do it by continuing to next lineby pressing enter? Should I use heredoc or Is there a special new line character?

I’ve found this example in phpdoc

echo 'You can also have embedded newlines in 
strings this way as it is
okay to do';

so now I think my syntax error is something else.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:38:36+00:00Added an answer on May 27, 2026 at 9:38 am

    Just a shot in the dark here, are you sure it’s not that last comma after countdisagree that’s giving you a syntax error? You don’t put a comma after the last part of the SELECT, and you might not have realized you put it there, I know I’ve done that quite a bit myself when breaking up a long SQL query, and it will give a syntax error if it’s there because it’s expecting another statement to select from.

    SQL queries, multiline or otherwise, should only give a syntax error if there actually is one, so if you get a syntax error, you can bet that you have one. You could break that up so you only have one word on each line and it won’t give a syntax error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following (little bit long) query : SELECT * FROM client C
Say I have a query like this: SELECT * FROM my_table WHERE name =
I have a pretty long sqlite query: const char *sql_query = SELECT statuses.word_id FROM
I have the following query which works: SELECT ?page ?lat ?long (bif:st_distance(?geo, bif:st_point(42.883, -72.8981)))
I have very long select query which i need to filter based on some
I have two long type columns that I want to concat during sql query.
I have a MySQL query select query from HR_Health_Logs where query REGEXP 'CPU|MAC|PC|abacus|calculator|laptop|mainframe|microcomputer|minicomputer|machine'; Except
I have a simple query select t.firstname, t.lastname, t.zipcode, t.city from name_data t where
I have this long sql query here.. SELECT c.clientid, c.clientname, c.billingdate, case when (select
Here is the query I have SELECT FB_TEXT FROM `FB_DATA` WHERE `FB_MODELID` = '.$sku_modelid.'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.