[PHP-DB] printf
Dear List - I am afraid that I am missing something in a major way. mysql printf(%b %d %f %s\n, 123, 123, 123, test); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'printf(%b %d %f %s\n, 123, 123, 123, test)' at line 1 Where is my mistake? The code above is copied from the MySQL manual!! And while we are on the subject of my ignorance. I wish to write to file named Site the letter A, and read it back. I wish to write to file named Starter the number 1000 , and read it back. How do I do it? I'd better ask these questions now, so when they come up in the next hour, I will not have to bother you with another email! Ethan MySQL 5.1 PHP 5 Linux [Debian (sid)] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] printf
Mysql doesn't have a printf function Regards Den 2010 10 29 00:47 skrev Ethan Rosenberg eth...@earthlink.net: Dear List - I am afraid that I am missing something in a major way. mysql printf(%b %d %f %s\n, 123, 123, 123, test); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'printf(%b %d %f %s\n, 123, 123, 123, test)' at line 1 Where is my mistake? The code above is copied from the MySQL manual!! And while we are on the subject of my ignorance. I wish to write to file named Site the letter A, and read it back. I wish to write to file named Starter the number 1000 , and read it back. How do I do it? I'd better ask these questions now, so when they come up in the next hour, I will not have to bother you with another email! Ethan MySQL 5.1 PHP 5 Linux [Debian (sid)] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] printf and unsecable char
2010/1/4 Chris dmag...@gmail.com: Jean-Philippe Battu wrote: Hello I would like to print a string formatted on the right side and fill in the left side with the unsecable character [nbsp;] I read in the printf command I could use : printf( %#30s , $mystring ) ; to display $mystring string with the character # before (on the left) and I try to replace # by nbsp; but I can't find a solution Do you know the solution to write the command: printf( %nbsp;30s , $mystring ) ; or something like that ! echo str_repeat('nbsp;', 30); (if I understand what you're trying to do correctly). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ?php $mystring = 'Hello, world!'; echo str_replace('#', 'nbsp;', str_pad($mystring, 30, '#', STR_PAD_LEFT)); ? outputs ... nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;Hello, world! -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] printf and unsecable char
Hello I would like to print a string formatted on the right side and fill in the left side with the unsecable character [nbsp;] I read in the printf command I could use : printf( %#30s , $mystring ) ; to display $mystring string with the character # before (on the left) and I try to replace # by nbsp; but I can't find a solution Do you know the solution to write the command: printf( %nbsp;30s , $mystring ) ; or something like that ! Best regards and take care ! -- Jean-Philippe Battu http://jeanpba.homeip.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] printf and unsecable char
Jean-Philippe Battu wrote: Hello I would like to print a string formatted on the right side and fill in the left side with the unsecable character [nbsp;] I read in the printf command I could use : printf( %#30s , $mystring ) ; to display $mystring string with the character # before (on the left) and I try to replace # by nbsp; but I can't find a solution Do you know the solution to write the command: printf( %nbsp;30s , $mystring ) ; or something like that ! echo str_repeat('nbsp;', 30); (if I understand what you're trying to do correctly). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] printf() in a variable, or alternative to
I need to be able to format data. Printf() is perfect because I need a certain amount of characters (30 for address). However I need this formatted data to be inside a file that's fwrite() and then FTPed to a distributor who will parse it and input into their database. printf(% 4d,$orderID[0]); does not work in $thisContent= data . moredate . evenmoredata . ; In effect I need the output of printf() to be placed inside a variable and I don't see how to do that. Str_pad(), of course, does not work. Thx for any hints. mayo
RE: [PHP-DB] printf() in a variable, or alternative to
Try sprintf(). -Original Message- From: mayo [mailto:[EMAIL PROTECTED] Sent: 27 May 2005 14:02 To: php-db@lists.php.net Subject: [PHP-DB] printf() in a variable, or alternative to I need to be able to format data. Printf() is perfect because I need a certain amount of characters (30 for address). However I need this formatted data to be inside a file that's fwrite() and then FTPed to a distributor who will parse it and input into their database. printf(% 4d,$orderID[0]); does not work in $thisContent= data . moredate . evenmoredata . ; In effect I need the output of printf() to be placed inside a variable and I don't see how to do that. Str_pad(), of course, does not work. Thx for any hints. mayo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] printf() in a variable, or alternative to printf()
I need to be able to format data. Printf() is perfect because I need a certain amount of characters (30 for address). However I need this formatted data to be inside a file that's fwrite() and then FTPed to a distributor who will parse it and input into their database. printf(% 4d,$orderID[0]); does not work in $thisContent= data . moredate . evenmoredata . ; In effect I need the output of printf() to be placed inside a variable and I don't see how to do that. Str_pad(), of course, does not work. Thx for any hints. sprintf() is your friend! http://us3.php.net/sprintf -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] printf() in a variable, or alternative to printf()
Are you looking for the sprintf() function? graeme mayo wrote: I need to be able to format data. Printf() is perfect because I need a certain amount of characters (30 for address). However I need this formatted data to be inside a file that's fwrite() and then FTPed to a distributor who will parse it and input into their database. printf(% 4d,$orderID[0]); does not work in $thisContent= data . moredate . evenmoredata . ; In effect I need the output of printf() to be placed inside a variable and I don't see how to do that. Str_pad(), of course, does not work. Thx for any hints. mayo -- Experience is a good teacher, but she sends in terrific bills. Minna Antrim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] printf() in a variable, or alternative to printf()
On Friday 27 May 2005 04:49, mayo wrote: I need to be able to format data. Printf() is perfect because I need a certain amount of characters (30 for address). However I need this formatted data to be inside a file that's fwrite() and then FTPed to a distributor who will parse it and input into their database. Use sprintf see: http://uk2.php.net/manual/en/function.sprintf.php Si -- ~~ Simon Rees | [EMAIL PROTECTED] | ORA-03113: end-of-file on communication channel ~~ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] printf() in a variable, or alternative to printf()
I need to be able to format data. Printf() is perfect because I need a certain amount of characters (30 for address). However I need this formatted data to be inside a file that's fwrite() and then FTPed to a distributor who will parse it and input into their database. printf(% 4d,$orderID[0]); does not work in $thisContent= data . moredate . evenmoredata . ; In effect I need the output of printf() to be placed inside a variable and I don't see how to do that. Str_pad(), of course, does not work. Thx for any hints. mayo
[PHP-DB] PrintF
Hello, I'm new to PHP and mySQL. I'm trying to find more info on printf. Specifically setting table properties, like height,width,background. Hoping someone can point me in the right direction. Thanks for the Help, Mike