Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 big sql in php -newbie question

Author  Topic 

dbusher
Starting Member

7 Posts

Posted - 2007-03-09 : 18:53:15
I am very new to php. I am trying to use the following SQL query with php and I get an error:

Parse error: parse error, unexpected T_STRING in ...myphp/MyCacheInfo.php on line 13

which is the $results line. Is my syntax wrong? the query runs fine when I use it directly against the db.
<html>
<body>
<?php

// Connects to your Database
mysql_connect("localhost", "name", "pword") or die(mysql_error());
mysql_select_db("dbname") or die(mysql_error());

//gather data
$results = mysql_query("SELECT geocaches.cache_type as "Cache Type", COUNT(*) as "Traditional"

FROM geocaches, logvisit

WHERE
geocaches.cache_id=logvisit.cache_id AND
logvisit.log_owner_id=64 AND
geocaches.cache_type="Adult" AND
logvisit.log_type="Found"

GROUP BY geocaches.cache_type;")
or die(mysql_error());

printf($results)
?>
</body>



</html>

dbusher
Starting Member

7 Posts

Posted - 2007-03-09 : 18:55:06
oops...I meant to post this in a php forum :-)
Go to Top of Page
   

- Advertisement -