Jump to content

xiao

Members
  • Posts

    163
  • Joined

  • Last visited

    Never

Everything posted by xiao

  1. yea, but the problem is that I already have the array with all the names and I need to transform it.
  2. Is there a way to turn an array like this Array ( [somename] => Cat [someothername] => Bird [anothername] => Horse ) into Array ( [0] => Cat [1] => Bird [2] => Horse ) ?
  3. oh, sorry, typo. It deletes id = 1 and id = 0, not id = 2.
  4. I create my array like this: $_SESSION['ECpc'] = $productcodeEC; $_SESSION['ECid'] = $rij['products_id']; $_SESSION['ECprijs'] = $rij['products_price']; $_SESSION['ECnaam'] = $rij['products_name']; And add stuff to it like this: array_push($_SESSION['ECpc'], $productcodeEC); array_push($_SESSION['ECid'], $rij['products_id']); array_push($_SESSION['ECprijs'], $rij['products_price']); array_push($_SESSION['ECnaam'], $rij['products_name']); And I delete from it like this: array_splice($_SESSION['ECpc'],$id,1); array_splice($_SESSION['ECid'],$id,1); array_splice($_SESSION['ECprijs'],$id,1); array_splice($_SESSION['ECnaam'],$id,1); It all works fine, unless I delete $id = 0, then php always deletes $id = 0 and $id = 2... ???
  5. is it possible? Because I need to find an easy way to cache my query results. I have this: function sessie($qry,$product){ while($rij = mysql_fetch_assoc($qry)){ $_SESSION['qryProductid'][$product] = $rij['products_id']; $_SESSION['qryProductnaam'][$product] = $rij['products_name']; $_SESSION['qryProductprijs'][$product] = $rij['products_price']; } } If that works, how do I transform this? (old query result output) while($rij = mysql_fetch_array($qry)) { $prijs = number_format($rij['products_price'],2, ',', ''); echo "<option value=\"" . $rij['products_id'] . " - " . $prijs . "\""; if($_SESSION['productid'][$productsoort] == $rij['products_id']) echo " SELECTED "; echo ">" . $rij['products_name'] . " - €" . $prijs . "</option>\n"; }
  6. hmm, makes sense Thanks. makes me able to do another 20 minutes of programming. I'll be back with another silly question in a few minutes
  7. if(($_POST['processor'] != "(Make a choice)") && ($_SESSION['processor'] != $_POST['processor'])){ $_SESSION['processor'] = $_POST['processor']; } So it shouldn't overwrite everytime, right? It does though. i have a session_start(); (tried to remove it and got quite some errors) I don't have a session_destroy anywhere. I don't really get it...
  8. Is it normal that all session variables get lost when the page is being refreshed?
  9. According to that it should be working right? But that's weird, because I use it like this: if(($_POST['processor'] != "(Maak een keuze)") && ($_SESSION['processor'] != $_POST['processor'])){ $_SESSION['processor'] = $_POST['processor']; print_r ($_SESSION); echo "<hr>"; print_r ($_POST); splits($_SESSION["processor"], "processor"); } So the SESSION var only changes when the POST var changes. So the print_r should only work the first time I submit the form (as long as I don't alter POST['processor']) right? Because it prints it everytime I submit.
  10. session_start(); I don't have a session_destroy(); And if I echo session_id(); it works :-S Only my variables don't get filled
  11. for some reason my session variables aren't working. I use $_SESSION['processorfabrikant'] = $_POST['processorfabrikant']; and I have a session_start; What can I be doing wrong? ???
  12. Yea, I know, but the problem is that I'd have to do an if(!isset($_SESSION['variable'])) && ...rest of checks... about 40 to 50 times more in my script just to get rid of some errors. I'm only planning to turn off error reporting when everything else works fine.
  13. I get some errors Undefined index: something in ... I know why I get them, I know how te remove them, but that would be a lot of unnecessary coding. If I set error reporting off, I won't get them anymore. Is it actualy a problem in any way if a variable doesn't exist yet when I check what's in it?
  14. nobody knows an easy method of caching query results in php? Without altering the PHP installation (since I don't have access to it)
  15. is there some caching method I can use when I can't access the PHP installation stuff?
  16. I have a script which needs to execute about 20 queries in total. It's a form with a lot of dropdown lists. Actualy I only need to execute the queries one by one, because I don't need the next dropdown list if the previous option hasn't been selected yet. But I do need the information from the previous queries to show them in dropdown lists (to be able to change previously selected options). I can't execute all 20 queries everytime because it makes the page very slow. Is there maybe a way to cache query results? I tried $_SESSION['qryName'] = mysql_query("SELECT ..."); But that doesn't seem to work.
  17. If I have this array: $stack = array("orange", "banana", "apple"); I want to remove banana, and apple should be $stack[1] instead of $stack[2] When I use unset, I have unexisting keys in my array, giving errors outputting them. Is there maybe a way to reset all keys in an array? Or otherwise a way to split it up into 2 arrays ("orange" and "apple") and merging them (with reset keys)?
  18. In phpMyAdmin I get this error when inserting the query:
  19. I call it like this: if(mysql_num_rows(mysql_query($qryBehuizing)) == 0){ echo "<option>Geen producten gevonden</option>"; }else{ Query: $qryBehuizing = mysql_query("SELECT p.products_id, p.products_model, p.products_price, p.products_image, pd.products_name, pc.categories_id FROM products p, products_description pd, products_to_categories pc WHERE pc.categories_id = '".$instBC."' AND p.products_id = pd.products_id AND p.products_id = pc.products_id AND pd.language_id = '".$instT."' AND p.products_price <=50 GROUP BY pd.products_name ORDER BY p.products_price") or die(mysql_error()); What am I doing wrong?
×
×
  • 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.