[PHP-DB] Formatting - Solved

2012-11-26 Thread Ethan Rosenberg, PhD

Dear list

Here is the answer

ORIGINAL

centerbSearch Results/b/centerbr /
center
!--  This is the block that prints about one screen full down bellow 
the Search Results header --


table border=4 cellpadding=5 cellspacing=55  rules=all 
frame=box style=table-layout: fixed;

tr class=heading
thSite/th
thMedical Record/th
thFirst Name/th
thLast Name/th
thPhone/th
thHeight/th
thSex/th
thHistory/th
thBirthday/th
thAge/th
/tr
/div

?php $i = 0;
do
{
{
$vara2 = array(array($Site, $MedRec, $Fname, 
$Lname, $Phone, $Height, $Sex, $Hx, $Bday, $Age));


$vara2[$i][0]= $Site;
$vara2[$i][1]= $MedRec;
$vara2[$i][2]= $Fname;
$vara2[$i][3]= $Lname;
$vara2[$i][4]= $Phone;
$vara2[$i][5]= $Height;
$vara2[$i][6]= $Sex;
$vara2[$i][7]= $Hx;
$vara2[$i][8]= $Bday;
$vara2[$i][9]= $Age;

echo tr\n;
$_SESSION['exe'] = 2;
?
td ?php echo $vara2[$i][0]? /tdbr /
td ?php echo $vara2[$i][1]? /tdbr /
td ?php echo $vara2[$i][2]? /tdbr /
td ?php echo $vara2[$i][3]? /tdbr /
td ?php echo $vara2[$i][4]? /tdbr /
td ?php echo $vara2[$i][5]? /tdbr /
td ?php echo $vara2[$i][6]? /tdbr /
td class=first-col?php echo $vara2[$i][7] ?/tdbr /
td ?php echo $vara2[$i][8]? /tdbr /
td ?php echo $vara2[$i][9]? /tdbr /
?php echo /tr\n;
$i = $i +1;

}
} while (mysqli_stmt_fetch($stmt)); //end do-while
$imax = $i;
echo /table;
echo /center;
echo /form;

}//end count($errors_array)


THIS IS THE CORRECTED VERSION:

if(count($errors_array) == 0)
{
?

centerbSearch Results/b/centerbr /
center
table border=4 cellpadding=5 cellspacing=55  rules=all 
frame=box style=table-layout: fixed;

tr class=heading
thSite/th
thMedical Record/th
thFirst Name/th
thLast Name/th
thPhone/th
thHeight/th
thSex/th
thHistory/th
thBirthday/th
thAge/th



?php $i = 0;
do
{
{

$vara2 = array(array($Site, $MedRec, $Fname, 
$Lname, $Phone, $Height, $Sex, $Hx, $Bday, $Age));

$vara2[$i][0]= $Site;
$vara2[$i][1]= $MedRec;
$vara2[$i][2]= $Fname;
$vara2[$i][3]= $Lname;
$vara2[$i][4]= $Phone;
$vara2[$i][5]= $Height;
$vara2[$i][6]= $Sex;
$vara2[$i][7]= $Hx;
$vara2[$i][8]= $Bday;
$vara2[$i][9]= $Age;
//echo tr\n;
$_SESSION['exe'] = 2;
?


tr
td ?php echo $vara2[$i][0]? /td
td ?php echo $vara2[$i][1]? /td
td ?php echo $vara2[$i][2]? /td
td ?php echo $vara2[$i][3]? /td
td ?php echo $vara2[$i][4]? /td
td ?php echo $vara2[$i][5]? /td
td ?php echo $vara2[$i][6]? /td
td class=first-col?php echo $vara2[$i][7] ?/td
td ?php echo $vara2[$i][8]? /td
td ?php echo $vara2[$i][9]? /td
?php echo /tr\n;
$i = $i +1;
}
} while (mysqli_stmt_fetch($stmt)); //end do-while
$imax = $i;
echo /table;
echo /center;
echo /form;
?

?php
}//end count($errors_array)


NOTE THE ABSENCE OF the br / AFTER EACH td LINE

That was the problem!!!

Ethan


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Formatting

2012-11-25 Thread Ethan Rosenberg, PhD

Dear list -

When I run the following code, the results are preceded by at least one 
screen full of blank lines. I am showing you a large code block since I 
do not know where the error is:


if(isset($_REQUEST['Sex']) trim($_POST['Sex']) != '' )
{
if ($_REQUEST['Sex'] === 0)
{
$sex = 'Male';
}

else
{
$sex = 'Female';
}

 }
$allowed_fields = array
('Site' = 's',  'MedRec' = 'i', 'Fname' = 's', 
'Lname' = 's','Phone'= 's',   'Height' = 'i',   'Sex' = 's',

'Hx' = 's','Bday' = 's',  'Age' = 'i'
);

if(empty($allowed_fields))
{
 echo ouch;
}

// Configure the query and the acceptable params to put 
into the WHERE clause

$sql12 = 'SELECT * FROM Intake3 WHERE 1';

   // Magically put everything together
$types = '';
$args = array();
foreach( $allowed_fields as $k = $type )
{
 if( !array_key_exists( $k, $allowed_fields ) )
continue;
else
{
if( ($_POST[$k]) != '')
{
$args[] = $_POST[$k]; // Note the addition of 
the ampersand here

$types .= $type;
$sql12 .=  AND ($k = ?);
}
}
}
$stmt = mysqli_stmt_init($cxn);
mysqli_stmt_prepare( $stmt, $sql12 );

if( !$stmt )
throw new Exception( 'Error preparing statement' );

// Put the statement and types variables at the front of 
the params to pass to mysqli_stmt_bind_param()
array_unshift( $args, $stmt, $types ); // Note that I've 
moved this call. Apparently it doesn't pass back the result. I guess 
sometimes I just forget these things.


// mysqli_stmt_bind_param()
if( !call_user_func_array( 'mysqli_stmt_bind_param', $args ) )
throw new Exception( 'Failed calling mysqli_stmt_bind_param' );

if( !mysqli_stmt_execute( $stmt ) )
throw new Exception( 'Error while executing statement' );

mysqli_stmt_bind_result( $stmt,  $Site, $MedRec, $Fname, 
$Lname, $Phone, $Height, $Sex, $Hx, $Bday, $Age);





