Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. That's because earlier you do this: $r = mysql_fetch_assoc($sql);
  2. Don't worry, young grasshopper, practice hard, and one day you shall achieve zen...d
  3. I don't know how versed you are with php/sql but based off your post you can't be much farther than the starter "hello world" tutorial... I think you're putting the cart before the horse. You need to learn how to do basic stuff before jumping into a big project like that. I mean, I can point you to a basic database handling tutorial, but are you even gonna understand that much?
  4. if the only thing that's going to change in your actual query is $field then there's no need to make all those if/elseif's just make one query with the var plugged into it.
  5. so what do you mean by "won't work?" Other than the fact that you didn't supply the glue so it defaults to '' it should work just fine. This works fine on my server: <?php if ($_POST) { $_POST = array_map("strip_tags", $_POST); print_r($_POST); $beans = join($_POST); echo "<br/>$beans"; } ?> <br/><br/> <form action = '' method = 'post'> <input type = 'text' name = 'a'><br/> <input type = 'text' name = 'c'><br/> <input type = 'text' name = 'd'><br/> <input type = 'submit' value = 'submit'> </form> I get an array of values echoed out with html tags stripped, and then a string of array values with no spaces.
  6. internal pointer of the array should have no bearing on it. Post some code, and also a better description than "it no longer works."
  7. foreach ($array as $timestamp) { $somedate = date("some date format here", $timestamp); $newarray[] = $timestamp => $somedate; }
  8. did you check your spambox?
  9. so...you're saying that if you do this: echo $_SESSION['username']; echo $_SESSION['password']; the username echoes, but the password does not? I don't see how either one of those could be echoing, considering you start your session and assign vars after you output text. Perhaps you are using output buffering or something and that file is included or something idk. But anyways, if username is indeed echoing but password is not, then perhaps $password does not contain what you expect when you're assigning it to $_SESSION['password'] or something. Not enough info in code you posted, to determine that.
  10. btw I think someone in the user comments of date submitted a function that pretty much does what you're wanting. Might want to read through it, save you the trouble.
  11. Dunno what you're trying to accomplish overall here, but if the user does not have valid info, I'd probably be wanting to make a script that will prompt them to enter valid info in later, or at least, be able to select columns based on invalid info for my own purposes, later on. Having said that, I don't think I'd be wanting to assign unique invalid numbers like that. What's the point? Again, I don't know the bigger picture here, so that's why I'm saying that. But if you're insisting on assigning unique invalid ssn numbers... you're going to have to have a way to uniquely identify them, anyways. Let's use smaller numbers for example purposes. Let's say that the following numbers are legitimately imported ssn numbers: 1000 1234 1400 1800 Now your next entry has some invalid format, so you're wanting to assign the number 0000 to it, right? And the next invalid one you're wanting to assign 0001 to it, right? And so on and so forth. So what happens when you get to the one thousandth invalid number? Will 1001 be the next unique invalid number assignment? So how are you going to be able to tell which ones are valid and which ones aren't? If it doesn't matter, then why bother importing the data to begin with? I think what I would personally do is either assign all invalid formats the same thing (000000000 for example), or else change your column type to varchar or something, and make it to where you do like i0000, i0001, i0002, etc... in the same column as the regular ones. That way you don't have to interfere with the legit numbers, figure out where the next "gap" is, etc... but again, I don't know what your bigger picture is, just making suggestions based off the given info. I'm just failing to understand why you would want to assign unique invalid numbers.
  12. Ah you are right. I did not notice the tabindex='$tab' (without the +x) because it wasn't lined up with the rest. My bad. So yeah, as long as OP puts $tab++ on the first one, that should work.
  13. You can use strtotime to convert your date/time string to a unix timestamp, subtract it from the current timestamp returned from using time and use date to format the timestamp to say what you want it to say.
  14. You suggested $tab++ this will not work because OP wants the next incremented value to echo. $tab++ will have it "lag behind". And yes, ++$i will work, but that's not what you suggested, now is it?
  15. echo comes before ++ in order of operation, so the var will be echoed first, then incremented. Try your own code. It only echoes 3 vars, because on your first $i++, $i doesn't exist, so it echoes nothing. <?php $x = 1; echo $x++; // output: 1 echo $x; // output: 2 ?> Output: 12
  16. will not work in an echo. $x = 1; echo "blah" . $x++ . "moreblah"; // will inc $x but will not echo result echo "blah" . ($x+1) . "moreblah"; // echoes 2 but does not inc $x echo "blah" . ($x=$x+1) . "moreblah"; // incs and echoes 2
  17. You have to encapsulate your code in glue tags, obviously.
  18. First off you may want to put some parenthesis around some of those things to prevent ambiguity. 2nd, if the column is empty and it's still returning results, you may want to echo out $status to see if it's got what you expect. If it doesn't, then you may in essence be doing status='' edit: premiso beat me to the ( )
  19. fwrite($hFile,date("l, F jS Y - H:i:s-").($ip = $_SERVER['REMOTE_ADDR'])."<a href='{$_SERVER['HTTP_REFERER']}'>{$_SERVER['HTTP_REFERER']}</a>");
  20. getting what error?
  21. Post some code, post some error messages. Also, what is your goal for creating this file? touch will attempt to create a file if it doesn't exist but that's not really it's primary purpose. If you're trying to create a file and save stuff to it, use fopen, fwrite, fclose
  22. you can use glob and use a foreach loop
  23. You forgot the $ at the end of the regex. Without it, something like 123fdss is valid. $ signifies end of the string (the opposite of ^). You also forgot the /'s to signify start and end of regex. <?php $string = '1234'; // $string can be any amount of only numbers if(!preg_match("/^[0-9]*$/",$string)) { echo "invalid<br/>"; } // $string can be any number 1 to 3 digits if(!preg_match("/^[0-9]{1,3}$/",$string)) { echo "invalid<br/>"; } ?>
  24. No not really...you did say you want it to break at specific spots... If you were wanting it to break every 100 words or something, or every x paragraph tag, etc..then sure. The key is that you have to establish a pattern. If there's no pattern, then you have to use something as a marker, like a [pagebreak] tag.
×
×
  • 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.