I wrestled this little nugget out of a really over complicated and poorly written tutorial trying to get a pdf into a table (and PLEASE, let's not start that debate again, PDF IN THE TABLE is what is needed for this particular application).
Anyway, I stripped it down from well near a 100 lines of crap to get what I've got. At that, tested a couple of times over a week ago, and well... it worked so I ran with it -- wasn't broke, didn't try to fix it. As of early today however, along with a couple of other scripts in another web app I'm working on I discovered it no longer worked. Go figure. Apparently I wasn't finished paring this one down.
At that fopen freed and handle were new to me, as was the $dbQuery which I gather from some digging today is a php class/Pear type thing as opposed to a simple user defined variable??? No?
Anyway, here's what I've settled on (syntax a bit more familiar to me at least). Maybe someone will come along and splain why it's screwed up too?
Thanks for the input. I learned a thing or two (I think... I hope???)
$pdf_id = $focus->id;
$filename = "$pdfdir/report.pdf";
$handle = fopen($filename, "rb");
$contents = fread($handle, filesize($filename));
$contents = addslashes($contents);
$insert = "INSERT INTO inspection_pdfs VALUES ('$pdf_id','$contents')";
$result = @mysql_query($insert) or die("Contract Already Exists for Record No.<br>'$pdf_id'");
Still, I'm finding instances today where
$sql ="some query string";
$result=@('$sql')
WILL NOT work, whereas
mysql_query("some query string");// does?
So I ask you, Is there some significant difference between...
$sql ="some query string";
AND
$query ="some query string";
OR
$my_var ="some query string"; // ????
Can anyone point me to a good discussion on the varieties of query syntax?