php-windows Digest 3 Dec 2004 15:50:30 -0000 Issue 2494
Topics (messages 25109 through 25112):
Re: Category/SubCategory
25109 by: Bobo Wieland
Re: How to configure PHP5 with support of Java 1.4 on window platform
25110 by: Seung Hwan Kang
Re: new mysql.dll for php...
25111 by: Seung Hwan Kang
displaying neat and tidy currency notation?
25112 by: George Pitcher
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Javascript/php seems to work nice for me (i give it to you as it is with no
explainations... It's also a bit old so I don't know why I did it just like
this and not in any other way):
function advancedSearch_js() {
global $link_id;
print ("<script language='JavaScript1.2' type='text/javascript'>\n");
// RESET_FORM()
print("\tfunction reset_form(theForm) {\n".
"\t\tvar f = theForm;\n".
"\t\tf.namn.value=\"\";\n".
"\t\tf.beskrivning.value=\"\";\n".
"\t\tf.h_grupp.selectedIndex=0;\n".
"\t\tf.u_grupp.options.length=1;\n".
"\t\tf.u_grupp.options[0].value=\"err\";\n".
"\t\tf.u_grupp.options[0].text=\"------------------------------------------\";\n".
"\t\tf.eplanta[1].checked = true;\n".
"\t\tf.zon.selectedIndex=0;\n".
"\t\tf.grannzon.checked = true;\n".
"\t\tf.match[1].checked = true;\n".
"\t}\n\n");
// SWITCH_UGRUPP()
print("\tfunction switch_ugrupp(theForm) {\n".
"\t\tswitch (theForm.h_grupp.value) {\n".
"\t\t\tcase \"alla\":\n".
"\t\t\t\ttheForm.u_grupp.options.length=1;\n\n".
"\t\t\t\ttheForm.u_grupp.options[0].value=\"err\";\n".
"\t\t\t\ttheForm.u_grupp.options[0].text=\"------------------------------------------\";\n".
"\t\t\tbreak;\n");
for ($i = 0; $i <= 6; $i++) { // this is probably some ugly hardcoded
values that should be dynamic...
print ("\t\t\tcase \"".$i."\":\n");
$question = "SELECT ug_key AS id, ugrupp_namn AS text FROM sort_ugrupp
WHERE f_key = '".$i."' ORDER BY ugrupp_namn";
$result = mysql_query($question, $link_id);
$rows = mysql_num_rows($result);
$j = 1;
print("\t\t\t\ttheForm.u_grupp.options.length=".($rows+1).";\n".
"\t\t\t\ttheForm.u_grupp.options[0].value=\"err\";\n".
"\t\t\t\ttheForm.u_grupp.options[0].text=\"------------------------------------------\";\n");
while ($ug = mysql_fetch_object($result)) {
print
("\t\t\t\ttheForm.u_grupp.options[".$j."].value=\"".$ug->id."\";\n".
"\t\t\t\ttheForm.u_grupp.options[".$j."].text=\"".$ug->text."\";\n");
$j++;
}
mysql_free_result($result);
print ("\t\t\tbreak;\n");
}
print ("\t\t}\n".
"\t\ttheForm.u_grupp.selectedIndex = 0;\n".
"\t\treturn true;\n".
"\t}\n".
"</script>\n");
}
So, about presentation of categories I have the following table with three
fields setup in a db:
| id | root_id | name |
1 0 cat1
2 1 subcat to cat1
3 2 subcat to subcat
4 0 cat2
id is an autoincr.int exept for the root category with a fixed id. root_id
is the id for a subcategory's parent category. the root category itself is
not presented in the table... all categories with root_id 0 is placed
directly in the root...
to print out a string looking something like:
"cat1 : subcat to cat1 : subcat to subcat"
when given the id of "subcat to subcat" I do by the following code:
function catPathRec($id, $show_lnk = false, $rtn_val="") {
global $link_id;
$katname = strtoupper(mysql_result(mysql_query("SELECT kat_namn AS kat FROM
text_kat WHERE id = ".$id, $link_id), "kat"));
$hid = mysql_result(mysql_query("SELECT h_id AS hkat FROM text_kat WHERE id
= ".$id, $link_id), "hkat");
if ($rtn_val == "") {
if ($show_lnk) { return ($hid == 0) ? ("<a
href='text.php?action=kat&kat_id=".$id."' style='font-weight:normal;'
onfocus='this.blur()'>".$katname."</a>") : (catPathRec($hid, $show_lnk, " :
<a href='text.php?action=kat&kat_id=".$id."' style='font-weight:normal;'
onfocus='this.blur()'>".$katname."</a>")); }
else { return ($hid == 0) ? ($katname) : (catPathRec($hid, $show_lnk, " :
".$katname)); }
}
else if ($hid != 0) { return catPathRec($hid, $show_lnk, " : <a
href='text.php?action=kat&kat_id=".$id."' style='font-weight:normal;'
onfocus='this.blur()'>".$katname."</a>".$rtn_val); }
return "<a href='text.php?action=kat&kat_id=".$id."'
style='font-weight:normal;'
onfocus='this.blur()'>".$katname."</a>".$rtn_val."\n";
}
----- Original Message -----
From: "Tony Devlin" <[EMAIL PROTECTED]>
To: "Php-Windows" <[EMAIL PROTECTED]>
Sent: Thursday, December 02, 2004 9:17 PM
Subject: [PHP-WIN] Category/SubCategory
Hello to all my fellow PHP friends,
I'm embarking on yet another trecherous adventure. This time Categories,
Sub-Categories and Sub-Sub Categories..
This is for a shopping cart module where the admin can create categories,
sub-categories, and sub-sub categories and then place in a certain sub-sub
category. This is a two fold question, first I will draw an example
display
of what I am trying to accomplish.
Example:
Main Category
|
---> Sub Category
|
---> Sub-Sub Category
|
---> Product
Main Category2
|
---> Sub Category2
|
---> Sub-Sub Category2
|
---> Product2
Question 1:
Admin needs to be able to create new sub categories and assign them to a
main category and be able to create a sub-sub category to assign to a sub
category and then a product to assign to a sub-sub category. When adding
a
new product the admin needs to select a main category which then creates a
dropdown box for a subcategory, which then (IF admin chooses) create a
dropdown box for a sub-sub category. Any ideas on how to create a
function
to handle this? I've seen lots of unstable javascript code to do this (not
to mention difficult to manage)
Question 2:
When displaying the category/sub/sub-sub category listing to the viewers,
whats the best way to handle the output?
Thanks in advance for all your help,
Tony Devlin
--- End Message ---
--- Begin Message ---
As far as I know, a Java extension has not yet implemented for PHP 5 yet
or it might be depreciated. I hope not! But you can use it if and only
if you use PHP 4.x.
Shen Kong wrote:
Rui Zhang wrote:
Hi Fellows
I am trying to integrate PHP and Java,and this is the situation I have.
I am using Apache 2.0.52 and PHP 5.0.2, and my java version is 1.4. PHP
works fine with Apache, but once I want to call some java functions
based on
my setting made to the php.ini, Apache crashes. PHP is installed under
c:\php, Apache is installed under c:\program files, and Java SDK is
installed under c:\j2sdk1.4.2_05. I would appreciate your help on this
issue, since I have been tortured by this problems for more than a week.
yours,
Rui
yes , me too . but when i use PHP4.3.x , it runs well . mybe there
aren't stable java support in PHP5 now.
--- End Message ---
--- Begin Message ---
i am note sure about php 4. but 5.0x works with mysql 4.1.7 if and only
if you use C:\Program Files\MySQL\MySQL Server 4.1\bin\libmysql.dll.
that's right, use this dll - overwrite current one in c:\php.
Phpwalter wrote:
Has anyone compiled the new DLL[s] for MySQL 4.1.7 and PHP 4.x?
Seems they changed the password encryption method and the current DDLs
don't work with new MySQL.
If so, can you post a link so I can pull them down?
Thanks
Walter
--- End Message ---
--- Begin Message ---
Hi,
I want to be able to display the results of some calculations as currency
such as £25.50, but round($var,2) produces £25.5.
I've tried writing my own function but that just fouled up the calculation.
Any tips or suggestions?
Cheers
George in Oxford
--- End Message ---