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 7817453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:13:45+00:00 2026-06-02T06:13:45+00:00

basically what I am trying to do is run a sql statement that inserts

  • 0

basically what I am trying to do is run a sql statement that inserts select parts of the query results into a table that was recently created. I tested it with mysql and ran this line

INSERT INTO searched(imagetargetpath, gamename, gamedirectory, `like`, dislike) 
SELECT imagetargetpath, gamename, gamedirectory, `like`, dislike
FROM boardgamelist
WHERE gamename LIKE '%david%'

that successfully ran
but when I put the same line into the php from what I was given from phpmyadmin the mysql_query doesn’t seem to run

$sql = "INSERT INTO searched(imagetargetpath, gamename, gamedirectory,
`like`,   dislike) \n"
. "SELECT imagetargetpath, gamename, gamedirectory, `like`, dislike\n"
. "FROM boardgamelist\n"
. "WHERE gamename LIKE \'%david%\'";
    //copies query
    $copy_query = mysql_query($sql);

previously in my code however i do have a mysql command (confirmed to work) that creates the table “searched”
what am I forgetting to do with the mysql command that doesn’t allow it to run?

  • 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-06-02T06:13:46+00:00Added an answer on June 2, 2026 at 6:13 am

    You’ve forgotten spaces at your line breaks:

    . "SELECT imagetargetpath, gamename, gamedirectory, `like`, dislike\n"
                                                                       ^---here
    . "FROM boardgamelist\n"
                         ^---here
    

    That’d make the final query string be:

    ... dislikeFROM boargamelistWHERE
    

    If you had even bare bones error handling, e.g.

    $copy_query = mysql_query($sql) or die(msyql_error());
                                   ^^^^^^^^^^^^^^^^^^^^^^
    

    you’d have been informed of the syntax errors.

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

Sidebar

Related Questions

I am trying to run a SQL Query in phpmyadmin that will total multiple
I'm trying to create a Textmate snippet, but have run into some difficulties. Basically,
Am a Oracle PL/SQL newbie. Basically, I have a table created as follows: CREATE
Basically i am trying to build an application that uses SSIS to run a
I'm trying write a routine in SQL Server that, when run, would traverse specified
I am trying to use JSON to populate a div, so I basically run
Using SQL Server 2000 I am trying to use this command in Query Analyzer
I am currently trying to script a job on SQL Server 2005 that will
I'm trying to optimize a report query run on an ecommerce site. I'm pretty
I am using the groovy.sql.Sql class to query a database and process the results.

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.