[PHP] displaying result problem
Hi, I have little problem while displaying a result from one simple querry. If i insert values into mysql DB in following order (12, 3, 14, 4 ) I allways have ( 12, 14, 3, 4 ) displaying when query the DB. (same with letters - dcba - abcd etc) I would like to be able to display the data like they are inserted into database. Any help is welcome, Thanks
[PHP] split line of text
Hi, if chunk_split function split the line of text (here on 50 char) I was wondering if there exists one function who take care if the 50 char is in the middle of the word and split the line first empty space before the word or just after? $newstring = chunk_split($row[1], 50, 'br /'); echo $newstring; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] split line of text
Le 27-sept.-05 à 23:52, Philip Hallstrom a écrit : http://us3.php.net/manual/en/function.wordwrap.php thanks a lot! $newtext = wordwrap($row[1], 50, br /\n); echo $newtext; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] really basic question
Hi folks, It is permited to do something like this in the functions body ? function test() { print(tralala); do_some_stuff(); ? table id=conex width=167 border=0 cellspacing=0 cellpadding=0 ? print(test function continue here or not?); waiting_answer(); print(thanks a lot); } ? Thanks a lot, ADI -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to divide string
Hi, is there any magic function who can give me from: $string = abcdefghijklmnopqrstuwvxyz; somthing like this: abcd efgh ijkl mnop qrst uwvx yz (each 'x' letters go to the next line) Thanks a lot, ADI -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Java - toString() - php - ?
Rory Browne a écrit : I haven't a monkies what that code(your java) does, and I don't have time to analyse it(in expensive cybercafe), but you may want to consider www.php.net/print-r www.php.net/var-dump and www.php.net/var-export I think they may do what you want without using the toString method, which for what you're describing is basicly an ugly hack. One more thing: Enlighten me: What exactly do you mean by live evolution in your php/java context. If in php context you have class, say, A: class A { var $t1; var $t2; var $t3; //After, you have object contructor of type A //we have something like this function A ($var1, $var2, $var3) { $this - t1 = $var1; $this - t2 = $var2; $this - t3 = $var3; } some other code } //than in some other class we have something like this: class someOtherClass { $aConstructor = new A(1,2,3); //values of t1, t2 and t3 are 1,2 and 3 now } Right? yes. How you can you do something like this inside of someOtherClass print ($aConstructor); to finally have some nice output like Value of t1 is 1; Value of t2 is 2; Value of T3 is 3; or just: 1 2 3 Without creating functions like getValues() function getValues() { print ($this - t1); print ($this - t2); print ($this - t3); } and after explicit invoke function: $aConstructor - getValues(); So, what I want is this: print ($aConstructor); and not this: $aContructor - getValues(); Am I clear :-) ADI -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php-mySQL insert problem
Hi, I'm new in php so like usual I have little problem(s). I have DB clas who connect to database, select database, query database and so on. I have other class User with some members. exemple: ... var $firstName; var $lastName; ... Then I need to insert created object into mySQL database doing something like this: INSERT into TABLE values ($this - firstName, $this - lastName); I do that this way: $insertQuery = Insert into TABLE values (.$this - firstName.,.$this - lastName)); $db = new DB; $db - query($insertQuery); this is not working and I have next message: Parse error: parse error, unexpected T_OBJECT_OPERATOR in /Library/Apache2/htdocs/Users.php on line 80 I think that my error is in escape characters and I dont not know hox to resolve my problem. Any help is welcome. Thanks in advance ADI -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SOLVED - [PHP] php-mySQL insert problem
Jack Scott a écrit : Try this: $insertQuery = Insert into TABLE ( col_one, col_two )values ( ' . $this - firstName . ', ' . $this- lastName . ' ); $db = new DB; $res = $db-query($insertQuery); if(DB::isError($res)){ exit(Insert query failed: .__FUNCTION__.() brin file .__FILE__.bron line .__LINE__.br.$res-getDebugInfo()); }else{ return; } you need to have quotes arround your varchar items and you should also specify which column you want the values to go into. Yess! That's the right one :-) It is also good practice to check if there is an error and try to get the most information available. DB class do the right thing with try/catch. THANK YOU VERY VERY MUCH Jack Scott! ADI -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Java - toString() - php - ?
To print state of object in Java I can define toString() function and then I can do something like this: Java exemple: * import java.io.*; import java.util.*; public class ReadTextFromFile { private static String line; private static String Fable = new String (); private static String NomFable; private static int cptLine = 0; private static int nbrPersonnes = 0; private static String nomPersonnes = new String (); private static ArrayList AListe = new ArrayList(nbrPersonnes); //** public String toString() { return getClass().getName() + [ Nom de la fable: + NomFable + == Nombre de personnes dans dialogue: + nbrPersonnes + ] ; } *** Is there similar kind of function in php that help us to print the state of object in his life evolution? Thanks ADI -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php