if(count($errors_array) == 0)
{


?
centerbSearch Results/b/centerbr /
center
!--  This is the block that prints about one screen full down bellow 
the Search Results header --


table border=4 cellpadding=5 cellspacing=55  rules=all 
frame=box style=table-layout: fixed;

tr class=heading
thSite/th
thMedical Record/th
thFirst Name/th
thLast Name/th
thPhone/th
thHeight/th
thSex/th
thHistory/th
thBirthday/th
thAge/th
/tr
/div

?php $i = 0;
do
{
{
$vara2 = array(array($Site, $MedRec, $Fname, 
$Lname, $Phone, $Height, $Sex, $Hx, $Bday, $Age));


$vara2[$i][0]= $Site;
$vara2[$i][1]= $MedRec;
$vara2[$i][2]= $Fname;
$vara2[$i][3]= $Lname;
$vara2[$i][4]= $Phone;
$vara2[$i][5]= $Height;
$vara2[$i][6]= $Sex;
$vara2[$i][7]= $Hx;
$vara2[$i][8]= $Bday;
$vara2[$i][9]= $Age;

echo tr\n;
$_SESSION['exe'] = 2;
?
td ?php echo $vara2[$i][0]? /tdbr /
td ?php echo $vara2[$i][1]? /tdbr /
td ?php echo $vara2[$i][2]? /tdbr /
td ?php echo $vara2[$i][3]? /tdbr /
td ?php echo $vara2[$i][4]? /tdbr /
td ?php echo $vara2[$i][5]? /tdbr /
td ?php echo $vara2[$i][6]? /tdbr /
td class=first-col?php echo $vara2[$i][7] ?/tdbr /
td ?php echo $vara2[$i][8]? /tdbr /
td ?php echo $vara2[$i][9]? /tdbr /
?php echo /tr\n;
$i = $i +1;

}
} while (mysqli_stmt_fetch($stmt)); //end do-while
$imax = $i;
echo /table;
echo /center;
echo /form;

}//end count($errors_array)

Help and advice, please

Ethan


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] formatting a word doc using php ?

2010-09-20 Thread Richard Quadling
On 17 September 2010 21:41, Vinay Kannan viny...@gmail.com wrote:
 Hello Xperts,

 I am trying out a couple of things and have come across this requirement,
 where in a php script should create a doc file with specific formatting, I
 can create the file, havent tried it yet, but shouldnt be a problem I guess,
 but how do I format the doc file is the question, google search didnt give
 good results too :( So not even sure if it can be done actually.

 Thanks,
 Vinay


Depending upon the version of document you want to create you have 3
mechanisms available.

1 : To use the older style doc format which is a proprietary binary
format controlled by Microsoft and has been reversed engineered (to a
degree) by various developers and you can find many instances of
php/word tools.
2 : To use the newer style xml format which is fully human readable.
3 : Use PHP's COM interface to interact with an instance of MS Word.

Each has its merits and really depends upon how complex you want to go.

For example, option 3 allows you to do everything that you can do
manually. If you can record a macro doing it in Word, then you can
script it in PHP. Learning a little bit about TypeLibraries and
reading the VBA documentation for Word will certainly help you there.
The main downside here is you need to have a license for Word and to
be using Windows. I use PHP's COM for interacting with Crystal Reports
Developer Edition. I've not built a report from scratch using PHP, but
that is available to me. Just like it is with MS Word. Using a
template, you can easily use PHP's COM to talk to Word, create a new
document from the template, do search and replace of bookmarks with
text and finally save the document.

Below is an example of reading a word count from a document called
Z:\5words.doc.

?php
ini_set('com.autoregister_casesensitive', 1); // Optional. When set
wdPropertyWords does NOT equal WDPROPERTYWORDS
ini_set('com.autoregister_typelib', 1); // Auto registry the loaded
typelibrary - allows access to constants.
ini_set('com.autoregister_verbose', 0); // Suppress Warning:
com::com(): Type library constant emptyenum is already defined in $s
on line %d messages.

$o_Word = new COM('Word.Application') or die('Cannot load MS Word');
$o_Word-Visible = 0;

$o_Doc = $o_Word-Documents-Open('z:/5words.doc');
echo 'There are ', $o_Doc-BuiltInDocumentProperties(wdPropertyWords),
' word(s) in this document.';
$o_Doc-Close(False);
$o_Word-Quit();
unset($o_Doc);
unset($o_Word);
?

Using Option 2 means learning how MS have defined their document.
Styling, etc. isn't like it is in old style HTML (bbold/b), but
more like (but not exactly) using CSS tags (p class=boldbold/p).


Using Option 1 means you will be limited to whatever has been reverse
engineered. And when the binary format changes (though less likely now
due to the XML route), then you'd have to be waiting on the developer
to fix the code first.


If XML is in your capability, then I'd go with that at a first
attempt, then the third party class and finally the COM.

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] formatting a word doc using php ?

2010-09-17 Thread Vinay Kannan
Hello Xperts,

