
johnwayne77
Members-
Posts
156 -
Joined
-
Last visited
Never
Everything posted by johnwayne77
-
[SOLVED] any tutorial on how to use wordwrap function?
johnwayne77 replied to johnwayne77's topic in PHP Coding Help
ok, this works: $newtext = wordwrap($titlurez, 8, "\n", true); is better than chunk_split -
ok, this works: $newtext = wordwrap($titlurez, 8, "\n", true); is better than chunk_split
-
yeah, something dinamically indeed chunk_split maybe?
-
[SOLVED] any tutorial on how to use wordwrap function?
johnwayne77 replied to johnwayne77's topic in PHP Coding Help
well, that's what i want: the extra characters to brake up on the next line and so on. i already truncate the text to a specific length.. i got this solution: $string="7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777"; $row=chunk_split($string,50); echo("<table><tr><td width='100'>".$row.";</td></tr></table>"); what do you say? -
[SOLVED] any tutorial on how to use wordwrap function?
johnwayne77 posted a topic in PHP Coding Help
this is my problem: http://www.phpfreaks.com/forums/index.php/topic,238956.0.html i tried the wordwrap but it didn't help me anyone guru on that subject? it really screws up my project -
@gethinw: yeah, that is what i was looking for.. but no luck yet.. neither <wbr> nor wordwrap php function seems not to work or i don't know how to use it any advices?
-
yeah, if it were so easy.. my content is extracted from mysql...so no way of manual cutting... when the word is wider than 10px, it auto expands the table cell, screwing up my design... there must be something somewhere around to fix this issue, i'm sure.. i'm still searching oh, tell me more about the div solution..
-
well, it's kind of general let's say we havethis: <table> <tr> <td width=10px> 111111111111111111111111111111111111111111111111111 </td> </tr> </table> because the text 111111... is long charactered, it won't stop at 10px wide but it will wide as far as the text goes.. that screws up my design i dont have any solution yet
-
this is my problem: i have a table row which should be maximum 100px wide. this row is populated by text extracted from a database. sometimes words from this text are too long and exceeds the 100px width which screws up my design. any idea how i can brake up that word after 100px to a next line? thanks
-
it worked, cheers
-
thanks, i'll try that
-
how do i do that? i have : function f1($var) { .... $var1 = $someothervar; $var2 = $onemorevar; .... return $var1; return $var2; } i need to use $var1 and $var2 in the script ( i already use $var1 as following: foreach ($var1 as $scriptvar) { }
-
i have a function... my question is if i can have two returns at the end of it so i can use both value in my script
-
at last, i finished it. works fine this is the code <? $result = mysql_query("SELECT customers_id , customers_name , customers_email_address , billing_state , customers_telephone , COUNT(orders_id) AS number_of_orders FROM orders WHERE date_purchased >= '2008-12-01' AND date_purchased < '2008-12-25' GROUP BY customers_id HAVING number_of_orders >= 5 ORDER BY RAND() LIMIT 1 "); while($row = mysql_fetch_array($result)) { $cn = $row["customers_name"]; $ce = $row["customers_email_address"]; $ct = $row["customers_telephone"]; $co = $row["billing_state"]; $cc = $row["number_of_orders"]; } $query = mysql_query("SELECT * FROM tombola"); $queryrows = mysql_num_rows($query); while($row2 = mysql_fetch_array($query)); { if ($queryrows > 0) { $past = mysql_query("SELECT * from tombola"); while ($row4 = mysql_fetch_array($past)) { echo "Castigatorul tombolei de craciun a fost deja desemnat!<br>"; echo "Castigatorul este ".$row4['customers_name']." (".$row4["customers_email_address"].")<br><br>Oras: ".$row4["customers_telephone"]."<br>Telefon: ".$row4["billing_state"]." <br><br>".$row4["customers_name"]." a comandat ".$row4["number_of_orders"]." coduri!"; //} } }else { mysql_query("INSERT into tombola values ('$cn','$ce','$ct','$co','$cc')"); $now = mysql_query("SELECT * from tombola"); while ($row3 = mysql_fetch_array($now)) { echo "Castigatorul este ".$row3["customers_name"]." (".$row3["customers_email_address"].")<br><br>Oras: ".$row3["customers_telephone"]."<br>Telefon: ".$row3["billing_state"]." <br><br>".$row3["customers_name"]." a comandat ".$row3["number_of_orders"]." coduri!"; }} } ?> what do you think?
-
i got to this version: <? $result = mysql_query("SELECT customers_id , customers_name , customers_email_address , billing_state , customers_telephone , COUNT(orders_id) AS number_of_orders FROM orders WHERE date_purchased >= '2008-12-01' AND date_purchased < '2008-12-25' GROUP BY customers_id, customers_name, customers_email_address, billing_state, customers_telephone HAVING number_of_orders >= 5 ORDER BY RAND() LIMIT 1 "); while($row = mysql_fetch_array($result)); { $query = mysql_query("SELECT * FROM tombola"); $queryrows = mysql_num_rows($query); while($row2 = mysql_fetch_array($query)); { if ($queryrows > 0) { echo "Castigatorul tombolei de craciun a fost deja desemnat!<br>"; //$past = mysql_query("SELECT * from tombola"); // while ($row2 = mysql_fetch_array($past)) { echo "Castigatorul este ".$row2["customers_name"]."(".$row2["customers_email_address"].")<br><br>Telefon: ".$row2["customers_telephone"]."<br>Oras: ".$row2["billing_state"]." <br><br>".$row2["customers_name"]." a comandat ".$row2["number_of_orders"]." coduri!"; //} }else { $result2 = mysql_query("SELECT customers_id , customers_name , customers_email_address , billing_state , customers_telephone , COUNT(orders_id) AS number_of_orders FROM orders WHERE date_purchased >= '2008-12-01' AND date_purchased < '2008-12-25' GROUP BY customers_id, customers_name, customers_email_address, billing_state, customers_telephone HAVING number_of_orders >= 5 ORDER BY RAND() LIMIT 1 "); while($row5 = mysql_fetch_array($result2)); { mysql_query("INSERT into tombola values('".$row5['customers_name']."','".$row5['customers_email_address']."','".$row5['billing_state']."','".$row5['customers_telephone']."','".$row5['number_of_orders']." ')"); $now = mysql_query("SELECT * from tombola"); while ($row3 = mysql_fetch_array($now)) { echo "Castigatorul este ".$row3["customers_name"]."(".$row3["customers_email_address"].")<br><br>Telefon: ".$row3["customers_telephone"]."<br>Oras: ".$row3["billing_state"]." <br><br>".$row3["customers_name"]." a comandat ".$row3["number_of_orders"]." coduri!"; }} } }} ?> the if works ok... but when my table is zero i get an empty INSERT on all fields... any idea where is the mistake?
-
this is what i figure out by now: <? $result = mysql_query("SELECT customers_id , customers_name , customers_email_address , billing_state , customers_telephone , COUNT(orders_id) AS number_of_orders FROM orders WHERE date_purchased >= '2008-12-01' AND date_purchased < '2008-12-25' GROUP BY customers_id HAVING number_of_orders >= 5 "); while($row = mysql_fetch_array($result)); { $query = mysql_query("SELECT * FROM tombola"); $queryrows = mysql_num_rows($query); if ($queryrows > 0) { echo "Castigatorul tombolei de craciun a fost deja desemnat!<br>"; $past = mysql_query("SELECT * from tombola"); while ($row2 = mysql_fetch_array($past)) { echo "Castigatorul este ".$row2["customers_name"]."(".$row2["customers_email_address"].")<br><br>Telefon: ".$row2["customers_telephone"]."<br>Oras: ".$row2["billing_state"]." <br><br>".$row2["customers_name"]." a comandat ".$row2["number_of_orders"]." coduri!"; } }else { mysql_query("INSERT into tombola VALUES (".$row['customers_name'].", ".$row['customers_email_address'].", ".$row['billing_state'].", ".$row['customers_telephone'].", ".$row['number_of_orders'].") "); $now = mysql_query("SELECT * from tombola"); while ($row3 = mysql_fetch_array($now)) { echo "Castigatorul este ".$row3["customers_name"]."(".$row3["customers_email_address"].")<br><br>Telefon: ".$row3["customers_telephone"]."<br>Oras: ".$row3["billing_state"]." <br><br>".$row3["customers_name"]." a comandat ".$row3["number_of_orders"]." coduri!"; } } } ?> but something is wrong.. i echo nothing on the screen and the table doesn't update
-
here is my situation: i have a prepay online store and i advertised a contest to win a free code when buying at least 5 codes during 24.11-24.12 2008 period. now this is my table: orders_id customers_id customers_name customers_company customers_street_address customers_suburb customers_city customers_postcode customers_state customers_country customers_telephone customers_email_address customers_address_format_id delivery_name delivery_company delivery_street_address delivery_suburb delivery_city delivery_postcode delivery_state delivery_country delivery_address_format_id billing_name billing_company billing_street_address billing_suburb billing_city billing_postcode billing_state billing_country billing_address_format_id payment_method cc_type cc_owner cc_number cc_expires last_modified date_purchased orders_status orders_date_finished currency currency_value i don't have a sql logic to : select all orders depending on date_purchased field which is in '2008-11-21 21:47:45' format, then calculate total number of orders for each of the customers in that period, depending on customers_id and orders_id i guess, then make a list of the customers that have the number of orders above or equal to 5 and finally randomly select one. any ideas?
-
[SOLVED] foreach Array ( [0] => --- clean up
johnwayne77 replied to johnwayne77's topic in PHP Coding Help
this is my code <? include("functions.php"); $filename='fields.txt'; $handle = fopen($filename,'r'); while (($data = fgetcsv($handle)) !== FALSE) { $show = function1($data[0],$data[1]); print_r($show); } @fclose($handle); ?> fields.txt contains on each line following info: fielda1, fieldb1 fielda2, fieldb2 ...... the myfunction take fielda1, fieldb1 checks it with a database and returns the result linked to those. the problem is i get the result in the following appeareance: [4] => Array ( [0] => fielda4 [1] => fieldb4 ) i need to have printed only fieldb4 result (without [0][1][4]ARRAY).. -
[SOLVED] foreach Array ( [0] => --- clean up
johnwayne77 replied to johnwayne77's topic in PHP Coding Help
any ideas? -
[SOLVED] foreach Array ( [0] => --- clean up
johnwayne77 replied to johnwayne77's topic in PHP Coding Help
while (($data = fgetcsv($handle)) !== FALSE) { $show = myfunction($data[0],$data[1]); print_r($show); } -
how can i clean up my Array ( [.0.] => text1 [1] => text2 ) Array ( [.0.] => text3 [1] => text4 ) result? i just wanna print_r the text2, text4, etc result any ideas?
-
thanks for the php lesson dude! it worked, now i just need to clean up the array results, pack it up and it's ready to go cheers and happy holidays!
-
any idea why i get the result: "Array" ? i tested with the fields.txt in following format: "fieldA1","fieldB1" "fieldA2","fieldB2" and : fieldA1,fieldB1 fieldA2,fieldB2
-
i have a list of fieldA and fieldB as following: "fieldA1","fieldB1" "fieldA2","fieldB2" "fieldA3","fieldB3" stored in fields.txt now i need to put fieldA and fieldB in its own variables as following: $fielda = "fieldA1"; $fieldb = "fieldB1"; then run a function as following: $function = function($fielda,$fieldb); then run an echo as following: echo $function; how do i extract all fieldA and fieldB fields from fields.txt, apply the function to obtain the echo and create a loop to do that for all existent fieldA and fieldB any ideas, logical algorithm or advices much appreciated. thanks.