Jump to content

bobleny

Members
  • Posts

    429
  • Joined

  • Last visited

    Never

Everything posted by bobleny

  1. I am using ajax to get some data from the server, while the server loads the information, which could take a few minutes, the user just stairs at a loading sign until the server spews out the data all at once. What I would like to do is set the buffer size smaller, so that the server sends its data back as it is found. So the user can watch the list be populated. I did find a function that might make it work the way I want it to, but I don't know how to use it. I found this: HttpResponse::setBufferSize() here: http://php.net/manual/en/function.httpresponse-setbuffersize.php When I try to use it like a function I get this error: Fatal error: Class 'HttpResponse' not found in ...test.php on line 2 test.php <?php HttpResponse::setBufferSize(200); echo HttpResponse::getBufferSize(); ?> Could someone help me out please?
  2. Hi, I have a quick little baby question. I'm simply having difficulties searching for the answer. I want to look at each character of a string. This will work: $var = "Joe"; echo strlen($var) ."<br />"; for($i = 0; $i < strlen($var); $i++) { echo $i. $var[$i] ."<br />"; } It will print: 3 0J 1o 2e ---------- That is, believe it or not, exactly what I want to do. However, I don't think that is the proper way of doing it. Is there not a pre-built function designed to return a character of a string at index $i? It has been my experience, that the way I am doing it above will either malfunction or will simply not work / won't compile. Thanks for you help!
  3. lol, I forgot about you.... I think I can make it up though! OK I think this is what you need: var DivWidth = document.getElementById("image_holder").offsetWidth; var DivHeight = document.getElementById("image_holder").offsetHeight; That works perfectly for me running firefox. (What is does in IE.....) I think It will work fine in IE though! Also, in my searches, I stumbled across a script that you might be interested in... <html> <head> <script type="text/JavaScript"> <!-- // addEvent function by John Resig: // http://ejohn.org/projects/flexible-javascript-events/ function addEvent(obj, type, fn) { if (obj.attachEvent) { obj['e'+type+fn] = fn; obj[type+fn] = function(){ obj['e'+type+fn](window.event); } obj.attachEvent('on'+type, obj[type+fn]); } else { obj.addEventListener(type, fn, false); } } addEvent(window, 'resize', function(event) { var DivWidth = document.getElementById("image_holder").offsetWidth; alert(DivWidth); //alert('The page has been resized'); }); //--> </script> <title>A Title!</title> </head> <body> <div id="image_holder" style="border-style: solid;"><img src="test.png" id="i_image" /></div> </body> </html> I improvised the original alert with: var DivWidth = document.getElementById("image_holder").offsetWidth; alert(DivWidth); Now, instead of getting an alert that says, "The page has been resized," you get an alert that says the width of the div element. The really nice thing about this script, is that it is active. As you resize the browser, you will get many popups. What makes that nice is it should give a more dynamic feel to the users. Hope this helps!
  4. Right, I know that.... However, I think I figured it out. Though your while loop never goes false, it should eventually go null, which would terminate the loop... On the other hand, the following script works just the same!? function Hide(fieldID) { var i = 1; while("joe") { document.getElementById('step'+i).style.display = (fieldID==i++) ? 'block' : 'none'; } return; } Since joe is always joe, the loop should never end and IE should crash. (Firefox to the rescue!) If you run the modified script, it works fine....
  5. My script doesn't have an error in it! That was done on purpose to make the script work onload. Could you explain your script, mjdamato? I don't understand how your while loop breaks, because the condition never changes... ------ Glade to here you got your script to work!
  6. Would It be possible for you to post your code, or at least a dumb downed version of it so I can play with it? I think I may have tried something similar to that before. So it would be interesting to see what you got going on.
  7. Well, I don't understand exactly why you want to do that, but this is how I would do it: <html> <head> <script type="text/JavaScript"> <!-- function Hide(field) { if((field == "1") || (field.id == "1")) { document.getElementById("step1").style.display = "block"; document.getElementById("step2").style.display = "none"; document.getElementById("step3").style.display = "none"; } if(field.id == "2") { document.getElementById("step1").style.display = "none"; document.getElementById("step2").style.display = "block"; document.getElementById("step3").style.display = "none"; } if(field.id == "3") { document.getElementById("step1").style.display = "none"; document.getElementById("step2").style.display = "none"; document.getElementById("step3").style.display = "block"; } if(field.id == "4") { document.getElementById("step1").style.display = "none"; document.getElementById("step2").style.display = "none"; document.getElementById("step3").style.display = "none"; } } //--> </script> <title>A Title!</title> </head> <body onload="Hide(1)"> <div id="step1"> <input type="button" id="2" value="Goto step 2 ->" onclick="Hide(this)" /> </div> <div id="step2"> <input type="button" id="1" value="<- Goto step 1" onclick="Hide(this)" /> <input type="button" id="3" value="Goto step 3 ->" onclick="Hide(this)" /> </div> <div id="step3"> <input type="button" id="2" value="<- Goto step 2" onclick="Hide(this)" /> <input type="button" id="4" value="Finish" onclick="Hide(this)" /> </div> </body> </html> Please take better care of your scripting, because there where a lot of errors in the script you posted....
  8. I have no clue what is going on there, but this does what you described. I just hope you can outfit it with your code... <html> <head> <script type="text/javascript" src="../javascript/ui/jquery.js"></script> <script type="text/javascript"> <!-- function Blury(feild) { alert(feild.value); } function Submits() { alert("Submits!"); } //--> </script> </head> <body> <input type="text" name="a" onblur="Blury(this)" /> <input type="button" name="Submits" value="click me" onclick="Submits()" /> </body> </html> If this doesn't help you, I will be glued to this topic to see what the deal is with your code........... :-\
  9. You mean, " document.getElementById("SomeDiv").style.height = "42px"; " doesn't work?
  10. Maybe I'm a little off the beaten path, but this should work: <html> <head> <script language="JavaScript" type="text/JavaScript"> <!-- function Reload(value) { if(document.getElementById('user').value == "1") { window.location = "http://www.firemelt.net"; } if(document.getElementById('user').value == "2") { window.location = "http://www.google.com"; } if(document.getElementById('user').value == "3") { window.location = "http://www.cnn.com"; } } //--> </script> </head> <body> <select id="user" onChange="Reload()"> <option selected="selected">-- Select an Option --</option> <option>1</option> <option>2</option> <option>3</option> </select> </body> </html>
  11. It doesn't look like you know javascript either...... First do me a favor and read this: http://www.dannyg.com/ref/javavsjavascript.html Now that you have done that, we can begin: If I where you, I would just use php.... You can use php to set the cookies: http://us3.php.net/setcookie Then everything else should be a cakewalk... When a visitor arrives, check to see if they have your cookie(s) If they do, check that the stored links are valid If they are valid, display them If not valid, delete them There you have it, a step by step php guide to a cookie website.
  12. There is a reason for that, but I won't mention it here..... Anyways, did you have a question? Personally I think popup windows is nothing more than an irritant, regardless of the intent...
  13. What I normally do with drop boxes is add a "blank" option... I would do something like this: <select name="eva" id="eva" onchange="setevent();"> <option value="" selected>Select an Option</option> <option value="arts">Arts</option> <option value="cause">Cause</option> <option value="cultural">Cultural</option> .... This would force the user to click arts, thereby making you script work again. However, the work around is to use the onload() event to trigger the menu: <body onload="setevent()">
  14. Yikes! Well you don't kneed to do that... This should be all you need: if(($pcnt[$i]*100) > 90) Simply multiplying it by 100 will do the trick or, you can leave that side alone and do this: if($pcnt[$i] > .90) They both should work well.
  15. Assuming your css is correct, I am wondering what is in $pcnt[$i] What happens when you echo $pcnt[$i]; because there is no reason why the <div> aspects wouldn't work...
  16. Can you place your whole script in a [.code] block for us to analyze please?
  17. Where the hell did you get that idea from, the name box[] just means the data is added to the array called box, it is not a literal name. Hm.. I didn't even think about it lol.... That answers a few things....
  18. Sorry about that... <?php $date = date('F d, Y'); // Connecting, selecting database $link = mysql_connect('localhost','user','pass'); if (!$link) { die('Could not connect: ' . mysql_error()); } // Connect to the right DB $db_selected = mysql_select_db('database', $link); if (!$db_selected) { die ('Error Reading Table : ' . mysql_error()); } $table = $argv[1]; $result = mysql_query("select `email` from `database". $table ."`"); $arr = mysql_fetch_array($result); $result2 = $arr[0]; if (!$result) { echo "Could not successfully run query against the DB: " . mysql_error(); exit; } $email = "test@test.com"; $header = "From: company@company.org\nReply-To: me@me.com\n"; $subject = 'This is the results of the query'; $message = "Query dated: ". $date ." \n". $result2; mail($email, $subject, $message, $header); //printf("Completed \n"); echo "<br /><br /><br />"; $num = mysql_numrows($arr) for($j = 0; $j < $num; $j++) { echo $arr[$j] ."<br />"; } ?>
  19. Oh, OK, I now see what it is that you are trying to do but I don't believe you can do that in php... The data stored in, $box will always be the last box checked.... I don't know what else to tell you....
  20. Try running this real quick, and show me the results...: <?php $date = date('F d, Y'); // Connecting, selecting database $link = mysql_connect('localhost','user','pass'); if (!$link) { die('Could not connect: ' . mysql_error()); } // Connect to the right DB $db_selected = mysql_select_db('database', $link); if (!$db_selected) { die ('Error Reading Table : ' . mysql_error()); } $table = $argv[1]; $result = mysql_query("select `email` from `database". $table ."`"); $arr = mysql_fetch_array($result); $result2 = $arr[0]; if (!$result) { echo "Could not successfully run query against the DB: " . mysql_error(); exit; } $email = "test@test.com"; $header = "From: company@company.org\nReply-To: me@me.com\n"; $subject = 'This is the results of the query'; $message = "Query dated: ". $date ." \n". $result2; mail($email, $subject, $message, $header); //printf("Completed \n"); echo "<br /><br /><br />"; $num = mysql_numrows($arr) for($j = 0; $j < $num) { echo $arr[$j] ."<br />"; } ?>
  21. The easiest way to do it would probably be to change the tag attribute: CSS.css .above { color: #0f0; } .below { color: #00f; } PHP: <?php if($percent > 90) { echo "<div class='above'>". $someData ."</div>"; } else { echo "<div class='below'>". $someData ."</div>"; } ?> That should so the trick. If not, you might be stuck with inline css and or some JavaScript....
  22. I have no clue as to why your trying to pass data through a checkbox... However, the name of your checkbox is "box[]". Which should mean that in your php the name of your postdata should be "$_POST['box[]']", not "$_POST['box']". Also, in your form, make sure the action attribute is set to "post". As far as th undefined index goes, posting the whole error next time would get you better help quicker.
  23. You message variable is screwed up. You have this: $message = "Query dated: $date \n" . "$result2 \n" . "\n"; You need this: $message = "Query dated: ". $date ." \n". $result2; If that dose not work, try simply echoing the message to the screen like this: echo $message; Then show us the results of the echo....
  24. I know, I just can't figure out why microsoft can't get their stuff together and join the band wagon... I just think their software could be so much better if the "actually" tried. :'( ---------- Yes, I am done. I will not post in this thread ever again, I promise!
×
×
  • 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.