Re: [PHP] PHP with JAVA support
Jim Kirkpatrick wrote: Robert, Please include the php code you're using to instantiate the class. That will give me a better idea of what to suggest. Hi Jim, Thanks for the response. Here comes the code: ? phpinfo(); $system = new Java(java.lang.System); print Java version=.$system-getProperty(java.version). br\n; print Java vendor=.$system-getProperty(java.vendor). p\n\n; print OS=.$system-getProperty(os.name). . $system-getProperty(os.version). on . $system-getProperty(os.arch). br\n; $formatter = new Java(java.text.SimpleDateFormat,, dd, 'at' h:mm:ss a ); print $formatter-format(new Java(java.util.Date)).\n; ? Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Code check please
Andreas Skarin wrote: I've tried to get this working for over an hour now, and it still won't. I don't even get an error message to help me find the problem so I was hoping that someone could check my code for me. I'm fooling around with a basic form that is supposed to send one's name, surname and e-mail address to receive.php. receive.php is then supposed to take the information and add it to a table called tabell in a database called databas, but it doesn't work. I think there might be something wrong with my MySQL query. - - - - - - - - - - - FORM - - - - - - - - - - - - - - form action=receive.php method=post PFouml;rnamn:br input type=text name=fornamn size=25/p pEfternamn:br input type=text name=efternamn size=25/p pE-mailadress:br input type=text name=email size=25/p input type=submit name=submit value=Log in /form - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECEIVE.PHP - - - - - - - - - - - ?php // connection to MySQL $connection = mysql_connect(localhost, username, password); if (!$connection) { echo (PUnable to connect to the database server at this time./P ); exit(); } //select database if (! @mysql_select_db(databas) ) { echo (PUnable to locate the database at this time./P); exit(); } // MySQL query $sql = INSERT INTO tabell SET . fornamn ='$fornamn', . efternamn='$efternamn', . email='$email';; ? Hello, and where is the mysql_query($sql) function call? Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP with JAVA support
Hello, I'm trying to run PHP with Java support and don't get it to work. First I compiled PHP '--with-java=/usr/local/jdk1.2.2/'. Then I added this to the PHP.ini file: [Java] java.home=/usr/local/jdk1.2.2 java.class.path=/usr/local/lib/php/extensions/php_java.jar:/usr/local/jdk1.2.2/src.jar java.library.path=/usr/local/lib:/usr/local/jdk1.2.2/jre/lib/i386:/usr/local/jdk1.2.2/jre/lib/i386/classic:/usr/local /jdk1.2.2/jre/lib/i386/native_threads java.library=/usr/local/jdk1.2.2/jre/lib/i386/libjava.so java.extension=/usr/local/lib/php/extensions/libphp_java.so Now, when I try to instantiate a JAVA class I get this error: Fatal error: Cannot instantiate non-existent class: java in /usr/local/apache/htdocs/index.php on line 3. Does anybody have expirience with running JAVA with PHP? I don't know why it doesn't work. I use PHP 4.05 on a Debian Linux machine. Thanks. Robert
[PHP] PHP with JAVA support
Hello, I'm trying to run PHP with Java support and don't get it to work. First I compiled PHP '--with-java=/usr/local/jdk1.2.2/'. Then I added this to the PHP.ini file: [Java] java.home=/usr/local/jdk1.2.2 java.class.path=/usr/local/lib/php/extensions/php_java.jar:/usr/local/jdk1.2.2/src.jar java.library.path=/usr/local/lib:/usr/local/jdk1.2.2/jre/lib/i386:/usr/local/jdk1.2.2/jre/lib/i386/classic:/usr/local /jdk1.2.2/jre/lib/i386/native_threads java.library=/usr/local/jdk1.2.2/jre/lib/i386/libjava.so java.extension=/usr/local/lib/php/extensions/libphp_java.so Now, when I try to instantiate a JAVA class I get this error: Fatal error: Cannot instantiate non-existent class: java in /usr/local/apache/htdocs/index.php on line 3. Does anybody have expirience with running JAVA with PHP? I don't know why it doesn't work. I use PHP 4.05 on a Debian Linux machine. Thanks. Robert
[PHP] PHP with JAVA support
Hello, I'm trying to run PHP with Java support and don't get it to work. First I compiled PHP '--with-java=/usr/local/jdk1.2.2/'. Then I added this to the PHP.ini file: [Java] java.home=/usr/local/jdk1.2.2 java.class.path=/usr/local/lib/php/extensions/php_java.jar:/usr/local/jdk1.2.2/src.jar java.library.path=/usr/local/lib:/usr/local/jdk1.2.2/jre/lib/i386:/usr/local/jdk1.2.2/jre/lib/i386/classic:/usr/local /jdk1.2.2/jre/lib/i386/native_threads java.library=/usr/local/jdk1.2.2/jre/lib/i386/libjava.so java.extension=/usr/local/lib/php/extensions/libphp_java.so Now, when I try to instantiate a JAVA class I get this error: Fatal error: Cannot instantiate non-existent class: java in /usr/local/apache/htdocs/index.php on line 3. Does anybody have expirience with running JAVA with PHP? I don't know why it doesn't work. I use PHP 4.05 on a Debian Linux machine. Thanks. Robert
Re: [PHP] Counting Words In a String
Greg Donald wrote: I want to check a string and return the amount of words present in it. These strings could be quite large, some higher than 100,000 characters. I realize I could explode the string on the whitespace and count the number of values. However, I'm not sure this would be the most optimized way to do this, especially considering there will be some quite large strings passed. Any ideas on the most efficient to count the number of words in a large string? $string = Here is a very long string; $array = explode( , $string); $count = sizeof($array); echo $count; Hello, Greg, Jason asked for an _optimized_ solution. Solution: 1. If you're using PHP=4.02 just take the substr_count() function (see manual). 2. Otherwise you can take this code: $count=0; for($x=0;$xstrlen($string);$x++) if(substr($string,$x,1)== ) $count++; if($count0) $count++; Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] checkbox validation
Jacky wrote: Hi all I have a form with the checkbox like this form $query="select id from foo"; $result=($query,$con); while ($row = mysql_fetch_array($result)) { input type="checkbox" name="$id" value="on" } submit button and stuffs here... /form One possibility: Add a hidden field in the form and write all names of the checkboxes in it, separated by a semicolon, for example. - form $query="select id from foo"; $result=($query,$con); while ($row = mysql_fetch_array($result)) { input type="checkbox" name="$id" value="on" $names_of_checkboxes.=$id.";"; } input type="hidden" name="names_of_checkboxes" value="? echo $names_of_checkboxes; ?" submit button and stuffs here... /form --- Then, in the next page you just do following: --- $checkboxes_names_array=explode(";",$names_of_checkboxes); for($x=0;xcount($checkboxes_names_array);$x++) { if($$checkboxes_names_array[$x]=="on") // box checked } --- Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Back Button Dilemma's
RealGM wrote: Hi Guys, I know everywhere it says that it is not possible to actually disable the back button, and people have offered some solutions that have not worked for me, this is why I am emailing this list. I have a form which displays the same page with new content (controlled by a counter) in a loop until an exit point is reached. When the user clicks back on the browser the counter still increments and the screen continues like the user pressed the continue button (which is the process I want the user to take). The problem is the user did not make a selection and this is where the problem lies (it takes the default, which throws the whole process out of whack). Before I can help you: How did you programm the counter? Do you forward it in a HTML-form to the PHP script? Or do you use the counter only server-side? Please attach the code. Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] freetype info required
Could someone please supply me with a little information about freetype fonts concerning the following points of interest: 1/ A good description of what it actually is. 2/ How to actually use it in a practical sense hopefully in conjunction with php. 3/ Supply of some small code snippets showing real world examples. 4/ Any freetype library functions. I thank you all in advance for any help that you can grtant to me. Joe :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Better way (if...elseif...else)
"Ashley M. Kirchner" wrote: Is there a better way to write the following snippet: if ($priority == "000") { $fcol="high"; $pstr .= "option value=\"000\" selectedHigh\n"; $pstr .= "option value=\"050\"Medium\n"; $pstr .= "option value=\"100\"Low\n"; } elseif ($priority == "050") { $fcol="med"; $pstr .= "option value=\"000\"High\n"; $pstr .= "option value=\"050\" selectedMedium\n"; $pstr .= "option value=\"100\"Low\n"; } else { $fcol="low"; $pstr .= "option value=\"000\"High\n"; $pstr .= "option value=\"050\"Medium\n"; $pstr .= "option value=\"100\" selectedLow\n"; } $p_arr=array("000","050","100"); $fc_arr=array("high","med","low"); $ptext_arr("High","Medium","Low"); for($x=0;$xcount($p_arr);$x++) { $pstr.="option value=\"$p_arr[$x]\" "; if($priority==$p_arr[$x]) { $pstr.="selected"; $fcol=$fc_arr[$x]; } $pstr.="$ptext_arr[$x]\n"; } You could optimize the code even more if you'd throw $fc_arr away and use $ptext_arr instead. Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP Editor for Linux
Martin Cabrera Diaubalick wrote: Hi there! I use bluefish for HTML and PHP coding, but I'm not too happy with it. Do you know a good PHP Editor for Linux, besides Emacs and xjed...? Try nedit... Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Complex mysql query
Yann Larrive wrote: Thanks for the answer but it is a bit more complexe, i actually creates these sample table for the example. Here is an attachement of the structure dump. Hummm you got me to think more about my database structure withc is really good. The idea you bourght up seems really good. I am a junior developper, actually only been 2 month i really program soi now have more experience then i used to have spacially when people like yuo give me tricks , this really helps me out :-) CREATE TABLE produits ( PID varchar(5) NOT NULL, Why a VARCHAR? Numeric values (INT) are better. titre tinytext NOT NULL, description text, artiste tinyint(3) NOT NULL, Artiste reference number see the artiste table TINYINT has value range from -128 to 127. It's too small for an ID. How man artists will your database have? image varchar(5) NOT NULL, Image name num_page smallint(5),Number of page if a book duree smallint(4),Length if video or cd, tape ... format tinyint(3) NOT NULL,Format of the product hardcover softcover, tape , cd, dvd You better use ENUM instead: format ENUM('softcover','hardcover',...) ISBN smallint(10),ISBN number or serial number A SMALLINT is not enought for an ISBN number. I must be an INT at least, or even an BIGINT. Check it out in the manual. quantite tinyint(3) NOT NULL,Stock quantity What if you have more then 127 on the stock? see artiste... fournisseur tinyint(4) NOT NULL,Provider ID number prix float NOT NULL,Our sales prices retail float NOT NULL,Retail Price UNIQUE PID (PID) UNIQUE PID (PID) ); CREATE TABLE artiste ( ID smallint(5) unsigned NOT NULL auto_increment, artiste ID number nom varchar(15) NOT NULL, artiste name UNIQUE ID (ID) ); CREATE TABLE fournisseurs ( My provider table ID tinyint(5) unsigned NOT NULL auto_increment,Provider ID Nom varchar(20) NOT NULL, Provider Name adresse1 varchar(50) NOT NULL, addresse1 adresse2 varchar(50), address2 ville varchar(20) NOT NULL, city province varchar(20) NOT NULL, state/province pays varchar(30) NOT NULL, country telephone varchar(20) NOT NULL, phone number fax varchar(20), fax email varchar(25), site_web varchar(30), website pers_ressources varchar(40), person to contact num_compte varchar(20) NOT NULL, account number code_postal varchar(7) NOT NULL, Postal code UNIQUE ID (ID) ); I got more tables but the others are not interesting in the specific query i want to make. SELECT artist.name,produits.name,provider.name FROM artist LEFT JOIN produits ON artist.ID=produits.artist_ID LEFT JOIN provider ON produits.provider_ID=provider.ID WHERE provider.name LIKE 'some_name'; Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] help gurus: multi-dimensional array problem.
andrew wrote: Because I want to display it like this: category1 (href anchor to category1 below) category2 category3 category1 link1 link2 link3 category2 link1 etc... Hello, Ever heard of mysql_data_seek()? Have a look in the PHP Docs. Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] dealing with no record
"Jacky@lilst" wrote: People If I run a sniplet like this: ** $query="select name from foo"; $result= mysql_query($query); while($row = mysql_fetch_row($result)) stuff...to display record found ... *** what am I suppose to do if I also want the code to be able to deal with the case that no record found and redirect user to other page? Hello, In the PHP Manual, section MySQL, there is a description of a function called mysql_num_rows()... Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] help gurus: multi-dimensional array problem.
Tim Ward wrote: Get a list of unique categories then get a list of each one would do it. $link_id = mysql_connect($host, $usr, $pass) or die (mysql_error()); mysql_select_db($database, $link_id); $sql="select distinct category from links"; $result = mysql_query($sql, $link_id) or die ("no results"); $cat_list = new Array(); while ($row=mysql_fetch_array($result)) { $cat_list[] = $row["category"]; echo("a href=\"$PHP_SELF?#$category\"$category/font/abr"); }; foreach ($cat_list as $this_Cat) { echo("a name=\"$category\"$this_Cat/font/abr"); $sql="select name, url from links where category = '$this_Cat'"; $result = mysql_query($sql, $link_id); while ($row=mysql_fetch_array($result)) { echo ("a href='" . $row[url] . "'" . $row["name"] . "/abr"); }; } haven't tested this but the principal should be okay and do what you're after Tim Ward Senior Systems Engineer Hello, This sulution is not very good: too many SELECTs, too much memory usage... Why not just use 2 Tables: Category and Links, and work with a LEFT JOIN? Then you could get all data needed with a single SQL statment, no additional arrays would be needed, either. Don't forget: MySQL is a RELATIONAL database - Why not make usage of it? Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HREFs that can't be
"Boget, Chris" wrote: That won't work. Clicking on a link does not trigger sending of fields (hidden or not). No? How about: form name=myForm method=post action=... input bla bla bla... /form a href="javascript:document.myForm.submit();"Click here/a a href="#" onclick="document.myForm.submit();return false;"or here/a This would require a form for every link and that was something I illustrated earlier as one of the possibilities I had come up with. But it was a possibility that I was trying to avoid... Chris No, you could do following: a href="javascript:document.myForm.action='theLink';document.myForm.submit();"Click here/a ...for each link. And you'd have one single form. BTW. In you first email you wrote: "plan they are pushing is to make our site(s) free of all GET variables". Who are "they"? Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HREFs that can't be
"Boget, Chris" wrote: This would require a form for every link and that was something I illustrated earlier as one of the possibilities I had come up with. But it was a possibility that I was trying to avoid... No, you could do following: a href="javascript:document.myForm.action='theLink';document.myF orm.submit();"Click here/a ...for each link. And you'd have one single form. It couldn't be that generic because as I pointed out in my initial email, each link can have a variable number of GET variables and not all of them would have the same name (though, some would). Then you'd have to insert hidden fields for all possible variables in the form. BTW. In you first email you wrote: "plan they are pushing is to make our site(s) free of all GET variables". Who are "they"? My superiors. I bet they have nothing better to do than to say: "What are those funny characters next to the internet address? We don't like them. They don't let our site look seriously. And we _are_ a very serious company. They must diappear right away!!" Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Newbie question about running JAVA classes on PHP scripts
Federico Ragazzoni wrote: Hi all, I've a problem with my php.ini file, running JAVA classes... What exactly should write in php.ini? I've JDK in /usr/local/jdk and PHP in /usr/local/php Would you explain us, what does (or should) php.ini have to do with JAVA? Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] A small Q
Harshdeep S Jawanda wrote: Hi, Does the extension of files that are require()-d or include()-d in PHP have to be ".inc"? Can it be ".php"? All examples seem to show this extension as ".inc". Could there be any problems if the extension is kept ".php"? I don't know what examples you mean, but: the name of the included/required file in PHP does not matter. However the best thing is always to use the extention "*.php" to make sure the files are always going thru the PHP interpreter, even when someone access them directly by its URL. Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] how do i check if a server is online ?
"Markus H. Maussner" wrote: hi.. i have the problem that i need to connect to a database on a server wich is quiet often offline. how can i connect to this database (mysql) and can check if the server is online. like.. if server is online - fine we work as normaly if server is NOT online - print out message and say "server offline try later" i tried something like mysql_connect and then die ... but it takes approx 5 mins.. till i get the message.. do i have to set the timeout lower? and if yes.. how do i do that ? You could use ping command like this: exec("ping -c 4 TheServer",$out_arr); ...and evaluate the $out_arr to see if the ping command was successful. Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Get name of current function
"Ide, Jim" wrote: Hi - Is there some way I can get the name of the currently executing function? For example: ?php function MyFunction () { echo "The currently executing function is: " . here ; } Solution: function MyFunction () { echo "The currently executing function is: MyFunction()" ; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]