HuggieBear
Members-
Posts
1,899 -
Joined
-
Last visited
Everything posted by HuggieBear
-
It's a typo, change that line to... [code=php:0]if($name != $tmp_name){[/code] Regards Huggie
-
2 problems left with custom pagination code
HuggieBear replied to Ninjakreborn's topic in PHP Coding Help
Try... [code]<?php if ($rownumber <= $num_rows -2){ $rownumbernext = $rownumber + 2; echo "<a href=\"display.php?ps={$postset}&s={$school}&c={$category}&sc={$subcategory}&rownumbernext={$rownumbernext}\">Next Page</a>"; } ?>[/code] If this doesn't work, do you have it working somewhere I can see it? Regards Huggie -
2 problems left with custom pagination code
HuggieBear replied to Ninjakreborn's topic in PHP Coding Help
Fair enough, so when you hover the mouse over the next link, what's the URL it's pointing to, does it actually look correct. Regards Huggie -
It should be set to 'on' to allow the functionality you're after, but I think your local test server needs to be set-up to be publically available to use the features properly, in a DMZ otherwise you'll have firewall and all sorts to overcome. I'd be willing to bet it's network related and not php related. Regards Huggie
-
ok, Try changing this: [code=php:0]while($row = mysql_fetch_array($result))[/code] to: [code=php:0]while($row = mysql_fetch_array($result, MYSQL_ASSOC))[/code] This way, extract($row) will import a variable of $img_name into the namespace, I think by default mysql_fetch_array() gets both names and numbers as an index, but by specifying MYSQL_ASSOC it gets only names, probably less overhead. Regards Huggie
-
2 problems left with custom pagination code
HuggieBear replied to Ninjakreborn's topic in PHP Coding Help
OK, I have to ask, why are you going forward 2 and back 2 each time, why not just 1? Regards Huggie P.S I'm looking at the code in the mean time to see what's causing the issue ;) -
[quote author=Daniel0] Yeah, but it's simpler and more more effecient to run through a loop and explode the lines instead of using regular expressions. [/quote] That I won't deny :) but that still wouldn't have fixed his immediate problem. Regards Huggie
-
2 problems left with custom pagination code
HuggieBear replied to Ninjakreborn's topic in PHP Coding Help
I'm confused, what's your problem with the next link? Regards Huggie -
Daniel, file() is identical to file_get_contents, the only subtle difference is it returns it into a string instead of an array, it's likely to cause the exact same error. Tandem, create a file like this: phpinfo.php [code=php:0]<?php phpinfo(); ?>[/code] Open it in your browser and scroll down to PHP Core. Look for the value allow_url_fopen and see if it's switched 'on' Regards Huggie [size=8pt][color=red][b]Edit:[/b][/color][/size] Damn you Orio :)
-
There's a typo that hasn't been noticed. You're using mysql at the top and then mssql at the bottom... Notice the difference. You need [color=green]m[b][color=red]y[/color][/b]sql_fetch_array[/color] Change this: [code=php:0]while($row = mssql_fetch_array($result))[/code] to [code=php:0]while($row = mysql_fetch_array($result))[/code] Regards Huggie
-
What's the format that you have in the variable, is it 150,000 or just 150000? If it's just a case of removing the delimiter, then use [url=http://uk.php.net/manual/en/function.str-replace.php]str_replace()[/url] [code]$maxprice = str_replace(",", "", $_GET['maxprice']);[/code] Regards Huggie [size=8pt][color=red][b]EDIT:[/b][/color][/size] Too slow :(!
-
OK, what version of PHP are you running? Regards Huggie
-
getting associative array to output correct including missing value
HuggieBear replied to bouton's topic in PHP Coding Help
I think the correct syntax for the last name array should be changed from: [code=php:0]$last_name_array[]=$value[graph_user_hpcx_last_name];[/code] to [code=php:0]$last_name_array[]=$results[$key][graph_user_hpcx_last_name];[/code] Regards Huggie -
Sorry, The str_replace code should have been left out of the loop. [code]$value = str_replace(array_keys($BBCode), array_values($BBCode), $value); foreach (...){ // rest of loop )[/code] Regards Huggie
-
Can you post the code you have then. Regards Huggie
-
Ordering Records in Columns rather than rows *solved*
HuggieBear replied to stualk's topic in PHP Coding Help
There's no function for vertical columns as opposed to horizontal rows. You need to calculate the cell based on the number of columns so that you can use the mysql_result() function with an offset. What problem are you having? Post your attempt at the code and we'll take a look for you. Regards Huggie -
You're almost there, you have the sql sorted, it's just the php... I'd change the syntax slightly to this: [code=php:0]$sql = "SELECT DATE_FORMAT(updated, '%d %b %Y') AS updated FROM windows_atari2600"; [/code] There's no need to single quote and then escape. And notice I've used a column alias (AS updated) this is to refer to the column when you fetch the array. Then in the php to use that value you need to execute the sql and then use the column name to reference it [code] <?php $sql = "SELECT DATE_FORMAT(updated, '%d %b %Y') AS updated FROM windows_atari2600"; $result = mysql_query($sql) or die("Unable to execute statement: " .mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo "$row['updated']<br>\n"; } [/code] Regards Huggie
-
That would work, in fact, it's probably the best way to go. Regards Huggie
-
I've tried the following code and it appears to work fine. [code]<?php $string = file_get_contents('https://daopay.com/svc/numgen?appcode=41970&orderno=yes&format=hash&country=GB&price=1.0'); // strip out the new lines $string = preg_replace("/\n/", "", $string); // match the values after the string 'number' and 'orderno' preg_match("/number=(\d+).*orderno=(\d+)/", $string, $matches); foreach ($matches as $k => $v){ if ($k > 0){ echo "Key: $k - Value: $v<br>\n"; } } // of if you don't want to loop $number = $matches[1]; $orderno = $matches[2]; echo "$number<br>\n$orderno"; ?>[/code] Regards Huggie
-
You can use [url=http://www.php.net/manual/en/function.file-get-contents.php]file_get_contents()[/url] with the URL (depending on your server setup) to put the entire contents of that file in a string, then use a regular expression to get the two values. Regards Huggie
-
help with layout of multiple results in table... *SOLVED*
HuggieBear replied to brown2005's topic in PHP Coding Help
[quote] [code]$query = mysql_query("SLEECT LEFT(field, 1) as 'first', field FROM table ORDER by first ASC");[/code] [/quote] Typo in SELECT... Regards Huggie -
You need to use [color=red]IN[/color] for your [color=green]WHERE[/color] clause and you can use [color=red]IS NULL[/color] for your scores, assuming the field is null by default. [code] <?php $sql = "SELECT home, away, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`, `19` "; $sql .= "FROM scores "; $sql .= "WHERE team_id IN (1, 2, 3, 4) "; $sql .= "AND score IS NULL "; $sql .= "ORDER BY date "; $sql .= "LIMIT 4"; ?> [/code] Regards Huggie
-
On phpsms.com they say [quote]The script does not use any third party messaging gateways.[/quote] They probably mean they're using a gateway, but it's their own. There's no way to send an SMS direct from PHP without a gateway. Regards Huggie P.S. I have an SMS server running using opensource software (http://www.kannel.org) running on Linux.
-
cURL help needed... in over my little head...
HuggieBear replied to jmilane's topic in PHP Coding Help
Seems like a stupid question, but the old box is still serving pages on http://oldserver.mycompany.com/ across the LAN isn't it ;) Regards Huggie