I am trying out a couple of things and have come across this requirement,
where in a php script should create a doc file with specific formatting, I
can create the file, havent tried it yet, but shouldnt be a problem I guess,
but how do I format the doc file is the question, google search didnt give
good results too :( So not even sure if it can be done actually.

Thanks,
Vinay


RE: [PHP-DB] formatting a word doc using php ?

2010-09-17 Thread Ashay Chaudhary
http://phpword.codeplex.com/

I haven't used it myself, but it is open source (LGPL) so you can check out the 
code and tweak it as necessary. It's based on the PHPExcel work done by 
Maarten, who's an incredibly smart guy.

: Ashay

-Original Message-
From: Vinay Kannan [mailto:viny...@gmail.com] 
Sent: Friday, September 17, 2010 1:42 PM
To: PHP DB
Subject: [PHP-DB] formatting a word doc using php ?

Hello Xperts,

I am trying out a couple of things and have come across this requirement, where 
in a php script should create a doc file with specific formatting, I can create 
the file, havent tried it yet, but shouldnt be a problem I guess, but how do I 
format the doc file is the question, google search didnt give good results too 
:( So not even sure if it can be done actually.

Thanks,
Vinay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] formatting a word doc using php ?

2010-09-17 Thread Aleksei Sapunov
Guys, is it a joke?
May be you need to choose right list carefully?

2010/9/18 Ashay Chaudhary ash...@microsoft.com

 http://phpword.codeplex.com/

 I haven't used it myself, but it is open source (LGPL) so you can check out
 the code and tweak it as necessary. It's based on the PHPExcel work done by
 Maarten, who's an incredibly smart guy.

 : Ashay

 -Original Message-
 From: Vinay Kannan [mailto:viny...@gmail.com]
 Sent: Friday, September 17, 2010 1:42 PM
 To: PHP DB
 Subject: [PHP-DB] formatting a word doc using php ?

 Hello Xperts,

 I am trying out a couple of things and have come across this requirement,
 where in a php script should create a doc file with specific formatting, I
 can create the file, havent tried it yet, but shouldnt be a problem I guess,
 but how do I format the doc file is the question, google search didnt give
 good results too :( So not even sure if it can be done actually.

 Thanks,
 Vinay

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Formatting output with json_encode

2008-07-14 Thread Ron Piggott
I am using json_encode to output the results of a mySQL query which is
part of a jquery  ajax.  

$result = json_encode($array);
echo $result;

The output on my screen is:

{0:John 14:27,verse_reference:John 14:27}

How do I format json_encode output?  I would like 

John 14:27

to be what is displayed.

Ron


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Formatting output with json_encode

2008-07-14 Thread Evert Lammerts
Check out http://www.json.org/ for JSON structures.

In javascript an Array object is a special implementation of the
Object object (like all objects other than Object) - an Array object
can only have numerical indices, an Object object can have textual
indices too. If you json_encode a php array with textual indices it
translates to {...} - a javascript Object object. If you json_encode a
php array with numerical indices it translates to [...] - a javascript
Array object.

It seems to me that what you're using is mysql_fetch_array
(http://nl3.php.net/manual/en/function.mysql-fetch-array.php) with
either no result_type parameter set, or result_type set to MYSQL_BOTH.
If you want a javascript Array object, use either
mysql_fetch_array($result, MYSQL_NUM) or mysql_fetch_row($result). If
you want a javascript Object object, use either
mysql_fetch_array($result, MYSQL_ASSOC) or mysql_fecth_assoc($result).

Evert

On Mon, Jul 14, 2008 at 8:21 AM, Ron Piggott [EMAIL PROTECTED] wrote:
 I am using json_encode to output the results of a mySQL query which is
 part of a jquery  ajax.

 $result = json_encode($array);
 echo $result;

 The output on my screen is:

 {0:John 14:27,verse_reference:John 14:27}

 How do I format json_encode output?  I would like

 John 14:27

 to be what is displayed.

 Ron


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Formatting in Text Area

2008-02-02 Thread bedul
i'm just add Tobias script.

put rtrim and ltrim to have a better result.


- Original Message -
From: Tobias Franzén [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Friday, February 01, 2008 10:24 PM
Subject: Re: [PHP-DB] Formatting in Text Area


 Hi Patricia,

 You can impose width restrictions on the textarea field
and forcefully
 wrap lines longer than the desired length afterwards (if
you save it,
 save it as-is for better portability). To wrap text with
PHP when you
 print it, or want to send the e-mail, there is a function
called
 wordwrap(). Be sure to split the string at every line
break though.

 Using white-spaces for formating will only work if your
output of the
 text is with a fixed-width font. The pre html tag will
do this for
 you, but it won't look pretty. Use CSS to style it is my
advise.

 Something to bear in mind with regards to e-mail is that
the standard
 line width is 72 characters if I remember correctly.

 Comparison of fixed-width fonts
 http://www.cfcl.com/vlb/h/fontmono.html

 Example code (not tested, so I'm not sure it will run
as-is):
 ?php
 $text = $_POST[textareainput];
 $long_lines = split(\n, $text);
 $split_text = ;
 $width = 72;
 foreach ($long_lines as $oneline) {
$split_text = $split_text . wordwrap($oneline, $width,
\n) . \n;
 }
 // $split_text will have one more newline at the end than
what you
 started with, so let's clean it up
 $split_text = substr($split_text, 0, -1);
 echo pre . $split_text . /pre;
 // or
 echo nl2br($split_text);
 ?

 /Tobias

 VanBuskirk, Patricia wrote:
  Sorry, I had sent this first to my FileMaker list, but
then realized it
  was probably more html/php related than database
related.  FMP is for
  FileMaker Pro.
 
  Can you give me an example of your suggestion?  I am
still quite new at
  php and learn much better by example.
 
  Thanks Evert!
 
  Trish
 
  -Original Message-
  From: Evert Lammerts [mailto:[EMAIL PROTECTED]
  Sent: Friday, February 01, 2008 8:21 AM
  To: VanBuskirk, Patricia
  Cc: php-db@lists.php.net
  Subject: Re: [PHP-DB] Formatting in Text Area
 
  VanBuskirk, Patricia wrote:
 
  I have a customer description text area field on my
form which feeds
 
  through php to FMP,
  What's FMP? Is that what links this email to the
db-list?
 
   and spits out a confirmation page and email.  The
issue I am having
 
  is this ... as the customer types, the text wraps.  Many
put their own
  hard returns and spaces in to organize their
description.  It seems I
  can't get it to do both the wrap and show the actual
formatting entered.
  If I format the field as physical wrap, the lines run
off the page on
  the confirmation/printout.  If I format it as virtual,
then the hard
  returns, etc get lost.  I have also tried using PRE on
the
  confirmation page and email and that doesn't work
either.
 
 
 
  Line wrapping in a text area is a property of the text
area, not of the
  text, as opposite to line breaks and hard returns. This
is why you won't
 
  find line break characters at the place the text used to
wrap in the
  text area.
 
  What you can do of course is to add a div (or whatever
container you
  feel like) of the same width / height as the text area
to the
  confirmation page and replace \l\r with br 's.
 
 

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Formatting in Text Area

2008-02-01 Thread Evert Lammerts

VanBuskirk, Patricia wrote:

I have a customer description text area field on my form which feeds through 
php to FMP,

What's FMP? Is that what links this email to the db-list?

 and spits out a confirmation page and email.  The issue I am having is this ... as 
the customer types, the text wraps.  Many put their own hard returns and spaces in to 
organize their description.  It seems I can't get it to do both the wrap and show the 
actual formatting entered.  If I format the field as physical wrap, the lines run off 
the page on the confirmation/printout.  If I format it as virtual, then the hard 
returns, etc get lost.  I have also tried using PRE on the confirmation page 
and email and that doesn't work either.
  
Line wrapping in a text area is a property of the text area, not of the 
text, as opposite to line breaks and hard returns. This is why you won't 
find line break characters at the place the text used to wrap in the 
text area.


What you can do of course is to add a div (or whatever container you 
feel like) of the same width / height as the text area to the 
confirmation page and replace \l\r with br 's.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Formatting in Text Area

2008-02-01 Thread Tobias Franzén

Hi Patricia,

You can impose width restrictions on the textarea field and forcefully
wrap lines longer than the desired length afterwards (if you save it,
save it as-is for better portability). To wrap text with PHP when you
print it, or want to send the e-mail, there is a function called
wordwrap(). Be sure to split the string at every line break though.

Using white-spaces for formating will only work if your output of the
text is with a fixed-width font. The pre html tag will do this for
you, but it won't look pretty. Use CSS to style it is my advise.

Something to bear in mind with regards to e-mail is that the standard
line width is 72 characters if I remember correctly.

Comparison of fixed-width fonts
http://www.cfcl.com/vlb/h/fontmono.html

Example code (not tested, so I'm not sure it will run as-is):
?php
$text = $_POST[textareainput];
$long_lines = split(\n, $text);
$split_text = ;
$width = 72;
foreach ($long_lines as $oneline) {
  $split_text = $split_text . wordwrap($oneline, $width, \n) . \n;
}
// $split_text will have one more newline at the end than what you
started with, so let's clean it up
$split_text = substr($split_text, 0, -1);
echo pre . $split_text . /pre;
// or
echo nl2br($split_text);
?

/Tobias

VanBuskirk, Patricia wrote:

Sorry, I had sent this first to my FileMaker list, but then realized it
was probably more html/php related than database related.  FMP is for
FileMaker Pro.

Can you give me an example of your suggestion?  I am still quite new at
php and learn much better by example.

Thanks Evert!

Trish

-Original Message-
From: Evert Lammerts [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 01, 2008 8:21 AM

To: VanBuskirk, Patricia
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Formatting in Text Area

VanBuskirk, Patricia wrote:
  

I have a customer description text area field on my form which feeds


through php to FMP,
What's FMP? Is that what links this email to the db-list?
  

 and spits out a confirmation page and email.  The issue I am having


is this ... as the customer types, the text wraps.  Many put their own
hard returns and spaces in to organize their description.  It seems I
can't get it to do both the wrap and show the actual formatting entered.
If I format the field as physical wrap, the lines run off the page on
the confirmation/printout.  If I format it as virtual, then the hard
returns, etc get lost.  I have also tried using PRE on the
confirmation page and email and that doesn't work either.
  
  

Line wrapping in a text area is a property of the text area, not of the 
text, as opposite to line breaks and hard returns. This is why you won't


find line break characters at the place the text used to wrap in the 
text area.


What you can do of course is to add a div (or whatever container you 
feel like) of the same width / height as the text area to the 
confirmation page and replace \l\r with br 's.


  


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Formatting in Text Area

2008-02-01 Thread VanBuskirk, Patricia
I have a customer description text area field on my form which feeds through 
php to FMP, and spits out a confirmation page and email.  The issue I am having 
is this ... as the customer types, the text wraps.  Many put their own hard 
returns and spaces in to organize their description.  It seems I can't get it 
to do both the wrap and show the actual formatting entered.  If I format the 
field as physical wrap, the lines run off the page on the 
confirmation/printout.  If I format it as virtual, then the hard returns, etc 
get lost.  I have also tried using PRE on the confirmation page and email and 
that doesn't work either.

Hmmm... scratching head!

Trish
~
Patricia Van Buskirk
Florida State University, Office of Telecommunications
644 W. Call Street
Tallahassee, FL  32306-1120
(850) 644-9247
~

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Formatting in Text Area

2008-02-01 Thread Bastien Koert

$text = nl2br($text);
 
 
bastien
 Date: Fri, 1 Feb 2008 08:07:17 -0500 From: [EMAIL PROTECTED] To: 
 php-db@lists.php.net Subject: [PHP-DB] Formatting in Text Area  I have a 
 customer description text area field on my form which feeds through php to 
 FMP, and spits out a confirmation page and email. The issue I am having is 
 this ... as the customer types, the text wraps. Many put their own hard 
 returns and spaces in to organize their description. It seems I can't get it 
 to do both the wrap and show the actual formatting entered. If I format the 
 field as physical wrap, the lines run off the page on the 
 confirmation/printout. If I format it as virtual, then the hard returns, etc 
 get lost. I have also tried using PRE on the confirmation page and email 
 and that doesn't work either.  Hmmm... scratching head!  Trish 
 ~ Patricia Van Buskirk Florida 
 State University, Office of Telecommunications 644 W. Call Street 
 Tallahassee, FL  32306-1120 (850) 644-9247 
 ~  --  PHP Database Mailing List 
 (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 
_



[PHP-DB] Formatting in Text Area

2008-02-01 Thread VanBuskirk, Patricia
Sorry, I had sent this first to my FileMaker list, but then realized it
was probably more html/php related than database related.  FMP is for
FileMaker Pro.

Can you give me an example of your suggestion?  I am still quite new at
php and learn much better by example.

Thanks Evert!

Trish

-Original Message-
From: Evert Lammerts [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 01, 2008 8:21 AM
To: VanBuskirk, Patricia
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Formatting in Text Area

VanBuskirk, Patricia wrote:
 I have a customer description text area field on my form which feeds
through php to FMP,
What's FMP? Is that what links this email to the db-list?
  and spits out a confirmation page and email.  The issue I am having
is this ... as the customer types, the text wraps.  Many put their own
hard returns and spaces in to organize their description.  It seems I
can't get it to do both the wrap and show the actual formatting entered.
If I format the field as physical wrap, the lines run off the page on
the confirmation/printout.  If I format it as virtual, then the hard
returns, etc get lost.  I have also tried using PRE on the
confirmation page and email and that doesn't work either.
   
Line wrapping in a text area is a property of the text area, not of the 
text, as opposite to line breaks and hard returns. This is why you won't

find line break characters at the place the text used to wrap in the 
text area.

What you can do of course is to add a div (or whatever container you 
feel like) of the same width / height as the text area to the 
confirmation page and replace \l\r with br 's.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Formatting MySQL Queries

2007-01-24 Thread Brent Anderson

Hello.

My team and I are looking for a way to return an entire table of  
MySQL data with columns delimited by tabs and rows delimited by  
carriage returns. How exactly would this work - I'm not a PHP expert  
and, although I know MySQL, I don't know where to begin with  
formatting a query pointer into an actual pile of text. We have an  
engine ready to take tables in this format for processing, we just  
need to parse the query data into a text result.


Thanks,
Brent Anderson

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Formatting MySQL Queries

2007-01-24 Thread Niel Archer
Hi

SELECT * FROM table INTO OUTFILE 'file_name'
  FIELDS TERMINATED BY '\t'
  LINES TERMINATED BY '\n'


Niel

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Formatting a form box

2006-01-12 Thread Alex Major
Hi there, 
On one of my forms, there is a section where users can put images etc..and
then it is displayed on my php pages. My question is how do I make it so
that the html formatting is automatically done. For example when someone is
typing something, and wants to start a new paragraph although they press
return when typing when the data is displayed from the MySQL database on a
website it's just continuous text. For it to start a new paragraph they have
to put p in when they are typing in this box. They do not know all the
html formatting codes, and so I need someway of making so that it is easy
for them to have formatted text without doing all the html.
Also things like changing colours, bold, italic and things would be good.
Something like on forums, where when you enter a new post you have all the
formatting options.

Hope this makes sense,
Regards, 
Alex.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Formatting a form box

2006-01-12 Thread Bastien Koert

use the nl2br() function to convert the newlines to br


bastien


From: Alex Major [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Formatting a form box
Date: Thu, 12 Jan 2006 16:33:01 +

Hi there,
On one of my forms, there is a section where users can put images etc..and
then it is displayed on my php pages. My question is how do I make it so
that the html formatting is automatically done. For example when someone is
typing something, and wants to start a new paragraph although they press
return when typing when the data is displayed from the MySQL database on a
website it's just continuous text. For it to start a new paragraph they 
have

to put p in when they are typing in this box. They do not know all the
html formatting codes, and so I need someway of making so that it is easy
for them to have formatted text without doing all the html.
Also things like changing colours, bold, italic and things would be good.
Something like on forums, where when you enter a new post you have all the
formatting options.

Hope this makes sense,
Regards,
Alex.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Formatting a form box

2006-01-12 Thread Miguel Guirao


One approach is to ask the user to input a text delimiter, like a @, for
example, in every point where there should be a new line or paragraph.
Then, you should parse the text, and at every point you find a @, tu place
a BR or P or any other HTML tag that best suits your need!!

This is just one solution, but I'm pretty sure there others!!

Mike Guirao

-Original Message-
From: Alex Major [mailto:[EMAIL PROTECTED]
Sent: Jueves, 12 de Enero de 2006 10:33 a.m.
To: php-db@lists.php.net
Subject: [PHP-DB] Formatting a form box


Hi there,
On one of my forms, there is a section where users can put images etc..and
then it is displayed on my php pages. My question is how do I make it so
that the html formatting is automatically done. For example when someone is
typing something, and wants to start a new paragraph although they press
return when typing when the data is displayed from the MySQL database on a
website it's just continuous text. For it to start a new paragraph they have
to put p in when they are typing in this box. They do not know all the
html formatting codes, and so I need someway of making so that it is easy
for them to have formatted text without doing all the html.
Also things like changing colours, bold, italic and things would be good.
Something like on forums, where when you enter a new post you have all the
formatting options.

Hope this makes sense,
Regards,
Alex.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Formatting a form box

2006-01-12 Thread tg-php
What? Nobody said This has nothing to do with PHP and databases?  Sheesh... 
someone must be sleeping. :)  Ok, so it sorta does relate..

But yeah... no2br() will do it for you.  Textarea input types DO send a newline 
and/or carriage return (didn't test and might be system specific), so if you 
just take your form $_POST data and use nl2br() before you store it in the 
database (or probably after... should be able to store a newline/carriage 
return in the database) it should produce the results you desire.

test.php:

form action=test.php method=post
textarea name=testarea
/textarea
input type=submit
/form
?php

if (isset($_POST['testarea'])) {

  echo nl2br($_POST['testarea']);

}
?

Look at the source code after you submit if you have any doubts/questions.

-TG

= = = Original message = = =

use the nl2br() function to convert the newlines to br


bastien

From: Alex Major [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Formatting a form box
Date: Thu, 12 Jan 2006 16:33:01 +

Hi there,
On one of my forms, there is a section where users can put images etc..and
then it is displayed on my php pages. My question is how do I make it so
that the html formatting is automatically done. For example when someone is
typing something, and wants to start a new paragraph although they press
return when typing when the data is displayed from the MySQL database on a
website it's just continuous text. For it to start a new paragraph they 
have
to put p in when they are typing in this box. They do not know all the
html formatting codes, and so I need someway of making so that it is easy
for them to have formatted text without doing all the html.
Also things like changing colours, bold, italic and things would be good.
Something like on forums, where when you enter a new post you have all the
formatting options.

Hope this makes sense,
Regards,
Alex.


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Formatting a form box

2006-01-12 Thread El Bekko

Miguel Guirao wrote:


One approach is to ask the user to input a text delimiter, like a @, for
example, in every point where there should be a new line or paragraph.
Then, you should parse the text, and at every point you find a @, tu place
a BR or P or any other HTML tag that best suits your need!!

This is just one solution, but I'm pretty sure there others!!

Mike Guirao

-Original Message-
From: Alex Major [mailto:[EMAIL PROTECTED]
Sent: Jueves, 12 de Enero de 2006 10:33 a.m.
To: php-db@lists.php.net
Subject: [PHP-DB] Formatting a form box


Hi there,
On one of my forms, there is a section where users can put images etc..and
then it is displayed on my php pages. My question is how do I make it so
that the html formatting is automatically done. For example when someone is
typing something, and wants to start a new paragraph although they press
return when typing when the data is displayed from the MySQL database on a
website it's just continuous text. For it to start a new paragraph they have
to put p in when they are typing in this box. They do not know all the
html formatting codes, and so I need someway of making so that it is easy
for them to have formatted text without doing all the html.
Also things like changing colours, bold, italic and things would be good.
Something like on forums, where when you enter a new post you have all the
formatting options.

Hope this makes sense,
Regards,
Alex.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.


The nl2br() function is way better because you don't change email adressess.

And for the colours and stuff... just put a small note on the bottom of 
your post page what HTML tags they are allowed to use.


Greets, El Bekko

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Formatting a form box

2006-01-12 Thread Alex Major
Thanks for the suggestions, the nl2br has been a common suggestion and think
that I have found more of what the problem is. (And it is kinda php specific
cause its php pages). Basically its not displaying it correctly on the page,
the text in the database is now being stored correctly (with lines / breaks
where they are supposed to be) but for some reason when that info is then
pulled from the database, the lines get removed.
Any ideas why?


On 12/1/06 17:41, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:

 What? Nobody said This has nothing to do with PHP and databases?  Sheesh...
 someone must be sleeping. :)  Ok, so it sorta does relate..
 
 But yeah... no2br() will do it for you.  Textarea input types DO send a
 newline and/or carriage return (didn't test and might be system specific), so
 if you just take your form $_POST data and use nl2br() before you store it in
 the database (or probably after... should be able to store a newline/carriage
 return in the database) it should produce the results you desire.
 
 test.php:
 
 form action=test.php method=post
 textarea name=testarea
 /textarea
 input type=submit
 /form
 ?php
 
 if (isset($_POST['testarea'])) {
 
   echo nl2br($_POST['testarea']);
 
 }
 ?
 
 Look at the source code after you submit if you have any doubts/questions.
 
 -TG
 
 = = = Original message = = =
 
 use the nl2br() function to convert the newlines to br
 
 
 bastien
 
 From: Alex Major [EMAIL PROTECTED]
 To: php-db@lists.php.net
 Subject: [PHP-DB] Formatting a form box
 Date: Thu, 12 Jan 2006 16:33:01 +
 
 Hi there,
 On one of my forms, there is a section where users can put images etc..and
 then it is displayed on my php pages. My question is how do I make it so
 that the html formatting is automatically done. For example when someone is
 typing something, and wants to start a new paragraph although they press
 return when typing when the data is displayed from the MySQL database on a
 website it's just continuous text. For it to start a new paragraph they
 have
 to put p in when they are typing in this box. They do not know all the
 html formatting codes, and so I need someway of making so that it is easy
 for them to have formatted text without doing all the html.
 Also things like changing colours, bold, italic and things would be good.
 Something like on forums, where when you enter a new post you have all the
 formatting options.
 
 Hope this makes sense,
 Regards,
 Alex.
 
 
 ___
 Sent by ePrompter, the premier email notification software.
 Free download at http://www.ePrompter.com.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] formatting a date from mysql

2005-12-12 Thread Eternity Records Webmaster
I need to figure out how to format the date format: year-month-day
(2005-12-06). It is a date(8) field in a mysql table that i pulled out of
the table with php 5.0.5. I need it in the format: Tue December 6, 2005 (or
in mysql's formatting: 6-12-2005). I am using the reformatting for display
only. So it would be something like this:

echo $journal['Date']; //with whatever formatting needed

If possible I need php to do the formatting for me. Thanks...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] formatting a date from mysql

2005-12-12 Thread Adrian Bruce

farily straight forward to withinn the query itself, check out

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

or for php

http://uk.php.net/date

RTFM

Regards
Adrian

Eternity Records Webmaster wrote:


I need to figure out how to format the date format: year-month-day
(2005-12-06). It is a date(8) field in a mysql table that i pulled out of
the table with php 5.0.5. I need it in the format: Tue December 6, 2005 (or
in mysql's formatting: 6-12-2005). I am using the reformatting for display
only. So it would be something like this:

echo $journal['Date']; //with whatever formatting needed

If possible I need php to do the formatting for me. Thanks...

 



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Formatting numbers

2003-07-24 Thread David Smith

Thanks. That works perfectly.
David Smith



-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 24, 2003 3:36 PM
To: David Smith; php-db
Subject: Re: [PHP-DB] Formatting numbers


  I am a little new to PHP, but I am trying to pull numbers from a database
 that has both phone numbers and social security numbers for a client. My
 Client doesn't want the numbers to come out like 55 but (555)
 555-. My question is can I use format_number() to do this and if so
how
 do I make it change from a comma and every three spaces to fit the formats
 above? I know that this is probably pretty simple, but I can't seem to
find
 the answer anywhere (possibly right under my freakin' nose :D).

Use substr() to grab the pieces you want and add formatting around them.

us2.php.net/substr

---John Holmes...


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] formatting a timestamp

2003-06-02 Thread Gürhan Özen
Rick, 
Please give more information about your problem. Are you trying to
format a timestamp field in a MySQL table?
If yes, you can do something like, 
SELECT DATE_FORMAT( columnname, '%m-%d-%y : %T-%i' );
Hope this helps...
Gurhan


On Sat, 2003-05-31 at 01:38, Rick Dahl wrote:
 I want to print out a timestamp of length 14.  I want to have it formatted 
 like:
 
 mm-dd-yy : hh-mm
 
 I have looked but all I can find is how to format a date and I don't want 
 that.  I want the time also.
 
 Rick
 
 
 
 Don't burn the day...away ~ DJM
 
 _
 Add photos to your messages with MSN 8. Get 2 months FREE*.  
 http://join.msn.com/?page=features/featuredemail
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] formatting a timestamp

2003-05-31 Thread Rick Dahl
I want to print out a timestamp of length 14.  I want to have it formatted 
like:

mm-dd-yy : hh-mm

I have looked but all I can find is how to format a date and I don't want 
that.  I want the time also.

Rick



Don't burn the day...away ~ DJM

_
Add photos to your messages with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] formatting a timestamp

2003-05-31 Thread Rolf Brusletto
*This message was transferred with a trial version of CommuniGate(tm) Pro*
Rick,
You can use date() in the following fashion..

$timeStamp = time();
date('m-d-y : h-m', $timeStamp);
where $timestamp is a unix epoch timestamp.

Hope this helps!

Rolf Brusletto
http://www.phpexamples.net
Rick Dahl wrote:

*This message was transferred with a trial version of CommuniGate(tm) 
Pro*
I want to print out a timestamp of length 14.  I want to have it 
formatted like:

mm-dd-yy : hh-mm

I have looked but all I can find is how to format a date and I don't 
want that.  I want the time also.

Rick



Don't burn the day...away ~ DJM

_
Add photos to your messages with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Formatting txt from a database

2002-12-12 Thread Lisi
I am retrieving text stored in a database, and I want to strip out any HTML 
tags and then only display the first 30 characters with ... to show the 
user that there is more text to view.

My problem is with stripping out HTML tags, the code is stripping out the 
text enclosed within the HTML tags as well.

Here is the code I am using:

	$pat = {1}.+{1};

	if (ereg(text, $type)){  			//if the field type is text look for HTML 
tags to remove
	   $content_array[$c] = ereg_replace($pat, '', $content_array[$c]);
	   $content_array[$c] = substr($content_array[$c], 1, 30);
	   $content_array[$c] = $content_array[$c];
	}

	echo $content_array[$c];


What should the correct $pat be?

Thanks,

-Lisi


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Formatting txt from a database

2002-12-12 Thread DL Neil
Lisi,
To save reinventing the wheel would strip_tags() be any use to you? (see
manual)
=dn


 I am retrieving text stored in a database, and I want to strip out any
HTML
 tags and then only display the first 30 characters with ... to show the
 user that there is more text to view.

 My problem is with stripping out HTML tags, the code is stripping out the
 text enclosed within the HTML tags as well.

 Here is the code I am using:

 $pat = {1}.+{1};

 if (ereg(text, $type)){  //if the field type is text look for HTML
 tags to remove
$content_array[$c] = ereg_replace($pat, '', $content_array[$c]);
$content_array[$c] = substr($content_array[$c], 1, 30);
$content_array[$c] = $content_array[$c];
 }

 echo $content_array[$c];


 What should the correct $pat be?

 Thanks,

 -Lisi


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Formatting txt from a database

2002-12-12 Thread Matt Vos
$select=select fields from table...;
$sres=mysql_query($select);
echo mysql_error();
while ($srow=mysql_fetch_row($sres))
{
$string=$srow[0];
$no_html=strip_tags($string);
if (strlen($no_html)  30) $no_html=substr($no_html,0,30);
echo($no_html);
}

Matt
- Original Message -
From: Lisi [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Thursday, December 12, 2002 3:55 AM
Subject: [PHP-DB] Formatting txt from a database


 I am retrieving text stored in a database, and I want to strip out any
HTML
 tags and then only display the first 30 characters with ... to show the
 user that there is more text to view.

 My problem is with stripping out HTML tags, the code is stripping out the
 text enclosed within the HTML tags as well.

 Here is the code I am using:

 $pat = {1}.+{1};

 if (ereg(text, $type)){  //if the field type is text look for HTML
 tags to remove
$content_array[$c] = ereg_replace($pat, '', $content_array[$c]);
$content_array[$c] = substr($content_array[$c], 1, 30);
$content_array[$c] = $content_array[$c];
 }

 echo $content_array[$c];


 What should the correct $pat be?

 Thanks,

 -Lisi


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] formatting table column to display as a hyperlink using Oracle

2002-03-27 Thread Franden, Craig

Hi, 

I am using a small php script to return records from an oracle8.1.6
database. I would like to have one of the columns contents display the data
as a hyperlink and I am not quite sure how to do it. Here is the code that
returns the data (which is correct). The table formatting is the issue. All
help is greatly appreciated. 

--cbf 

/ create connection 
if ($connection = OCIPLogon(chowder,head,help)) 
{ 
//echo $connection .OCIServerVersion($connection).BR\n; 
} 
else 
{ 
echo Couldn't connect to Oracle.BR\n; 
Exit(); 
} 
// create SQL statement 
$sql = select 
case_id, 
case_desc, 
evnt_code||' - '||evnt_desc, 
sched_date||' - '||start_time 

// parse SQL statement 
$sql_statement = OCIParse($connection,$sql) 
or die(Couldn't parse statement.); 

// execute SQL query 
OCIExecute($sql_statement) 
or die(Couldn't execute statement.); 
echo OCIError().BR; 
// get number of columns for use later 

// start results formatting 
$row1 = #F8; 
$row2 = #ff; 
$rowcolor = $row1; 

echo TABLE BORDER=0; 
echo TR 
THCase Number/TH 
THCase Description/TH 
THEvent Code  Description/TH 
THScheduled Date  Time/TH 
/TR 
; 

// format results by row 
while (OCIFetch($sql_statement)) { 
echo TR BGCOLOR='$rowcolor'; 
$num_columns = OCINumCols($sql_statement); 
for ($i = 1; $i = $num_columns; $i++) { 
$column_name = OCIColumnName($sql_statement,$i); 
$column_value = OCIResult($sql_statement,$i); 
echo TD$column_value/TD; 
} 
echo /TR; 
if ($rowcolor == $row1) $rowcolor = $row2; 
elseif ($rowcolor == $row2) $rowcolor = $row1; 
} 
echo OCIRowcount($sql_statement) .  records returned; 
echo /TABLE; 

// free resources and close connection 
OCIFreeStatement($sql_statement); 
OCILogoff($connection); 

?/p


Thanks.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] formatting table column to display as a hyperlink using Oracle

2002-03-27 Thread olinux

What are you trying to link to?
Most likely you need to pass a few variables in the
URL

This should give you an idea:

echo TDA
HREF=whateverpage.php?var1=$var1record=$column_value$column_value/ATD;

olinux

--- Franden, Craig [EMAIL PROTECTED]
wrote:
 Hi, 
 
 I am using a small php script to return records from
 an oracle8.1.6
 database. I would like to have one of the columns
 contents display the data
 as a hyperlink and I am not quite sure how to do it.
 Here is the code that
 returns the data (which is correct). The table
 formatting is the issue. All
 help is greatly appreciated. 
 
 --cbf 
 
 / create connection 
 if ($connection =
 OCIPLogon(chowder,head,help)) 
 { 
 //echo $connection
 .OCIServerVersion($connection).BR\n; 
 } 
 else 
 { 
 echo Couldn't connect to Oracle.BR\n; 
 Exit(); 
 } 
 // create SQL statement 
 $sql = select 
 case_id, 
 case_desc, 
 evnt_code||' - '||evnt_desc, 
 sched_date||' - '||start_time 
 
 // parse SQL statement 
 $sql_statement = OCIParse($connection,$sql) 
 or die(Couldn't parse statement.); 
 
 // execute SQL query 
 OCIExecute($sql_statement) 
 or die(Couldn't execute statement.); 
 echo OCIError().BR; 
 // get number of columns for use later 
 
 // start results formatting 
 $row1 = #F8; 
 $row2 = #ff; 
 $rowcolor = $row1; 
 
 echo TABLE BORDER=0; 
 echo TR 
 THCase Number/TH 
 THCase Description/TH 
 THEvent Code  Description/TH 
 THScheduled Date  Time/TH 
 /TR 
 ; 
 
 // format results by row 
 while (OCIFetch($sql_statement)) { 
 echo TR BGCOLOR='$rowcolor'; 
 $num_columns = OCINumCols($sql_statement); 
 for ($i = 1; $i = $num_columns; $i++) { 
 $column_name = OCIColumnName($sql_statement,$i); 
 $column_value = OCIResult($sql_statement,$i); 
 echo TD$column_value/TD; 
 } 
 echo /TR; 
 if ($rowcolor == $row1) $rowcolor = $row2; 
 elseif ($rowcolor == $row2) $rowcolor = $row1; 
 } 
 echo OCIRowcount($sql_statement) .  records
 returned; 
 echo /TABLE; 
 
 // free resources and close connection 
 OCIFreeStatement($sql_statement); 
 OCILogoff($connection); 
 
 ?/p
 
 
 Thanks.
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] formatting w/ table

2002-02-15 Thread Rick Emery

Further, I recommend replacing your echos with the following:

echo trtd width=\30%\BType Of Car: /B/tdtd.
$myrow['car_type']./td/tr\n;

echo trtd width=\30%\BModel Of Car: /B/tdtd.
$myrow['car_model']./td/tr\n;

echo trtd width=\30%\BYear Of Car: /B/tdtd.
$myrow['car_year']./td/tr\n;

echo trtd width=\30%\BPrice Of Car: /B/tdtd$.
$myrow['car_price'./td/tr\n;

echo trtd width=\30%\BVIN Of Car: /B/tdtd.
$myrow['car_vin']./td/tr;

echo trtd colspan=\2\hr color=\33\/td/tr;
}
echo /table\n;
?


-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 15, 2002 2:35 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] formating w/ table


I am having a little problem formating data retrieved from a database into
table cells... So far after connecting and querying the database table the
data is put into table cells, however after the first entry is displayed in
the table all the other entries loose the formating, HELP?
?php
require 'scripts/db.php';
$result = mysql_query(SELECT * FROM cur_inv,$dbh) or die(Could not
execute query, please try again later);
echo table border=\0\ class=\newhead\ width=\100%\trtd
align=\center\ colspan=\2\BCurrent Inventory/Bhr
color=\33\/td/tr;
$count = -1;
while ($myrow = mysql_fetch_row($result)) {
$count ++;
echo trtd width=\30%\BType Of Car: /B/tdtd;
printf(mysql_result($result,$count,car_type));
echo /td/tr\n;
echo trtd width=\30%\BModel Of Car: /B/tdtd;
printf(mysql_result($result,$count,car_model));
echo /td/tr\n;
echo trtd width=\30%\BYear Of Car: /B/tdtd;
printf(mysql_result($result,$count,car_year));
echo /td/tr\n;
echo trtd width=\30%\BPrice Of Car: /B/tdtd$;
printf(mysql_result($result,$count,car_price));
echo /td/tr\n;
echo trtd width=\30%\BVIN Of Car: /B/tdtd;
printf(mysql_result($result,$count,car_vin));
echo /td/trtrtd colspan=\2\hr
color=\33\/td/tr/table\n;
}
?

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Formatting Strings in MySQL

2001-07-02 Thread Jesse S. Williams

Artur-

No problem.  :-)

Well, you could enter it with the spacing you want by using CHAR(11) instead
of INT(9) or whatever in SQL.  However, depending on how large of a DB this
will be, and how many entries, that's not the optimal way to do it as you
must store to more (null) bytes with every entry, and transfer 2 more (null)
bytes out with every query.  Sure, 2 bytes isn't very much, but I'm a
stickler for smooth code.  The less that NEEDS to be sent, moved or stored,
the better.  The amount of time it takes to format the query afterwards vs.
the time it takes to poll those extra 2 bytes is logically the same, but it
taxes the SQL those few bytes less *shrug*

Either way will work most acceptably.  Otherwise, no, I'm not aware of a
command that will specifically format that way in MySQL.


Jesse Williams
System Administrator
DowNET VoIP Team
Electronic Data Systems


-Original Message-
From: Artur Correia [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 02, 2001 11:37 AM
To: Jesse S. Williams
Subject: Re: [PHP-DB] Formatting Strings in MySQL


Hey,
Thanks in advance for your trouble replying this.
I havent tried it out yet - nor will I untill August. I'm still planning all
this database before I start coding.
This is going to be my first work using mysql/Apache/php4 (it's going to be
a
web based administration tool for a lawfirm (intranet).

Anyway, it sounds good.
As for the string - it's either NULL value or a 9 digit number (initially
the
idea was to format a social security number (in Portugal we have only 9
digits).
Incidentally - i also thought of directly inputing the string formatted into
mysql (I'd rather do this, actually). I've tried using the FORMAT (field,0)
argument, but the output is always comm separated numbers like 123,123,123,
and
this isn't exactly what I had in mind. Do you know of a command in mysql
(either to use with  INSERT or SELECT) that can do this??

Thanks a lot

Artur Correia
Oliveira, Correia  Correia



-- 
PHP Database 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-DB] Formatting Strings in MySQL

2001-07-01 Thread Jesse S. Williams

Is there a certain format you always need the string in?  Such as 3 digits
followed by a space followed by 3 digits followed by a space followed by 3
digits?  Will there ALWAYS be 9 numbers?  If this is the case, your ereg()
to parse the string and then create a new varible using $regs[x]... so, if
the above example IS the case, you could use:


if (ereg(^([0-9]{3})([0-9]{3})([0-9]{3})$, $initialValue, $regs)  {

   $var = $regs[1] $regs[2] $regs[3];
}

This may not be the EXACT code, but it's close... Personally, regexps and I
battle often and they always seem to win  *grumble*  But this should give
you the idea.  Look at:


http://www.phpbuilder.com/columns/dario19990616.php3

or

http://www.php.net/manual/en/function.ereg.php

for more details.  The first is a VERY helpful resource for using regs in
PHP.  Hope this helps some.



Jesse Williams
System Administrator
DowNET VoIP Team
Electronic Data Systems





-Original Message-
From: Artur Correia [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 30, 2001 12:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Formatting Strings in MySQL


Hey
How can I get a string (or number) from mySQL like 123123123 to
display 123 123 123??
Tks
I'm kinda rookie

Artur


--
PHP Database 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 Database 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-DB] Formatting Strings in MySQL

2001-06-30 Thread Artur Correia

Hey
How can I get a string (or number) from mySQL like 123123123 to
display 123 123 123??
Tks
I'm kinda rookie

Artur


-- 
PHP Database 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]