Re: [PHP-DB] Help with formating text from PHP

2003-08-14 Thread Andrew D. Luebke
How are the paragraph breaks represented in the original text?  You have 
have to detect the paragraph breaks and change to a /r/n.

Andrew.

At 11:40 PM 8/9/2003, Budelak wrote:

Hello,
Can someone help with this problem I've been trying to solve but don't how to.
I have a field of type longtext that contains text with paragraphs at the 
time of entry.

But when I display this text content, the paragraphs are not shown. 
Everything will just appear in one long text with no paragraph break.

Bunmi Akinmboni

--
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] % operator

2003-08-14 Thread Andrew D. Luebke
Although now that I look at: 
http://us4.php.net/manual/en/language.operators.arithmetic.php

You'll see that $a % $b resturns the modulus so that is probably the easiest.

Andrew,

At 11:43 AM 8/12/2003, you wrote:

There's probably a better way to do this, but to retrieve only the 0.8 from
24/5 try this:
($a/$b)-floor($a/$b)

Regards,
Matt.
-Original Message-
From: Alain Barthélemy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 12, 2003 5:05 AM
To: php-db
Subject: [PHP-DB] % operator
Hello,

If you have

$a = 24;
$b = 5;
and

$c = $a/$b;

===> $c = 4.8

To retrieve the .8 (reste in french) I saw instruction:

$a%$b

Where can I find a manual for this '%' operator? Of course I already looked
in
all the Php manuals (operators, etc ...).
Thanks,



--
Alain Barthélemy
[EMAIL PROTECTED]
http://bartydeux.be
Linux User #315631
--
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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] % operator

2003-08-14 Thread Andrew D. Luebke
The easiest way would probably be to use the fmod function.

http://us3.php.net/manual/en/function.fmod.php

Andrew.

At 11:43 AM 8/12/2003, Matthew Moldvan wrote:

There's probably a better way to do this, but to retrieve only the 0.8 from
24/5 try this:
($a/$b)-floor($a/$b)

Regards,
Matt.
-Original Message-
From: Alain Barthélemy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 12, 2003 5:05 AM
To: php-db
Subject: [PHP-DB] % operator
Hello,

If you have

$a = 24;
$b = 5;
and

$c = $a/$b;

===> $c = 4.8

To retrieve the .8 (reste in french) I saw instruction:

$a%$b

Where can I find a manual for this '%' operator? Of course I already looked
in
all the Php manuals (operators, etc ...).
Thanks,



--
Alain Barthélemy
[EMAIL PROTECTED]
http://bartydeux.be
Linux User #315631
--
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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Help with formating text from PHP

2003-08-14 Thread Andrew D. Luebke
Well, as one of the last posts said, if you are displaying in a web 
browser, via HTML, you need to insert  tags where you want the text to 
go to the next line.  HTML doesn't respond to /r/n pairs.  So if that is 
how the user types them in (with a enter key at the end of lines) you need 
to replace with 's if there are no EOL's in the original text you need 
to decide on some arbitrary length and insert  at that point.

Andrew

At 12:03 AM 8/10/2003, Budelak wrote:

The text are type into an input field by the user who is nonot a 
programmer at all. This inputt field updates the database that is later 
called up for display.
Bunmi

Andrew D. Luebke wrote:
How are the paragraph breaks represented in the original text?  You have 
have to detect the paragraph breaks and change to a /r/n.
Andrew.
At 11:40 PM 8/9/2003, Budelak wrote:

Hello,
Can someone help with this problem I've been trying to solve but don't 
how to.

I have a field of type longtext that contains text with paragraphs at 
the time of entry.

But when I display this text content, the paragraphs are not shown. 
Everything will just appear in one long text with no paragraph break.

Bunmi Akinmboni

--
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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] MySQL Date insert

2003-07-28 Thread Andrew D. Luebke
John, thanks, now I feel stupid, it's always the silly little things that 
get you.  You were right, when I added the date to the existing insert I 
forgot to put the ending parentheses back in.  Thanks for the help.

Andrew.

At 11:26 AM 7/28/2003, CPT John W. Holmes wrote:
From: "Andrew D. Luebke" <[EMAIL PROTECTED]>
>  $date = date("Y-m-d H:i:s");
>  $result = mysql_query("INSERT INTO Boats (Make, Model, Serial,
> Stock, Extension, Cust_Name, Store, Date) VALUES
>  ('$make', '$model', '$serial', '$stock', '$extension',
> '$name', '$store', '$date'")
>  or die("Invalid query: " . mysql_error() .
"");
>
> The problem is with the Date column.  It is of type DATETIME.  I get an
> error on the second line of the insert statement.  I assume I'm not
putting
> formatting the date-time variable correctly but I've tried everything I
can
> think of, so any help is very much appreciated.  Thanks.
Like someone else said, using Date as a column name probably isn't very
smart. Your problem is caused by not having a closing parenthesis in your
query, though.
'$date')")

