Jump to content

bdmovies

Members
  • Posts

    120
  • Joined

  • Last visited

    Never

Everything posted by bdmovies

  1. Isn't that a preference on the browser? How to save a file?
  2. Hello, I am trying to access a scanner via PHP. I know that the scanner will have to be installed to the same server that the scripts are sitting on, but I don't really know how to go about this. I'm not sure if TWAIN is the route to take, or maybe some custom form. Any suggestions?
  3. Could it really be that simple? wow.... Thanks
  4. Hello all, I'm experimenting with the SVN extension for PHP and and not having much luck. I don't feel like writing my own upgrade system, yet, a commercially distributed software has to have something. So I got to thinking. If I can't make this extension work, I wonder if I can get PHP to execute some command line stuff. I could write a CRON job, or some other shell script to do all the SVN lifting, but my question is how would I be able to access that via PHP. Any ideas? Thanks!
  5. First see what the function tep_redirect is actually doing. It may be doing this already. Also, what happens when you submit the form now? And Crayon Violent is right, it should be: <?php header("Location: " . FILENAME_CONTACT_US . "?action=success"); ?>
  6. My bad - I hardly use constants so I was taking a guess. But yes, I agree, figure out what tep_redirect is doing.
  7. What does <?php tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); ?> do? Couldn't that be replaced with a <?php header("Location: FILENAME_CONTACT_US.action=success"); ?> ?
  8. Thanks very much, I knew I had seen a function that could do it, just couldn't remember. And I figured I was missing something simple, like the extra $. Thanks again.
  9. $info is an array: <?php foreach($info as $key => $value) { $key = $value; echo "$key = ".$value . "<br/>"; } ?> This prints VALUE = VALUE, not KEY = VALUE. Why wouldn't the key get stored as the variable name? This particular array comes from a form with nearly several inputs, so I wanted to streamline the variable naming process by using the loop, what am I doing wrong?
  10. 1. The doctype isn't affected by PHP, unless you are doing something strange in the PHP - why can't you just use the same doctype as everywhere else on your site. 2. Your page breaking in IE 7/8 is a problem with IE (most likely) not PHP, maybe your CSS needs some tweaking.
  11. I agree with neil.johnson as well, #4 and #6 are very subjective. Best bet: write your own.
  12. Ok, scratch that. I know where the \" is coming from, that is being done via JS (Specifically the Prototype framework - .toJSON()) so a new part of my question will be going to the people on the Prototype boards, but I still wonder why does the PHP render NULL upon json_decode()?
  13. I'm passing 3 parameters to an ajax controller - 1 of which is JSON. When the controller gets the parameters, it fired the requested method and continues to pass along the parameters (now as 1 parameter, in the form of an array). Once inside the method, the different parameters are extrapolated from the array. However, for some reason I'm having trouble accessing my JSON input. Here's what I've got: JS is sending: ["32", "33", "34", "really any number could go here..."] PHP is receiving: [\"32\", \"33\", etc, etc...] Why (and where) is the PHP parsing the " in the JSON? I'm not scrubbing it until much later in the method. Once I do json_decode($input['chargeID']) I get NULL as a response. Any Ideas? P.S. json_decode($input['chargeID'], true) does not work either.
  14. I guess the question is really directed towards the syntax or usage of PHPUnit but the more abstract idea of testing. Why, how, what aspects... I mean, if I understand the concept of testing, I need a test function for every regular function I have?
  15. I know I need to test my code, I've just had a tough time understanding how to go about that. Usually I hit google or pull a book sitting on my shelf, however, this is one of those times where good old human interaction is just needed. How do I go about using PHPUnit? More broadly, how do I go about testing my code? Thanks!
  16. Perfect! Thanks a lot, I knew it was something small. I was poking around the php site and was thinking it had to be something with a parent/child relationship.
  17. <?php require_once ('classes/database.class.php'); class cases extends database { function __construct($caseID) { # Get the case details $sql = "SELECT * FROM cases WHERE caseID = '$caseID'"; $result = $this->query($sql); $row = $this->fetchArray($result); foreach($row as $key=>$value) { $this->$key = $value; } } }?> ...Throws this: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /*/classes/database.class.php on line 52 Warning: Invalid argument supplied for foreach() in /*/classes/cases.class.php on line 11 Notice: Undefined property: cases::$plaintiff in /*/test.php on line 11 vs. Notice: Undefined property: cases::$defendant in /*/test.php on line 13 However, This DOES work: <?php class cases extends database { function getCaseInfo($caseID) { # Get the case details $sql = "SELECT * FROM cases WHERE caseID = '$caseID'"; $result = $this->query($sql); $row = $this->fetchArray($result); foreach($row as $key=>$value) { $this->$key = $value; } } } ?> Test.php looks like this; <?php /** * Test file */ error_reporting(E_ALL); // Get required files require_once 'classes/cases.class.php'; $T = new cases('3'); echo $T->plaintiff; echo "<br/>vs.<br/>"; echo $T->defendant; /* Or */ $T = new cases(); $info = $T->getCaseInfo('3'); echo $T->plaintiff.... ?>
  18. My database class is working fine, every other aspect of the program is connecting the way it should. I've found the problem, it's in the constructor function. Now my question is why would that happen?
  19. That doesn't change anything. <?php $test = "52"; $test2 = 52; if(is_numeric($test)) { echo "It's a number - 1"; } if(is_numeric($test2)) { echo "It's a number - 2"; }?> Both echo the respected sentence.
  20. <?php /* Test */ error_reporting(E_ALL); require 'classes/serviceInformation.class.php'; $serviceID = "62"; $service = new serviceInformation($serviceID); $manner = $service->getManner($serviceID); echo $manner; ?>
  21. When I take out the serviceInformation function it works. So, I'm thinking when the class gets initiated that function runs...and somehow that throws it, but I don't see why. My parent class is my Database class, which is working fine.
  22. <?php require_once ('database.class.php'); class serviceInformation extends database { function serviceInformation($serviceID) { if(!is_numeric($serviceID)) { return "Error"; } else { return true; } } function getServiceInformation($serviceID) { if(!is_numeric($serviceID)) { return "Error"; } $sql = "SELECT * FROM serviceInformation WHERE serviceID = '$serviceID'"; $result = $db->query($sql); } function getManner($serviceID) { $sql = "SELECT serviceType FROM serviceInformation WHERE serviceID = '$serviceID'"; $result = $this->query($sql); $row = $this->fetchAssoc($result); $serviceType = $row['serviceType']; $sql = "SELECT * FROM manners WHERE id = '$serviceType'"; $result = $this->query($sql); $row = $this->fetchAssoc($result); $manner = $row['manner']; return $manner; } } ?> Returns: No database selected Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /Applications/MAMP/htdocs/Zend_Workspace/Fusion/classes/database.class.php on line 57 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /Applications/MAMP/htdocs/Zend_Workspace/Fusion/classes/database.class.php on line 57
  23. Hello, I have a class that interacts with my database (simple enough) but for this particular class, the only input it is taking will be whole numbers, so I thought perhaps doing this word work: <?php class myClass extends database { function myClass($whole_num) { number validation here... if number return true if not number return "Error" } function getSomeValueFromDatabase($whole_num) { interact with database here... } } ?> However this did not work, I received a "No Database Selected" error. Besides from writing an entire validation class, is there any way to get this job done using the basic idea laid out above?
  24. I'm trying to pick up the MVC concept. I'm also working on a project where I think this very ideology may help. I need to give my clients a way to create custom reports or configure certain reports to look (or contain certain data) the way they want. I've decided the best way to do this is to export the database query as xml and then let the clients create/edit xslt files. I do not want (nor really can for scalability reasons) to create an xml file for every possible query. I'd much rather create one php file that has a massive list of possible results and based on the controller (??) it calls the correct function and outputs the results as xml. Does this sound like a viable solution? Here is an example. If the client needs AccountingReportA they would open AccountingReportA.xsl. Somehow xml.php gets called perhaps with ?report=AccountingReportA. From there, the a new xmlExport object is created and the AccountingReportA function gets fired. Does this make sense? I think I've got the idea down, just not the implementation.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.