Re: Select and compare problems still ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 7/1/09 10:06 AM, "Phpster" <phpster@xxxxxxxxx> wrote:






On Jul 1, 2009, at 10:56 AM, "Miller, Terion" <tmiller@xxxxxxxxxxxxxxxxxxxx
 > wrote:

> Why doesn't this work?
>
>
>    $query = "SELECT * FROM `restaurants` WHERE name ='$ucName' AND
> address = '$ucAddress'  " ;
>
> $result = mysql_query($query) or die(mysql_error());
>
>
>  echo $result;
>     $row = mysql_fetch_array ($result);
>
>
>
> $sql = "INSERT INTO `restaurants` (name, address, inDate, inType,
> notes,
> critical, cviolations, noncritical)  VALUES (" ;
>     $sql .= " '$ucName',
> '$ucAddress', '$inDate', '$inType', '$notes', '$critical',
> '$cleanViolations', '$noncritical')";
>
>
>
>        $result = mysql_query($sql) or die(mysql_error());
>
> The error I keep getting is:
>
> You have an error in your SQL syntax; check the manual that
> corresponds to
> your MySQL server version for the right syntax to use
>
> And I have gone in the mySQL panel and let it make the query ....so
> I'm
> really stumped why it hangs ...
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Try removing the backticks from the tablename, I have found that if
you include the backticks around the table name and not the field
names, mysql will throw the occassional fit.

Bastien

Sent from my iPod

Removed them and still getting the same error....
It returns one record then spits out the error...weird.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux