Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. You can, but you do not need to. Inside the function you can access that by $_SESSION['cart']. It depends on if you want your function to handle more than just session or not.
  2. Why not post the code you are using? That way we can specifically show you what to do...
  3. It depends, if he is going to re-use it, Snart's way is better, if he is not, your way is better. All scenario dependent
  4. <?php array_walk($_POST['genre'], "mysql_real_escape_string"); $genres = "'" . implode("','", $_POST['genre']) . "'"; ?> Should apply that function to each element of $_POST['genre']
  5. $query = "SELECT * FROM pbs WHERE ID = '1' AND `time` <> ''"; OR if `time` can be null $query = "SELECT * FROM pbs WHERE ID = '1' AND `time` IS NOT NULL";
  6. You can parse it. <?php $testData = 'array(array( field_1=>"AAA", field_2=>"111" ), array( field_1=>"BBB", field_2=>"222" ), array( field_1=>"CCC", field_2=>"333" ))'; $data = explode(" ), array( ", $testData); $data[0] = str_replace("array(array( ", "", $data[0]); $data[(count($data)-1)] = str_replace(" ))", "", $data[(count($data)-1)]); $newArray = array(); $i=0; foreach ($data as $dat) { $fields = split(", ", $dat); $newArray[$i] = array(); foreach ($fields as $field) { list($key, $val) = explode("=>", $field); $newArray[$i][$key] = str_replace('"', "", $val); } $i++; } print_r($newArray); die(); ?>
  7. <?php $arr_codes = array(); $arr_codes["0"] = 'j'; $arr_codes["1"] = 'a'; //etc ?> Is how you would need to do it. Each time you are overwriting the other way.
  8. No, it will not. But why not pull the data out how you want it formatted when the tool is right there? That and using MySQL DATE_FORMAT will not have the limits of strtotime, which are limits of the OS. I do not believe on a UNIX system strtotime can go past 2039. Anyhow, not to put you down. Just decided to add my reasoning. Either way works.
  9. Which would be about 8-10x slower than using MySQL's EDIT: Decided to add an example: SELECT DATE_FORMAT(`datefield`, '%d/%c/%Y') FROM table_name WHERE condition = something;
  10. Anything, such as the image1-4, that may not have a value allow it to be NULL instead of NOT NULL.
  11. Couldn't you do this? <?php $ip = $_SERVER["REMOTE_ADDR"]; $splitIp = explode(".", $ip); $charArray = array(); foreach($splitIp as $ipPart){ $charArray = array_merge($charArray, str_split($ipPart)); } var_dump($charArray); ?> Seems a bit easier without messing with the loop
  12. "my sites" The client has to either pay out or higher someone cheaper for me to do that. @corbin ms updates, it is there. People just do not install it or have a pirated version of windows and cannot install it.
  13. Yea, probably. I display a warning on my sites to IE6 users to update their outdated software and to alert them about FireFox. The funny thing is, people still use the old versions, which really Microsoft probably will not care about IE6 once IE8 is out, and wonder why they get spyware and virus's. As for me, it is not worth my time as a programmer to debug CSS issues, I actually charge double the amount to debug css issues resulting in an outdated browser to be "hacked" to work. If they are willing to pay me double per hour, great. I am all for fixing it. But I am a stubborn guy and they would rather higher someone at $15/hour to solve that headache for them.
  14. What would be the advantage of doing that? Having it as $itemid => $qty should be just fine.
  15. hahahaha Unfortunately people pay me to make websites and I have to make sure their sites work on the most popular browsers, unfortunately the most popular browser sucks and is a living hell, personally FF3 Anytime someone questions me on IE6, I say tell your users we do not support or you can find someone else to do that. It is such a pain in the but it is not worth the time to try and fix it, cause 1 fix for one browser breaks another etc. And since IE6 is going to be outdated by IE7 and IE8, it is not worth it to code for it. Especially since IE8 is suppose to comply with standards...we will see how that goes. But that is just me.
  16. <?php session_start(); if(!isset($_SESSION["username"])){ header("location: login.php"); } ?> Should do the trick.
  17. Chances are the html in the php version has a link to a css style sheet that is relative. Since that probably was no copied the styling did not copy over. EDIT: Just looked at the source, both versions seem to work fine on my end. Using Firefox 3 EDIT:EDIT: I am a retard, good catch gevens.
  18. rename will move the file. EDIT: Found that out from the manual, so took out the copy/unlink.
  19. Nope, MD5 is a 1-way hash. It "can" be broken using different algorithms, but for the most part is safer than just leaving as plain text.
  20. MySQL does have a built in MD5() function you can use. You may have been using the PASSWORD( ) function instead. I would go with the MD5() then MD5 your password in the code again and see if that works. When you create your login script, you can have either mysql do that or php either does not mat matter.
  21. Post the code and we probably can help you.
  22. Not sure how that come object works, but I would do Quit before Close and see if that helps you at all.
  23. Are you closing the $word object? Or does it have an option to close? It sounds like you are not properly closing that object, which is why the process keeps running.
  24. That is just messed up. Not sure where it is going wrong... You could try this: <?php list($id, $size) = my_explode(";", "11;4.2"); function my_explode($where, $what) { $exploded = explode($where, $what); if (is_array($exploded)) { foreach ($exploded as $key => $item) { if (strstr($item, $where) !== false) { $exploded[$key] = str_replace($where, "", $item); } } } return $exploded; } ?> And run that and see if it works properly. If so, it seems like maybe your server is doing some strange stuff... EDIT: Fixed the code.
×
×
  • 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.