ElgisRamon
MIS
Hello, I have a problem with a SELECT query to a MySQL database server from Apache+PHP3:<br><br>I have two tables: item and catitem.<br>Item columns:<br>---------------------<br>tstamp - timestamp<br>user - integer(4)<br>dateitem - date<br>category - integer(4)<br>person - integer(4)<br>amount - integer<br>details - text<br><br>Catitem columns:<br>---------------------<br>id - integer(4)<br>descr - varchar(80)<br><br>The problem is: When I execute from mysql program (AIX version) this <b><FONT FACE=monospace>SELECT catitem.descr AS 'Category', COUNT( item.amount ) AS 'Number of items', SUM( item.amount ) AS 'Total amount' FROM item,catitem WHERE item.category=catitem.id AND item.dateitem>=20000101 AND item.dateitem<=20000701 GROUP BY item.category;<br></font><b>, it gives the correct answer: 15 records with 3 fields each.<br><br>When I connect from my .PHP file with this:<br><FONT FACE=monospace><br>$cx = mysql_pconnect( $server, $user, $pass );<br>if ($cx) {<br> mysql_selectdb( $dataname );<br> $rc = mysql_query( $query );<br>}<br></font><br>It gives wrong results: 0 records of 0 fields each!<br>My database server is the same AIX machine that Apache+PHP server.<br>There is no problem authenticating the user.<br>My Apache server is getting the correct query string, because I'm doing a <FONT FACE=monospace>$FILE=fopen( "somefile", "a+" fwrite( $FILE, $query );</font> to debug the program.<br><br>What I'm doing wrong?<br><br>SMTIA!