---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] MySQL Date insert

2003-07-28 Thread Andrew D. Luebke
Nope, changed the insert to:

$result = mysql_query("INSERT INTO Boats (Make, Model, Serial, 
Stock, Extension, Cust_Name, Store, Insert_Date) VALUES
('$make', '$model', '$serial', '$stock', '$extension', 
'$name', '$store', '$date'")
or die("Invalid query: " . mysql_error() . "");

with corresponding alter of the table of course, same error.

Andrew.

 At 11:19 AM 7/28/2003, Hutchins, Richard wrote:
Don't know about your date format, but you have named your table column DATE
which is a reserved keyword in MySQL. Try naming that something different
and see if you still get the error.
> -Original Message-
> From: Andrew D. Luebke [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 28, 2003 2:17 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] MySQL Date insert
>
>
> Hello,
> I have the following PHP code:
>
>  $date = date("Y-m-d H:i:s");
>  $result = mysql_query("INSERT INTO Boats (Make,
> Model, Serial,
> Stock, Extension, Cust_Name, Store, Date) VALUES
>  ('$make', '$model', '$serial', '$stock',
> '$extension',
> '$name', '$store', '$date'")
>  or die("Invalid query: " . mysql_error() .
> "");
>
> The problem is with the Date column.  It is of type DATETIME.
>  I get an
> error on the second line of the insert statement.  I assume
> I'm not putting
> formatting the date-time variable correctly but I've tried
> everything I can
> think of, so any help is very much appreciated.  Thanks.
>
> Andrew.
>
--
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] MySQL Date insert

2003-07-28 Thread Andrew D. Luebke
Hello,
   I have the following PHP code:
$date = date("Y-m-d H:i:s");
$result = mysql_query("INSERT INTO Boats (Make, Model, Serial, 
Stock, Extension, Cust_Name, Store, Date) VALUES
('$make', '$model', '$serial', '$stock', '$extension', 
'$name', '$store', '$date'")
or die("Invalid query: " . mysql_error() . "");

The problem is with the Date column.  It is of type DATETIME.  I get an 
error on the second line of the insert statement.  I assume I'm not putting 
formatting the date-time variable correctly but I've tried everything I can 
think of, so any help is very much appreciated.  Thanks.

Andrew. 

Re: [PHP-DB] Query loop issues.

2003-05-30 Thread Andrew D. Luebke
From the docs it appears that they are functionally equivalent, with 
mysql_fetch_array having a few more options for indexing the array.

Andrew.

At 09:51 AM 5/29/2003, you wrote:
shouldn't you be fetching a row and not an array?
while($row = mysql_fetch_row($query_result, MYSQL_NUM))
rick

- Original Message -
From: "Andrew D. Luebke" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 29, 2003 11:48 AM
Subject: [PHP-DB] Query loop issues.
> I'm having a problem with looping a query here is the skeleton of the
code:
>
> $query_result = mysql_query("SELECT * FROM Boats WHERE Serial='$serial' OR
> Make='$make'")
> if(mysql_num_rows($query_result) > 1)
> {
> while($row = mysql_fetch_array($query_result, MYSQL_NUM))
> {
> 
> }
> }
> else
> {
> 
> }
>
> This works.  The code in the while loop and the code in the else statement
> are identical.  However, if I just have the while loop without any if
> statement and try a query with only one resulting row the system goes into
> an infinite loop.  I really don't see anything wrong with the logic so any
> help is appreciated.  Thanks.
>
> Andrew.
>
>
>
> --
> 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] Query loop issues.

2003-05-30 Thread Andrew D. Luebke
I'm having a problem with looping a query here is the skeleton of the code:

	$query_result = mysql_query("SELECT * FROM Boats WHERE Serial='$serial' OR 
Make='$make'")
	if(mysql_num_rows($query_result) > 1)
		{
		while($row = mysql_fetch_array($query_result, MYSQL_NUM))
			{
			
			}
		}
	else
		{
		
		}

This works.  The code in the while loop and the code in the else statement 
are identical.  However, if I just have the while loop without any if 
statement and try a query with only one resulting row the system goes into 
an infinite loop.  I really don't see anything wrong with the logic so any 
help is appreciated.  Thanks.

Andrew.



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