Jump to content

scott212

Members
  • Posts

    58
  • Joined

  • Last visited

    Never

Everything posted by scott212

  1. Any of you geniuses have any tricks to count the number of dimensions within an array? I'm using the following to check to see if it is multidimensional or not, but I'd like to convert it to return the number of dimensions. Here's what I have: function array_dimen($input) { // see if the array is multidimensional $num_root = count($input); $num_branch = count($input, COUNT_RECURSIVE); if ($num_root < $num_branch) { return 1; } else { return 0; } }
  2. Is it standard or unadvised to put a mysql entry into a loop where it could potentially loop a couple hundred times?
  3. I'm trying to create a javascript function that calls a php page ajax style and unhides the table row that contains it. When the user hides the row again and then unhides it again after that, it would be awesome if the javascript already knew that it has been called and only shows the row instead of reloading it. any ideas?
  4. I think it's a lot simpler than your making it. Try something like this: class randNum { function genRand($rand1,$rand2) { $rand = rand($rand1,$rand2); return $rand; } } $randClass = new randNum; $randNum = $randClass->genRand(0,1); echo $randNum; OR if you wanted to have a set top or bottom you would do this: class genRand { var $randTop; #constructor function genRand() { $this->randTop = 1; } function genRand($randBottom) { $rand = rand($randBottom,$this->randTop); return $rand; } } $randClass = new genRand; $randNum = $randClass->genRand(0); echo $randNum; Hope that helps
  5. OMG that was an incredible run on sentence! I've corrected it just so others can understand it: Original Question: What I'm doing is writing a PHP script that displays a members fav houses. I did this by when the user finds a house he likes, it stores the account number in "their" table. This is supposed to run through all of the account numbers stored in the member's table and then reference that number to an account number in another table. The script then outputs the matches into an HTML table. It works fine, except instead of outputting all of the houses, it only outputs the house entered last. any question just ask First off, it looks like you've got a couple lines flipped -> while($row = mysql_fetch_array($result)) $ac=$row['fav']; { $result1 = mysql_query("SELECT * FROM estate WHERE accountnum=$ac"); SHOULD READ: while($row = mysql_fetch_array($result)) { $ac=$row['fav']; $result1 = mysql_query("SELECT * FROM estate WHERE accountnum=$ac"); Also, that last block of code looks a bit wacky to me: if(mysql_num_rows($result1) == 0) ECHO "<h3>YOU HAVE SAVED NO FAVORITES!</h3>"; mysql_close($con); If your messing with multiple lines in a conditional, it's better practice to use curly braces to define your statements. Hope that helps
  6. Your question is a bit vague - what relationship do the subsequent pages have to the main page? Are they sharing the content? Are they sharing a template? Based on what I think your question is, you could either include or not include the content having it located in a separate file, or hide it with "style: display none" css attribute on the table/row/cell or whatever object you want to hide.
  7. Install one of the aforementioned code libraries and look at your php.ini file. The PHP install is including them instead of each individual page. I have never done this before and really have no idea if it's a good idea to work this way.
  8. I figured it out, ended up passing an id in JSON and doing a js search for it
  9. Is there a way (besides RegEx) to determine the response type from an AJAX request? Here's the code that I'm trying: [code] if (xmlHttp.readyState==4) { // show results   var respObj = eval('('+xmlHttp.responseText+')');   if (respObj.message) {       document.getElementById('ax_search_main').innerHTML = "<div class=\"createProfile_labels\">"+respObj.message+"</div>";       ax_process();   } else { document.getElementById('ax_search_main').innerHTML = xmlHttp.responseText;   } }[/code]
  10. Here's an issue that is slowly rising to my attention. With the style of ajax not reloading the page, I'm stuck as to what to do to redirect the page after an ajax loaded php file completes.
  11. Is there an easy way to get the row number of a row I just inserted?
  12. sorry for the delay... the value of $_GET['image'] is whatever follows the = in the url. (page.php?image=1234.jpg) You can define how you want it to relay the message any way you wish, but if page.php?image=1234.jpg is the url, then $_GET['image'] equals 1234.jpg. Saying $image=$_GET['image']; makes $image equal to 1234.jpg as well. Then you can just pop a directory path on the front of $image and put it in an html image tag. you don't have to use $image, you could just use the GET statement, but I think it looks better the other way.
  13. I thought you were forced to use a POST method with enctype="multipart/form-data" in the form declaration?
  14. shizer, now I want to rewrite everthing I've been working on lately. Damn
  15. that works?? I didn't think you could break the stream inside the condition! Edit: Wow! that was fast. All excellent suggestions I've never seen used anywhere. Thanks!
  16. If I've got a condition that outputs different blocks of html based on the condition. If it outputs a modest amount of html, is there a better way to collect the html than just escaping it all and echoing it? It becomes hard to manage and ugly all escaped like that.
  17. What's the best way to run a search on a database where your match groups of columns such as 'first_name' and 'last_name'? I'm attempting to create a search that takes a users contact info and return people with similar names in the same area and I'm trying to avoid do a whole list of querys on the db (overhead).
  18. finally figured it out. It turns out that it was a php condition that wasn't getting met because I changed the submit button to an image button. In firefox it still sends the original button value PLUS the value.coordinates. In IE it only sends the latter.
  19. with a semicolon after attribute like you've written?
  20. Hey crew - this has been pissin me off all day. I've got some code with a little php to drop in the values. Here's the offend part: <tr id="error_link" style="display: <? echo $pro_link_row_style; ?>"> The php evaluates to either "" or "none". This works fine if written literally into the html, but not with the php. Check the php you say? Frickin IE won't let me view the source on this one particular page to see what it's outputting. Firefox works perfectly and displays the source to be exactly as intended. I don't see how IE could be seeing it any other way. Any Ideas? Please?
  21. I would highly recommend google's new checkout.google.com. there is also a seperate project called PHPgCheckout wich is much easier to implement: http://ron.expertdatabasesolutions.com/2006/07/08/integrating-google-checkout-with-phpgcheckout-part-1/
  22. look into the GD library. It's generally installed on every commercial hosting server. The function is imagecopyresampled(). Use it in conjunction with other image operations but any decent image resize php tutorial will give you a lot of info on it.
×
×
  • 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.