[PHP-DB] printf

2010-10-28 Thread Ethan Rosenberg

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

2010-10-28 Thread Peter Lind
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-01-05 Thread Richard Quadling
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

2010-01-04 Thread Jean-Philippe Battu

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

2010-01-04 Thread Chris

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

2005-05-27 Thread mayo
 
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

2005-05-27 Thread N . A . Morgan
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()

2005-05-27 Thread Philip Hallstrom

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()

2005-05-27 Thread graeme

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()

2005-05-27 Thread Simon Rees
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()

2005-05-26 Thread mayo
 
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

2001-03-27 Thread Mike Baerwolf

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