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?
You’ve forgotten spaces at your line breaks:
That’d make the final query string be:
If you had even bare bones error handling, e.g.
you’d have been informed of the syntax errors.