Jump to content

JAY6390

Members
  • Posts

    825
  • Joined

  • Last visited

Everything posted by JAY6390

  1. put this in your script and see if you can find the referrer key echo '<pre>'.print_r($_SERVER, true).'</pre>';
  2. use fopen() and fgetcsv() instead. Loading a huge file of data into memory is highly discouraged
  3. does your server run on apache or another web server such as IIS?
  4. preg_replace is what was used. and it works fine for the tags. The OP was trying to remove everything between tags, not capture it
  5. oops it should be $res not $row for the echos
  6. use echo $row[number]['columnname']; wherever in your code you want it. So if you want the address column of the third record you would use echo $row[3]['address'];
  7. You don't need to assign them, they're already assigned. What is it you are trying to do with the data?
  8. oh, in that case I'd use $text = preg_replace('/>.*?</m', '><', $text);
  9. So you want anything between ANY tags removed completely???
  10. I see, so the @ is to define the variable to begin with (seq in this example), and then the : means it executes it each iteration of getting a row?
  11. Works for me. Either you're using the wrong variable to it or the text isn't as you described. Like salathe says you need to give more info
  12. Could you explain what is going on at the start of that please roopurt18. I've never seen anything like that before. Also, I understand the incrementer but what is the : for in the := ??? Thanks Jay
  13. $text = preg_replace('/<begin>.*?<end>/', '<begin><end>', $text); Oops for some bizarre reason I put login instead of begin. That should work
  14. $text = preg_replace('/<login>.*?<end>/', '<login><end>', $text);
  15. run the query, then use $i = 0; $res = array(); while($row = mysql_fetch_assoc($result)) { $res[++$i] = $row; } Then to use a row, just use echo $row[3]['id] for the third result's id value etc
  16. Are you sure you have the right thread? Nobody has mentioned columns or tables lol
  17. Yeah, and so is the pr, I Just dont see the point in typing up a function for something so minimal
  18. Yeah basically small snippets of reusable code are what functions are. If you see something you think can be used again somewhere else in your script, make it a function. I'd say have a minimum of 3 executable lines of code as a minimum. I've seen people use functions to shorten a function name, and while it's handy, it's hardly needed really examples function pr($expression, $return = false) { return print_r($expression, $return); } function mres($data) { return mysql_real_escape_string($data); } They're kinda handy for the users that don't have a good PHP ide but for those that do it's pointless with intelli code popups, snippet shortcuts and auto replaces
  19. array_slice() ? or simply set the value to a temp variable and then use unset($arrayname['key_name']);
  20. Try this instead $pageid = isset($_GET['id']) ? $_GET["id"] : ''; if ($pageid == '') { header('Location: index.php?id=home'); die(); } else { $filename = "stats/$pageid.txt"; if(file_exists($filename)) { $count = file_get_contents($filename); file_put_contents($filename, ++$count); }else{ file_put_contents($filename, 1); } }
  21. In that case, do it that way. It's either that or use array_sum and then subtract the value of that specific element, or loop through all elements adding to a counter and skipping that element
×
×
  • 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.