[PHP-DB] Dynamic SQL + result resource error

2001-07-08 Thread Mark Gordon
Why is this code generating an error when it outputs a valid SQL statement? (there are no parse errors) //$find is text box input $wordsarray = explode( ,$find); $sql = SELECT bandname FROM bands WHERE (bandname LIKE ; $i = 0; while ($i count($wordsarray)) { $word =

[PHP-DB] How to I fetch an image file from /tmp directory?

2001-07-29 Thread Mark Gordon
I am inserting binary image data into a mysql table (mediumblob). Actually, what goes into the table is the /tmp... pathname. This is the code I used to try to retrieve, but I get Resource ID#2 $get=mysql_query(SELECT bin_data FROM binary_data WHERE id=$id); printimg src=$get; = Mark

[PHP-DB] Still trying to get image from /tmp path

2001-07-29 Thread Mark Gordon
Thanks, David. That helped a little but now what I get is: img src=/tmp/phpMVWr5Z in the output. The tmp folder is up the directory tree outside of my www folder (on my web host's 'puter)- I don't have direct access to it. Heres the modified code: $sql=mysql_query(SELECT bin_data FROM

[PHP-DB] Can I UPDATE 2 tables with 1 SQL statement?

2001-07-30 Thread Mark Gordon
Heres what I'm trying to do: $data=addslashes(fread(fopen($form_data, rb), filesize($form_data))); //some lines of code edited out $result = mysql_query ( UPDATE bands, binary_data SET genreid='$genre', bandname='$name', bandesc='$description', bandurl='$url', bandemail='$email',

[PHP-DB] SELECT COUNT - result from two tables

2003-11-05 Thread Mark Gordon
I cannot seem to get a SELECT COUNT for a query from fields in two different tables and a WHERE clause. Does anyone know if this is not possible with php/mysql or am I doing something wrong? I have tried a number of variations on the following code: $sql = SELECT COUNT(*), bandid, bandname,

Re: [PHP-DB] SELECT COUNT - result from two tables

2003-11-05 Thread Mark Gordon
Yes, query is definitely working without COUNT(*). Even in the most stripped down form, the query fails: $sql = SELECT COUNT(bandid), genre FROM bands, genre; $result=mysql_query($sql); while ($gen=mysql_fetch_row($result)) { echo $gen[1]; } John W. Holmes [EMAIL PROTECTED] wrote: Mark Gordon