Jump to content

AbraCadaver

Staff Alumni
  • Posts

    1,893
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by AbraCadaver

  1. I'm not sure what your code is doing but to get out of a loop use break. for($i=0;$i<count($arr0);$i++){ $arr1=explode(":",$arr0[$i]); if($arr1[0]==$_POST['uname']){ array_splice($arr0,$i,1); $ser_arr0 = serialize($arr0); $sql1 = "update yahvid.tracku set serdata='$ser_arr0' where modname='$_POST[modname]'"; $retval1 = mysql_query( $sql1, $conn ); break; } }
  2. You can use var, but better public, private or protected. But if it is not a constant value (can't be another variable), then do as PFMaBiSmAd said and assign in the constructor: class user { var $id; function __construct() { $this->id = $_SESSION['id']; // etc... } }
  3. Wow, just saw this EXACT question and code on another forum: filter_var($email, FILTER_VALIDATE_EMAIL);
  4. That's totally the wrong code. strftime needs a unix timestamp and you're giving it the result of is_string which is probably true. Depending on what $row["timestamp"] looks like you probably need this: date('Y', strtotime($row["timestamp"])); Or use the MySQL date functions to just return the year from the query, depending on if you need the whole date later or not.
  5. You are only fetching one row into $row1 and then displaying it multiple times. Try this instead: //$row1 = mysql_fetch_array($result); // delete this //for($i = 0; $i < $rows1; $i++){ // replace this with while($row1 = mysql_fetch_array($result)) { Also, you start using $result1 and then switch to using just $result.
  6. You can't have any output, spaces HTML anything before a header() call. You do here: <?php require_once("includes/function.php"); ?> these two blank lines are interpretted as HTML whitespace and sent to the browser, because they aren't in php tags <?php session_start(); Should be: <?php require_once("includes/function.php"); session_start(); Your other server must have had output buffering turned on in php.ini that buffered the output before the header.
  7. You'll have to elaborate more on what you want.
  8. Read the file into a string with file_get_contents(), make changes to the string and then write it back out with file_put_contents().
  9. What does this produce: function RemoveMultibyte($text) { $new = $text; echo $new . '<br>'; $new = preg_replace('~[^\\pL0-9_]+~u', '-', $new); echo $new . '<br>'; $new = trim($new, "-"); echo $new . '<br>'; $new = strtolower($new); echo $new . '<br>'; $new = preg_replace('~[^-a-z0-9_]+~', '', $new); echo $new . '<br>'; return $new; }
  10. I you do your inputs the way I showed, then you would remove all the $chxN = $_POST['chxN'] and replace all of your echo $chxN with: foreach($_POST['check'] as $chx) { echo $chx; }
  11. Yes, and you can also create an array of checkboxes so that you only operate on the ones that are set: <input type='checkbox" name="check[1]" value="something"> <input type='checkbox" name="check[2]" value="something else"> Then: foreach($_POST['check'] as $key => $value) { //do stuff with $key and/or $value }
  12. What do you mean they don't work? Care to post some code and the results?
  13. Ha the default case. Yes, I skipped right over that!
  14. Your switch looks fine but not the if. Try this: if( isset($_GET['user']) ) { $xid = strtolower($_GET['user']; } else { $xid = 'default'; }
  15. Yes, an you should be using urlencode() on text that you put in the URL. This will do that for you.
  16. It's hard to tell what you're doing, but file() reads a file, plus you are assigning the data to an array first. Try: $mybyte = $_POST['myfilebyte']; file_put_contents('/path/to/file', $mybyte);
  17. Your link can have something like ?lang=EN and then you can get it with $_GET['lang'] and use it how you wish.
  18. I'm not positive how you want to do this, but this is one way: ob_start(); include("test.php"); $output = ob_get_clean();
  19. http://us2.php.net/manual/en/language.types.string.php Read the single and double quote sections.
  20. You may have a space or something else that is outputting which would make the header fail. Try adding this up top: error_reporting(E_ALL); ini_set('display_errors', '1');
  21. Add this to the top of the page: error_reporting(E_ALL); ini_set('display_errors', '1');
  22. One problem at least is this (you only want the first one): mysql_query("UPDATE table SET col8='Y' WHERE id='$id'"); mysql_query("UPDATE table SET col8='Y' "); Secondly, do you really have a column called id in the table that has a unique id for each row?
  23. You probably need to show several lines before and after this line.
  24. It may sometimes work with a relative one, but the Location header requires an absolute URL.
×
×
  • 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.