HuggieBear
Members-
Posts
1,899 -
Joined
-
Last visited
Everything posted by HuggieBear
-
You posted before I'd amended my code. Try copying and pasting again. I changed this: [code]$data[] = array($sourcename => array('cases' => "0", 'inds' => "0"));[/code] To this: [code]$data[$sourcename] = array('cases' => "0", 'inds' => "0"));[/code] Regards Huggie
-
Try this: [code]while($row = mysql_fetch_array($rs)){ $sourcename = $row['dictionary_value']; $data[$sourcename] = array('cases' => "0", 'inds' => "0")); }[/code] [size=8pt][color=red][b]Note:[/b][/color] Tested now, so should work I think.[/size] You can test the desired result with [code=php:0]var_dump($data);[/code] Regards Huggie
-
date_default_timezone_set() Problem
HuggieBear replied to wwfc_barmy_army's topic in PHP Coding Help
There's no advantage of having php4 over php5, otherwise they wouldn't have released 5 :) As for updating, as PHP6 development is well under way and PHP5 has been out for a long time, I'd say if you have the option to upgrade then do. Unfortunately I don't have that option as I use hosted services as opposed to my own. I'm sure others will come to the party and chip in their two cents if I've advised incorrectly though. Regards Huggie -
date_default_timezone_set() Problem
HuggieBear replied to wwfc_barmy_army's topic in PHP Coding Help
Yes, I'm afraid so. If you look at the page in the manual for [url=http://uk.php.net/manual/en/function.date-default-timezone-set.php]date_default_timezone_set()[/url] you'll see it only works with versions later than 5.1.0 Regards Huggie -
date_default_timezone_set() Problem
HuggieBear replied to wwfc_barmy_army's topic in PHP Coding Help
Make sure the PHP version you're using on the site is greater than or equal too Version 5.1.0 Create a file on the site called phpinfo.php and have it look like this: [code]<?php phpinfo(); ?>[/code] When you run it, it should produce the info you're after. Regards Huggie -
Simple txt retrievle in html not working!
HuggieBear replied to ShadowHarlequin's topic in PHP Coding Help
If it works on one but not the other, it would appear it's a configuration issue. Create a php file that looks like this: [code]<?php phpinfo(); ?>[/code] Then upload it to both servers and run it, it should give you the version of php. Check your functions for incompatibilities, I'd be interested to see if the fopen() and fwrite() functions were working the same on both servers. Regards Huggie -
Once the page with the date dropdown appears, view the source and paste it here, that way we can see what values are appearing... Also, post the code for the page that's processing the values. You need to change the line I pointed out earlier again... change: [code=php:0]echo "<option value='" . $row['EventDate'] . "'>" . $row['EventDate'] . "</a>"; [/code] to: [code=php:0]echo "<option value='" . $row['EventDate'] . "'>" . $row['EventDate'] . "</option>";[/code] Regards Huggie
-
OK, I'd have thought that the query failed... Try this: [code] $sql="SELECT * FROM cars WHERE `area` LIKE '%ירושלים%'"; $result = mysql_query($sql) or die ("Couldn't execute $sql: " .mysql_error()); [/code] Regards Huggie
-
how to see what is in an array(ALL FIXED THANKS ALL)
HuggieBear replied to keithschm's topic in PHP Coding Help
How are you propogating the array? Regards Huggie -
There's a slight error there... Change this: [code]echo "<option value='" . $row['some_column'] . "'>" . $row['some_other_column'] . "</a>";[/code] To this: [code]echo "<option value='" . $row['some_column'] . "'>" . $row['some_other_column'] . "</option>";[/code] Regards Huggie
-
The table should have two columns and one row... Column: count_id Type: int(6) Value: 1 Column: count type: int(6) Value: 0 That should do the trick. Huggie
-
We're using a similar method I think, except I'm getting the states from the database, and I'm putting each city in its own table cell as opposed to using [b]<[/b][b]br>[/b] tags. But that's for formatting preference. I'm not sure how I'm going to get them to paginate accurately, but I'm working on it. Huggie
-
OK, are you going to paginate the results? So if you have 4 columns of 20 rows, that's a maximum of 80 table cells, but there's 85 rows in your database, what do you want to do with the other 5 results. What are each of the columns in your table? Can I also make modifications to the database table structure or not? Huggie
-
A Regular Expression is what you're after... Do a search in the Regular Expression forum on this board as I'm sure there's loads of instances of this very request. Huggie
-
[quote author=thedarkwinter link=topic=110667.msg447926#msg447926 date=1160135399] What HuggieBear were saying earlier was cool - but i see he said he'll post it tomorrow :( [/quote] Can't access my box at home from my desk at work :( I'll try to post it early tomorrwo morning for you. Huggie
-
Anytime, always a pleasure, never a chore! Huggie ;D
-
OK, change this: [code] <?php if ($name != "") { imagestring($im, 5, 10, 10, 'Name: ' . $row[0], $cBlack); imagestring($im, 5, 10, 30, 'Job: ' . $row[1], $cBlack); imagestring($im, 5, 10, 50, 'Phone: ' . $row[2], $cBlack); imagepng($im); imagedestroy($im); } ?> [/code] To this: [code] <?php if ($name != "") { imagestring($im, 5, 10, 10, 'Name: ' . $row[0], $cBlack); $profession = array(111 => "Plumber", 211 => "Electrician", 311 => "Joiner"); $job_id = $row[1]; $job = $profession[$job_id]; imagestring($im, 5, 10, 30, 'Job: ' . $job, $cBlack); imagestring($im, 5, 10, 50, 'Phone: ' . $row[2], $cBlack); imagepng($im); imagedestroy($im); } ?> [/code] Regards Huggie
-
Try changing this: [code=php:0]//Use ID=2 if no id present if (!isset($_GET['id'])){ $id = "2"; }[/code] To this: [code=php:0]//Use ID=2 if no id present if (!isset($_GET['id'])){ $id = "2"; } else { $id = $_GET['id']; }[/code] Regards Huggie
-
You wouldn't... You just put this code around any image creation code and then use the variables with the image functions, something like this: [code]<?php $profession = array(111 => "Plumber", 211 => "Electrician", 311 => "Joiner"); $sql = "SELECT job FROM tablename"; $result = mysql_query($sql); while ($roles = $mysql_fetch_array($result, MYSQL_ASSOC)){ extract($roles); $text = $profession[$job]; // All your image code goes here. You should use imagettftext() to add the text to the image // and you'll want to provide the last argument, which is string as $text } ?>[/code] Regards Huggie
-
Sure... Give this a try: http://www.spaanjaars.com/QuickDocId.aspx?quickdoc=312 Huggie
-
Yes, that's perfect. Huggie
-
[quote author=Gruzin link=topic=110682.msg447878#msg447878 date=1160132197] Here what I get: [color=red]Warning: mkdir() expects parameter 2 to be long, string given in /users/3d_cn~1/html/gg/index.php on line 5[/color] [/quote] Did you read my post about the arguments? Try this: [code]<?php if(isset($_POST['action']) && $_POST['action'] == "Create Directory") { $dir = $_POST['dir']; // directory name from form mkdir("test/$dir"); } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> New Directory Name: <input type="text" name="dir"><br /> <input type="submit" name="action" value="Create Directory"> </form>[/code] Huggie
-
Try this: [code]<?php $dir = $_POST['dir']; // directory name from form mkdir("test/$dir"); ?> [/code] Your code passes the path as the first argument and the directory as the second argument. They should both be the same (argument one). Regards Huggie
-
OK, I'm assuming that no processing means you have globals turned on... Try changing this: [code=php:0]$sql="SELECT * FROM tbl_parts WHERE Air_Pressure_Switch= $PartsSearch";[/code] To this: [code=php:0]$sql="SELECT * FROM tbl_parts WHERE Air_Pressure_Switch= '$PartsSearch'";[/code] Regards Huggie
-
I was going to post something like that, but the problem is that if tamilnadu has one city and karala has five, you end up with something like this... [table] [tr][td][b]tamilnadu[/b][/td][td][b]karala[/b][/td][/tr] [tr][td]city1[/td][td]city1[/td][/tr] [tr][td] [/td][td]city2[/td][/tr] [tr][td] [/td][td]city3[/td][/tr] [tr][td] [/td][td]city4[/td][/tr] [tr][td] [/td][td]city5[/td][/tr] [/table] The example provided the following format: [table] [tr][td][b]tamilnadu[/b][/td][td]city3[/td][/tr] [tr][td]city1[/td][td]city4[/td][/tr] [tr][td] [/td][td]city5[/td][/tr] [tr][td][b]Karala[/b][/td][td] [/td][/tr] [tr][td]city1[/td][td][b]State3[/b][/td][/tr] [tr][td]city2[/td][td]city1[/td][/tr] [/table] Regards Huggie