-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
Don't need your code. Need a 'before' and 'after' example of the string you want to regex.
-
Would help if you gave an example string along with an example of what you're wanting to happen.
-
I got that once today, as well. I think it said session timed out. I just hit post again and it worked.
-
post an example of what the string looks like and what you want it to look like.
-
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.
-
[SOLVED] Question about returning values in functions
.josh replied to limitphp's topic in PHP Coding Help
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. -
[SOLVED] Question about returning values in functions
.josh replied to limitphp's topic in PHP Coding Help
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 -
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.
-
We aren't here to write your script for you. People get paid for that sort of thing.
-
http://www.google.com/search?hl=en&q=php+connect+to+sqlite+database&btnG=Google+Search
-
$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 }
-
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...)
-
[SOLVED] ORDER BY ASC then DESC and back again.
.josh replied to TheStalker's topic in PHP Coding Help
<?php session_start(); if ($_GET['dir']) { $_SESSION['dir'] = ($_SESSION['dir'] == 'ASC')? 'DESC' : 'ASC'; } -
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.
-
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
-
[SOLVED] Decimal places & currency - is Regex the answer?
.josh replied to psyickphuk's topic in Regex Help
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. -
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...
-
[SOLVED] Decimal places & currency - is Regex the answer?
.josh replied to psyickphuk's topic in Regex Help
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; -
at face value, no, not really.
-
yeah but...what's the problem? Trying to install sqlite? Trying to import the csv file? what?
-
I suggest you explain what the problems are.
-
[SOLVED] Decimal places & currency - is Regex the answer?
.josh replied to psyickphuk's topic in Regex Help
$array = array('£',','); $string = '£1,000.00'; $string = (int) str_replace($array, '',$string); echo $string;