Ask a Question related to PHP Development, Design and Development.
-
jcg #1
mySQL error in PHP that works directly in mySQL
Hi,
I created this query:
CREATE TEMPORARY TABLE tmp SELECT photos.Name FROM photos LEFT JOIN
PhotoNames ON ( photos.Name = PhotoNames.Name ) WHERE (PhotoNames.Name IS
NULL);# DELETE photos FROM photos, tmp WHERE (photos.Name = tmp.Name) ;
With this code:
$sql = "CREATE TEMPORARY TABLE tmp SELECT photos.Name"
. " FROM photos"
. " LEFT JOIN PhotoNames ON ( photos.Name = PhotoNames.Name ) "
. " WHERE (PhotoNames.Name IS NULL);#"
. " DELETE photos FROM photos,"
. " tmp WHERE (photos.Name = tmp.Name) ;"
. "";
echo "<br>$sql<br>";
$result = mysql_query("$sql");
if (!$result) {
die("query failed: " . mysql_error());
}
echo "<br>Pruning deleted photos<br>";
And I get this:
query failed: You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use near
';# DELETE photos FROM photos, tmp WHERE (photos.Name = tmp.Name
I created the sql code with phpmyadmin directly. Anyone see my error?
Joel Goldstick
Columbus, OH
jcg Guest
-
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
When i try to start my mysql server, i get this error ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'... -
can't verify mySQL datasource - works in mySQL, but notin CF7
I can't verify a local mySQL datasource in ColdFusion 7 admin. I am using Dreamweaver MX 2004 with the CF7 extensions installed. I am developing... -
Going directly to a MySQL Database Record
Hello, For a few days now I have been trying to do what I suspected isn't too difficult. I have a MySQL database of user profiles. I want my... -
php evaluated directly by mysql and not the webserver ?
Hi there Out of curiosity .... Long time ago I was working with Infomix (now IBM) Universal Server, that had a data type 'html' implemented as... -
using $_SESSION directly in mysql query
Marcus wrote: $query = "SELECT field FROM {$_SESSION} WHERE name='{$_SESSION}'"; .... a) You need to quote your array keys (unless they're... -
Tom Thackrey #2
Re: mySQL error in PHP that works directly in mySQL
On 24-May-2004, jcg <hpwebby@ameritech.net> wrote:
phpmyadmin allows multiple sql statements and comments, mysql_query() does> I created this query:
> CREATE TEMPORARY TABLE tmp SELECT photos.Name FROM photos LEFT JOIN
> PhotoNames ON ( photos.Name = PhotoNames.Name ) WHERE (PhotoNames.Name IS
> NULL);# DELETE photos FROM photos, tmp WHERE (photos.Name = tmp.Name) ;
>
>
> With this code:
>
> $sql = "CREATE TEMPORARY TABLE tmp SELECT photos.Name"
> . " FROM photos"
> . " LEFT JOIN PhotoNames ON ( photos.Name = PhotoNames.Name ) "
> . " WHERE (PhotoNames.Name IS NULL);#"
> . " DELETE photos FROM photos,"
> . " tmp WHERE (photos.Name = tmp.Name) ;"
> . "";
>
> echo "<br>$sql<br>";
> $result = mysql_query("$sql");
> if (!$result) {
> die("query failed: " . mysql_error());
> }
> echo "<br>Pruning deleted photos<br>";
>
> And I get this:
>
> query failed: You have an error in your SQL syntax. Check the manual that
> corresponds to your MySQL server version for the right syntax to use near
> ';# DELETE photos FROM photos, tmp WHERE (photos.Name = tmp.Name
>
>
> I created the sql code with phpmyadmin directly. Anyone see my error?
not. Remove everything after the first ;
--
Tom Thackrey
[url]www.creative-light.com[/url]
tom (at) creative (dash) light (dot) com
do NOT send email to [email]jamesbutler@willglen.net[/email] (it's reserved for spammers)
Tom Thackrey Guest
-
Joel Goldstick #3
Re: mySQL error in PHP that works directly in mySQL
IS> > I created this query:
> > CREATE TEMPORARY TABLE tmp SELECT photos.Name FROM photos LEFT JOIN
> > PhotoNames ON ( photos.Name = PhotoNames.Name ) WHERE (PhotoNames.Namethat> > NULL);# DELETE photos FROM photos, tmp WHERE (photos.Name = tmp.Name) ;
> >
> >
> > With this code:
> >
> > $sql = "CREATE TEMPORARY TABLE tmp SELECT photos.Name"
> > . " FROM photos"
> > . " LEFT JOIN PhotoNames ON ( photos.Name = PhotoNames.Name ) "
> > . " WHERE (PhotoNames.Name IS NULL);#"
> > . " DELETE photos FROM photos,"
> > . " tmp WHERE (photos.Name = tmp.Name) ;"
> > . "";
> >
> > echo "<br>$sql<br>";
> > $result = mysql_query("$sql");
> > if (!$result) {
> > die("query failed: " . mysql_error());
> > }
> > echo "<br>Pruning deleted photos<br>";
> >
> > And I get this:
> >
> > query failed: You have an error in your SQL syntax. Check the manualnear> > corresponds to your MySQL server version for the right syntax to useThanks Tom! So, my best course of action is to create a normal table>> > ';# DELETE photos FROM photos, tmp WHERE (photos.Name = tmp.Name
> >
> >
> > I created the sql code with phpmyadmin directly. Anyone see my error?
> phpmyadmin allows multiple sql statements and comments, mysql_query() does
> not. Remove everything after the first ;
>
instead of temporary, then perform each operation after the next with 3
mysql_query statements?
Joel Goldstcik
Joel Goldstick Guest



Reply With Quote

