Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. function perplexed($var) { // <-- function needs an argument passed echo $var; } perplexed("I don't understand how someone with 5yrs xp doesn't know this..."); // <-- need to pass argument to function
  2. Right. So what about passing it to the function when you call it, as well.
  3. My vote is that you didn't pass $TaskID to your function.
  4. .josh

    Explode Help

    Don't need your code. Need a 'before' and 'after' example of the string you want to regex.
  5. .josh

    Explode Help

    Would help if you gave an example string along with an example of what you're wanting to happen.
  6. I got that once today, as well. I think it said session timed out. I just hit post again and it worked.
  7. post an example of what the string looks like and what you want it to look like.
  8. If you are getting 2 blank lines when it's true and 1 blank line when it's false, you have a blank line being output somewhere else. Maybe an extra line after your closing php tag ?> or something. Somewhere other than the else.
  9. Do you have to return the value you inputted? No. You don't have to return anything at all. I input $username into the function, but I'm returning a different variable. Is that ok? Yes. Can you return multiple variables? No, not individually. But you can return an array.
  10. everything looks fine, except that mysql_affected_rows is only used for things that alter the table (insert, update, delete, etc...) You'll want to use mysql_num_rows instead
  11. Use file to get an array of lines, foreach to loop through each line, explode the line at the comma, trim the quotes off the values.
  12. We aren't here to write your script for you. People get paid for that sort of thing.
  13. http://www.google.com/search?hl=en&q=php+connect+to+sqlite+database&btnG=Google+Search
  14. $sql = "select column from table where column=$x"; $result = mysql_query($sql); if (mysql_num_rows($result) > 0) { // put while loop that makes table here } else { // echo no results message }
  15. You need to put your $dbquery and $dbresult inside your foreach loop. You need to put your column names in the first () in your $dbquery. You also need to take the $value in your foreach loop and explode it and then implode it into a comma separated list of values (don't forget to put quotes around them). Then you will put that in the second () of your $dbquery. Make sure your list of values are in the same order as your columns like so: insert into voip (column1, column2, column3, etc.. values (value1, value2, value3, etc...)
  16. <?php session_start(); if ($_GET['dir']) { $_SESSION['dir'] = ($_SESSION['dir'] == 'ASC')? 'DESC' : 'ASC'; }
  17. what are your column names for your 'voip' table, give some example lines in your csv file, and what parts of each line belong to what column in your table.
  18. Ah. So you want to import a csv file into your sqlite db. From the command line? Got some UI? http://www.google.com/search?hl=en&q=import+csv+file+into+sqlite+database&btnG=Google+Search
  19. Dunno if it's an issue or if you care or not but I thought I'd mention what that's actually doing. It's replacing anything that's not a digit or period with '' (removing anything that's not a digit or . ), leaving 1000.00 and then forcing it to be an int (chopping off the .00). So if someone were to put in like 1,000.43 you would get 1000. Dunno if you care about rounding it up/down or if that's gonna be an issue or whatever.
  20. eh. well, I mean, you can do this: <?php $array = array('','#'); if (!in_array($grid[$startrow - 1][$startcolumn], $array)) if (!in_array($grid[$startrow + count($word)][$startcolumn], $array)) if ( ($grid[$startrow + $letter][$startcolumn]) == '' || ($grid[$startrow + $letter][$startcolumn] == $word[$letter]) ) ?> IMO it's not really 'simpler' but I guess it's a few less chars of coding...
  21. it works for me. Perhaps because I just c/p'ed it from your post. Perhaps we are using diff char sets or something. Try this instead: $string = '£1,000.00'; $string = (int) preg_replace("/[^\d\.]/",'',$string); echo $string;
  22. at face value, no, not really.
  23. yeah but...what's the problem? Trying to install sqlite? Trying to import the csv file? what?
  24. I suggest you explain what the problems are.
  25. $array = array('£',','); $string = '£1,000.00'; $string = (int) str_replace($array, '',$string); echo $string;
×
×
  • 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.