Jump to content

trix21

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

trix21's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok, I had to mark unsolved because I can't seem to get it working. Basically the user would upload a file (csv in this case) and after the upload it does an http request via ajax to run a validation check. So one http request has already been sent out to let's say process() function in a php script. That process function is a foreach loop, it seems that once it gets in that loop and ajax is waiting for onreadystatechange I can't do anything... like call another http request to updater() function in another php script that simply calls the database for which line of the csv it's on ("2 of 89 completed") which would update a div block with innerHTML. After the foreach loop from the first http request is finished ... then it will update the div block with the status from the second http request call. So I'm stuck on this. I know php is server side... is there a way to update the process div block while the foreach is running?
  2. Yeah i figured that's the answer I would get, writing to a flatfile or db and using a setinterval method to check it every so often using open. Thanks for the quick response, and the clear answer.
  3. So basically I have a php loop being called. Something like this (keep it simple). foreach($item as $i) { //do some validation stuff } That's simple enough. So what I want to do is update a div while that foreach is going showing which item it's on, kinda like a process update... "1 of 32 complete"... then "2 of 32 complete" etc... I know the basics of making an ajax call but I just can't seem to figure it out... since php is server side and javascript/ajax being client side (browser). Any tips or ideas that could help me out?
  4. Hmm... maybe this is the problem? phpinfo says Configuration File (php.ini) Path /usr/local/php5/lib Loaded Configuration File /usr/local/php5/lib/php.in extension is trying to be pulled from /usr/local/php/ (not php5) is it worth a try to cp the gd.so file to other location?
  5. okay got that going and i see that it's reading from that ini file now... but here is the next problem (This is running through shell... like i said browser is fine) PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/gd.so' - (null) in Unknown on line 0 and checked... file does exist.
  6. Okay pretty simple problem to explain... but can't figure it out. running a php script through shell.. easy: php myscript.php myscript.php has standard GD lib functions such as imagecreate() etc... Runs fine in browser, when trying to run it through shell... Warning: call to undefined function imagecreate() in etc... So why can't a script being run through shell not recognize gd but running it through the browser can? Thanks for the help
  7. I want to be able to run a script more than once using a foreach loop with an include (code below): <?php error_reporting(E_ALL); ini_set('display_errors',1); $path = '/opt/local/bin/'; $order[0]['type'] = "beach"; $order[0]['first'] = "chris"; $order[0]['second'] = "amanda"; $order[1]['type'] = "chairs"; $order[1]['first'] = "chris"; $order[1]['second'] = "amanda"; $order[2]['type'] = "golf"; $order[2]['first'] = "chris clemmons"; $order[3]['type'] = "heart"; $order[3]['first'] = "chris"; $order[3]['second'] = "amanda"; $order[4]['third'] = "6/10/10"; $order[4]['type'] = "lakeside"; $order[4]['first'] = "chris"; $order[4]['second'] = "amanda"; $order[5]['type'] = "stadium"; $order[5]['first'] = "chris clemmons"; $order[6]['type'] = "swan"; $order[6]['first'] = "chris"; $order[6]['second'] = "amanda"; $order[7]['type'] = "wine"; $order[7]['first'] = "chris"; $order[7]['second'] = "clemmons"; $order[8]['type'] = "horse"; $order[8]['first'] = "chris"; $order[8]['second'] = "amanda"; $c=1; foreach($order as $o) { $first = $o['first']; $second = $o['second']; $third = $o['third']; include($o['type'].'/script.php'); $c++; } As you can see near the bottom is where I'm including the script to render an image... these scripts are using ImageMagick to create the image... but I have to wait until it's finished before the loop continues with the next. If you haven't guessed, if it could run through the loops without holding up on running one script at a time it would render much faster depending on the server spec's (cpu/ram etc...). I have also tried calling the script through exec() with no $return but it still waits until it's finished. Example from one of the scripts: <?php $bg = 'heart/back/bg.jpg'; $font = 'heart/font/itcblk.ttf'; $final = '_FINAL/'; $text = $first; $text3 = $second; $text3 = $third; $text = ucfirst(strtolower($text)).' &'; $text2 = ucfirst(strtolower($text2)); $text3 = date('m.d.y', strtotime($text3)); $compolay = $path.'convert -size 500x170 -gravity center -background none -fill "#010101" -font '.$font.' label:"'.$text.'" comp1.png'; exec($compolay, $result); $compolay = $path.'convert -size 500x170 -gravity center -background none -fill "#010101" -font '.$font.' label:"'.$text2.'" comp2.png'; exec($compolay, $result); $compolay = $path.'convert -size 500x170 -gravity center -background none -fill "#010101" -font '.$font.' label:"'.$text3.'" comp3.png'; exec($compolay, $result); $finalout = $path.'convert '.$bg.' comp1.png -geometry +970+1350 -composite comp2.png -geometry +970+1470 -composite comp3.png -geometry +970+1570 -composite -compress jpeg '.$final.$c.'final.pdf'; exec($finalout, $result); exec('rm comp1.png comp2.png comp3.png', $result); ?> All script are bassically the same thing but with different images rendered. So just curious if anyone out there would know of such a way of doing this. Thanks
  8. Ok I figured it out, I was initializing home incorrectly, but that did work thanks alot.
  9. I just tried that right when you posted that last one... crazy enough i'm getting a 500 error.
  10. maybe I should mention that I want this to be backwards compatible with php 4. So unfortunately even though i know that using public functionality would work it won't work in php 4. Yes this has given me a big headache lol.
  11. I've tried extending it on foo but I still get the same problem, which is: Fatal error: Call to a member function on a non-object in **** on line 47
  12. <?php error_reporting(E_ALL); class foo extends bar { function foo() { $this->func_two(); $this->my_func(); } function my_func() { $this->home = new home; $this->home->index(); } } class bar { function bar() { //__construct } function func_two() { $this->hello = new what; } } class what { function what() { //__construct } function what_test() { echo "hello"; } } class home extends foo { function home() { //__construct } function index() { $this->hello->what_test(); } } $wow = new foo; ?> I'm writing an MVC framework and to keep it simple i wrote the above code for example on what my framework is doing. The problem is it dosen't seem that the class home is seeing or able to use the what class even though it's nested in a class extended by the foo class. I've tried everything I can think of but it's just not working the way I want. Any insight to this would be appreciated.
×
×
  • 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.