ober
Staff Alumni-
Posts
5,327 -
Joined
-
Last visited
Everything posted by ober
-
I'm using the PHPActiveRecord ORM and trying to create a basic query and I would have this same problem if I was writing direct SQL. How do I pass a database function to a query and have it be parsed correctly? $trail = new AuditTrail(); $trail->aid = "TABLESEQ.nextval"; $trail->uname = $usr; $trail->adatetime = date("n/j/Y h:i:s A"); $trail->acat = $cat; $trail->aaction = $action; $trail->contract_id = $contract; $trail->save(); The 'TABLESEQ.nextval' is an Oracle database 'autonumber' type functionality. I tried doing it with single quotes, double quotes, no quotes. How do I get it to recognize it as a DB function? The SQL query would look like: "INSERT INTO TABLE (aid, uname, adatetime, acat, aaction, contract_id) VALUES (TABLESEQ.nextval, '$usr', '".date(n/j/Y h:i:s A)."', '$cat', '$action', '$contract')" Any ideas what I'm doing wrong?
-
Ok, got it figured out. I swear I added the path to the oracle instant client to the windows PATH previously but I guess not. So here are the steps needed if anyone else needs to do this on Windows: 1) Follow this tutorial with the latest versions of Apache/PHP: http://www.vertstudios.com/blog/php-apache-installation-tutorial/ 2) Follow the notes here: http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html, specifically this section: Enabling the PHP OCI8 Extension on Windows 3) Make sure the OCI8 and the PDO OCI extensions are enabled in PHP. 4) Profit (or something).
-
I am trying to get Apache 2.2 and PHP 5.3.6 up and going and connected to an Oracle database. I have Apache and PHP playing nicely at this point. My problem is the PDO driver for Oracle. I've uncommented the php_pdo_oci extension in php.ini and it seems to be adding it in after an Apache restart but the driver isn't there. The weird part is that this is in the configure command in phpinfo: "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=D:\php-sdk\oracle\instantclient11\sdk,shared" " Those paths don't even exist. I don't even have a D drive. I think maybe if I could change those it would work. OH, and I'm trying to use PHPActiveRecord, which only has a PDO extension for Oracle... which is why I'm trying to get PDO working. But when I go to a page that actually calls for a connection using PDO, it just says that it can't find the driver. Can anyone help me?? I've been stuck on this for 2 days!
-
OK, so replacing all newline characters in the data in the database cleared the problem, so I just did that and now I'm replacing them as they're imported as well. Problem solved.
-
So if I do this: SELECT object, HEX(object) FROM table The duplicates are being caused by an additional '0D' on the objects that are otherwise similar. Now I have to figure out how to strip those. I don't think it's necessarily an encoding thing anymore.
-
OK, it's not a problem with the query. If I select two rows from the same object and do nothing but save them, it updates the name of the object on one of them and the output magically works again. So now I'm wondering if the problem is an encoding problem? That column is current set to a collation of latin1_swedish_c1. Should I change it? The data is coming from 2 different sources so it is possible that the encoding on one of them could be different.
-
That doesn't do anything. I've also tried Distinct on the object. No dice.
-
I have data stored like this: object1 | typeA object1 | typeB object2 | typeA etc. I want the output to be as follows: typeA | typeB object1 X | X object2 X Instead, I'm getting: typeA | typeB object1 X | object1 | X object2 X My query is as follows: The MAX/IF statement is for each 'type' mentioned above. Is there any way to do this without doing more looping and running more queries?
-
<?php header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); header('Cache-Control: private',false); header('Content-Type: binary'); // plain text file $filename = 'test.dat'; header("Content-Disposition: attachment; filename=\"".$filename."\";" ); header("Content-Length: ".filesize($filename)); readfile("$filename"); ?> Well, I wrote the results to a .dat file and now it is serving it appropriately. WEIRD. Oh well, all is well that ends well.
-
OK, it gets even more weird. I can create an xlsx file in another directory and I can create a .dat file in this directory, but now the .dat file gets served as an empty file, even though I can see it and there is definitely data in it.
-
Nope, IIS. And here's the weird thing. When I browse on the server and go to the properties of the folder, the 'read only' checkbox is 'half-checked', if you know what I mean. I uncheck it, hit ok, come back in and it's back to 'half-checked'... like I never touched it. But the weird thing is, the temp folder where I was able to write to also has the same setting.
-
Start with this: http://www.phpfreaks.com/forums/index.php/topic,95441.0.html And in the while loop, you need to do one of 2 things: 1) Add all users to an array or comma separated string to use in the mail() function 2) mail each recipient separately in the while loop. I would send one email to all recipients, personally... and make sure you BCC them.
-
Well, that's what it is doing now... using the windows temp folder because I seem to have a permission problem somewhere that is not allowing me to write to anything in the DOCUMENT_ROOT.
-
I can't do that because the file isn't in the web server's path. I'm actually grabbing it from outside of the public access. So I have to be able to do this. I guess my other option would be to copy it to another location after processing it, but it seems to be insane that this isn't possible. It works great in FF... :'(
-
I am generating a snapshot of some data and giving the users the ability to download that snapshot. I am trying to serve that file to the users and it works great in Firefox, but the IE users just get a blank file. I'm using the following: <?php header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); header('Content-Type: text/plain; charset=ISO-8859-1'); // plain text file $filename = 'C:\WINDOWS\Temp\snapshot.txt'; header("Content-Disposition: attachment; filename=\"".$filename."\";" ); header("Content-Length: ".filesize($filename)); readfile("$filename"); ?> I've changed multiple items several times and each works in FF, but none work in IE. Is anyone aware of any IE specific headers that need to be sent? It's just a plain text file, nothing fancy.
-
http://www.php.net/manual/en/reserved.variables.server.php Look on that page for "Query String".
-
OK, I wrote to C:\WINDOWS\Temp and it worked.... WTF.
-
I tried in the document_root folder, I tried directly on the C drive... I keep getting the permission denied error. I've even checked the php.ini file to see if those functions were blocked.
-
OK, so that worked... but the file isn't open. I even rebooted the server and it hasn't changed. I guess I'll try writing to another location.
-
Pardon my ignorance... but how do I do that?
-
It's Windows Server 2003. And I'll say it again, this worked when I initially wrote it and the location of the file hasn't changed and the server hasn't changed. And it's not read-only (the file). And the user (as far as the webserver) hasn't changed either.
-
The file isn't read only... so what else could it be??