[PHP-DB] Re: File Upload ---Thanks!

2003-01-07 Thread Adam Royle
Yep. Been using Mac OS X (10.1 - 10.2.3) with mySQL no problems. I 
built it from source first time, but now I just use Mac OS X packages 
from Mark Liyanage. You can find them here. Also he has a good 
pre-compiled PHP4 you can download and use.

http://www.entropy.ch/software/MacOSx/mysql/

Adam


Thanks folks - persistence pays off and so does group discussions . I 
had chmodded the uploads directory to 777 but it was within the 
public_html directory with different file permissions so I guess 
public_html permissions were taking presidence. After reading all of 
your suggestions... a little light turned on and I moved the uploads 
directory outside of the public-html directory and Volia!

Uploading file...
File uploaded successfully

Preview of uploaded file contents:
THIS IS A TEST.


Thanks Again.
Anyone using a Macintosh with MySql? That is my next goal.


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




Re: [PHP-DB] mysql time format

2003-01-07 Thread Paul Burney
on 1/6/03 8:24 PM, David Chamberlin at [EMAIL PROTECTED] appended the
following bits to my mbox:

 Is there any way to set the time format so that any time values in my
 SELECT call are in a speicified format (e.g., HH:MM instead of HH:MM:SS).
 
 Basically I've got a table of a variety of different types, some of
 which are times.  I want to issue a select that retrieves all of the
 data for a row, and have any time values be returned in HH:MM (for example).
 
 I can (very painfully) go through all the results, figure out which ones
 are time values, and then do SELECT TIME_FORMAT() on each one of those,
 but that seems like a horrendous solution to a simple problem.

As John said, there's not a way (I know of) to just tell MySQL to display
times in a different format without the TIME_FORMAT calls.

Why not add the TIME_FORMAT calls to the original query rather than
performing all the extra queries?  Is your first select something like the
following?

SELECT * FROM table

Even if you don't want to specify all the columns, you could add the
additional ones like this:

SELECT *,TIME_FORMAT(time_column_1,'%whatever') AS time_column_1 FROM table

If you are using a mysql_fetch_assoc function, giving the alias the same
name as the original column makes only the alias show up in your array.

If you don't know what all the time columns are, you could do a SHOW
COLUMNS FROM table query first, then use PHP to parse the results to tell
you which fields are time types, then use that result to build a query like
that above. (You could also use one of the php mysql_field_* functions.)

HTH.

Sincerely,

Paul Burney
http://paulburney.com/

?php
while ($self != asleep) {
$sheep_count++;
}
?



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




[PHP-DB] Help with date....

2003-01-07 Thread Rodrigo Corrêa
How can i find out the day of the week in one date??

like  =  07/01/2002   the day of the week is  3  thurday

like  = 18/01/2002 the day of the week is  6  saturday

is there a way to do that?


Equipe Pratic Sistemas
Rodrigo Corrêa
Fone: (14) 441-1700
[EMAIL PROTECTED]
[EMAIL PROTECTED] 
 




Re: [PHP-DB] Help with date....

2003-01-07 Thread Ignatius Reilly
You can do it very nicely with MySQL:

$query = SELECT WEEKDAY( '{$mydate}' ) ;
Provided your date is correctly formatted ( -mm-dd )

Ignatius

- Original Message -
From: Rodrigo Corrêa [EMAIL PROTECTED]
To: PHP1 [EMAIL PROTECTED]
Sent: Tuesday, January 07, 2003 3:57 PM
Subject: [PHP-DB] Help with date


How can i find out the day of the week in one date??

like  =  07/01/2002   the day of the week is  3  thurday

like  = 18/01/2002 the day of the week is  6  saturday

is there a way to do that?



Equipe Pratic Sistemas
Rodrigo Corrêa
Fone: (14) 441-1700
[EMAIL PROTECTED]
[EMAIL PROTECTED]





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




RE: [PHP-DB] Help with date....

2003-01-07 Thread SELPH,JASON (HP-Richardson,ex1)
with mysql its:
WEEKDAY(date)
Returns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 =
Sunday):

mysql SELECT WEEKDAY('1998-02-03 22:23:00');
- 1
mysql SELECT WEEKDAY('1997-11-05');
- 2
http://www.mysql.com/doc/en/Date_and_time_functions.html


in php its:
string date ( string format [, int timestamp])
and  w - day of the week, numeric, i.e. 0 (Sunday) to 6 (Saturday)
http://www.php.net/manual/en/function.date.php


Not sure which you wanted since this is the php-db group :)
Cheers
Jason


-Original Message-
From: Rodrigo Corrêa [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 8:58 AM
To: PHP1
Subject: [PHP-DB] Help with date


How can i find out the day of the week in one date??

like  =  07/01/2002   the day of the week is  3  thurday

like  = 18/01/2002 the day of the week is  6  saturday

is there a way to do that?



Equipe Pratic Sistemas
Rodrigo Corrêa
Fone: (14) 441-1700
[EMAIL PROTECTED]
[EMAIL PROTECTED] 
 


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




Re: [PHP-DB] Re: Passing variables through a page

2003-01-07 Thread Mark
If you use sessions, you can pass the variables without having to
wory about interim pages. Another option (I don't know if it will
actually work) is to put the variables in the the URL of the location
redirect. Something like:

$loc=http://www.yourdomain.com/nextpage?var1=$var1var2=$var2;;
header(location: $loc);


--- Michael Mauch [EMAIL PROTECTED] wrote:
 Alex Francis [EMAIL PROTECTED] wrote:
  I have a page (dept_select) with two drop down lists populated
 from a table
  in a MySQL Database. If one item is selected in either of the
 lists I need
  to go to one page (5-14_select_area.php). If any other item is
 selected I
  need to go to another page (add_new_resources.php) but I need to
 pass the
  selected items to add_new_resources.php.
 
 I don't think there are many other possiblities, at least if you
 don't
 want to use JavaScript (and I hope you don't).
 
 Instead of the redirect, you could perhaps use require() to include
 one
 of the two possible pages, and thus avoid one server-client
 roundtrip.
 
  At the moment I have created a page between dept_select.php and
 the other
  pages and added the following code to it:
  ?php
  if ($department==5-14 Curriculum)
  {
  header(Location:5-14_select_area.php);
  }
  elseif ($level==5-14 Curriculum)
  {
  header(Location:5-14_select_area.php);
  }
  else
  {
  header(Location:add_new_resources.php);
  }
  ?
 
 The Location header requires an absolute URI, e.g.
 http://your_host/path/your_file.php.
 
 I'm not sure whether this is a database question ;-)
 
 Regards...
   Michael
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to death to 
defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Re: [PHP-DB] mysql time format

2003-01-07 Thread David Chamberlin


Paul Burney wrote:


Why not add the TIME_FORMAT calls to the original query rather than
performing all the extra queries?  Is your first select something like the
following?


That's what I'd like to do, but not sure how to do that in this context.


SELECT *,TIME_FORMAT(time_column_1,'%whatever') AS time_column_1 FROM table


Aha!  That's what I was looking for!


If you don't know what all the time columns are, you could do a SHOW
COLUMNS FROM table query first, then use PHP to parse the results to tell
you which fields are time types,


Right, that's basically what I've already done.  When my class 
instantiates, it parses the columns and builds an array with the names 
of the columns that are time types.  Currently I'm using that array to 
cycle through the results and issue TIME_FORMAT calls on all of the 
results, but what I wanted was to have the TIME_FORMAT in the original 
call.  But I didn't know how to do that without listing all of the 
columns and also getting the result in the same name as the original. 
Your code snippet explains just what I wanted.  Thank you!

-Dave


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



[PHP-DB] Looking for Beta testers

2003-01-07 Thread Randy Phillips
Hi,

I have been developing a Java Swing UI for MySQL and I am to a point where I
need to have some PHP developers try it out. This is NOT an interface that
manages your databases, tables and columns. What it does is allows you to
connect to a database on your MySQL server, select a table and get a list of
its column names. You then select an HTML form element from a pull down
menu, such as, a text field or radio button, and drag and drop the column
name into your text editor. It concatenates the column name, the html and
the PHP for you.

I am especially interested in having the PHP code that the application
writes evaluated. I want it to be generic enough to accommodate a lot of
different coding styles but not so simple that it does not save the
developer any time writing repetitive code, which is the point.

It should run on any Java virtual machine supporting JDBC-1.2 or JDBC-2.0
(JDK-1.2 or higher) and connect to any MySQL server supporting version 9 or
10 of the MySQL protocol.

I have tested it on MacOSX and Windows 2000. I would like to know how it
behaves on Linux or other systems running the latest JVM.

If you would like to test a demo feel free to contact me off list.

Thanks,


--
Randy Phillips www.phillips-it.com
phillipsIT Voice: 636.390.9468
Senior Web DevelopereFax: 501.423.3817
--
- Interesting Technology For Your Business -


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




[PHP-DB] Sore head...

2003-01-07 Thread NIPP, SCOTT V (SBCSI)
My head is sore from banging my head on my desk, so I will now ask
the gurus...

I am trying to get a canned Calendar application working, and I am
running into problems.  The application is phpCommunityCalendar by
AppIdeas.com.  The calendar is currently semi-functional, but for some
reason the approval system is not working for me.  I am trying to
troubleshoot why this is the case and this is where I am running into
problems.  The following is a bit of code that I do not understand and was
hoping that someone could clear up for me.

**  Not sure exactly what this code does, especially the %% portion**

if (!$glbl_LocationID) {
$glbl_LocationID = 0;
$LocQuery = LocationID LIKE '%%';
} else {
$LocQuery = LocationID = '$glbl_LocationID';
}

**  SNIP This section queries the database for events that have been
submitted but NOT approved, this is the Active = '0'**

$result = mysql($DBName,SELECT CalendarDetailsID FROM phpCalendar_Daily
WHERE Active = '0') or die(mysql_error());
while ($row = mysql_fetch_row($result)) {
$ID[$i] = $row[0];
$i++;
}

** SNIP Based on looking at the DB, this section associates the matched
item descriptions for display**

for ($j = 0; $ID[$j]; $j++) {
$query .=  OR CalendarDetailsID = '$ID[$j]';
}
$query = ereg_replace(^ OR ,,$query);
if (!$query) {
echo centerbThere are no results to display/b/center;
commonFooter();
exit;

** SNIP Even though I see entries in the DB that appear as they should
display (Active = 0), nothing actually appears**
$result = mysql($DBName,SELECT *
FROM phpCalendar_Details
WHERE .$LocQuery. AND (.$query.)
ORDER BY Title) or die(mysql_error());

OK.  I have tested the basics of the SQL in both the second section
and the last section.  If I manually query the database as in the second
section, and then use that output in the query of the last section I am
returned a record as expected.  This is the reason why I am lost as to why
this is not working here.
Thanks in advance for the help.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



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




Re: [PHP-DB] Sore head...

2003-01-07 Thread Micah Stevens
Heh. I used this app in one of my sites, (www.9250x.com) it has some
nice features, but whoever programmed it didn't intend for anyone else
to make changes, that's for sure. 

The '%%' in the first snippet is some SQL code, '%' is a wildcard in
SQL, so the gist of that section is If $global_locationID is false,
then make it = 0, and allow the database to return values with ANY
locationID, otherwise just return those records that match the
global_locationID

The second snippet just builds an array out of the unapproved records.
Like you said.

You're right on with the third as well. I would suggest finding the
place where the query is actually submitted, and add an echo $sql; type
statement so you can see the actual query that is being sent to the
database, that may clear things up a little. 

-Micah




On Tue, 2003-01-07 at 09:20, NIPP, SCOTT V (SBCSI) wrote:

   My head is sore from banging my head on my desk, so I will now ask
 the gurus...
 
   I am trying to get a canned Calendar application working, and I am
 running into problems.  The application is phpCommunityCalendar by
 AppIdeas.com.  The calendar is currently semi-functional, but for some
 reason the approval system is not working for me.  I am trying to
 troubleshoot why this is the case and this is where I am running into
 problems.  The following is a bit of code that I do not understand and was
 hoping that someone could clear up for me.
 
 **  Not sure exactly what this code does, especially the %% portion**
 
   if (!$glbl_LocationID) {
   $glbl_LocationID = 0;
   $LocQuery = LocationID LIKE '%%';
   } else {
   $LocQuery = LocationID = '$glbl_LocationID';
   }
 
 **  SNIP This section queries the database for events that have been
 submitted but NOT approved, this is the Active = '0'**
 
 $result = mysql($DBName,SELECT CalendarDetailsID FROM phpCalendar_Daily
 WHERE Active = '0') or die(mysql_error());
   while ($row = mysql_fetch_row($result)) {
   $ID[$i] = $row[0];
   $i++;
   }
 
 ** SNIP Based on looking at the DB, this section associates the matched
 item descriptions for display**
 
   for ($j = 0; $ID[$j]; $j++) {
   $query .=  OR CalendarDetailsID = '$ID[$j]';
   }
 $query = ereg_replace(^ OR ,,$query);
   if (!$query) {
   echo centerbThere are no results to display/b/center;
   commonFooter();
   exit;
 
 ** SNIP Even though I see entries in the DB that appear as they should
 display (Active = 0), nothing actually appears**
 $result = mysql($DBName,SELECT *
 FROM phpCalendar_Details
 WHERE .$LocQuery. AND (.$query.)
 ORDER BY Title) or die(mysql_error());
 
   OK.  I have tested the basics of the SQL in both the second section
 and the last section.  If I manually query the database as in the second
 section, and then use that output in the query of the last section I am
 returned a record as expected.  This is the reason why I am lost as to why
 this is not working here.
   Thanks in advance for the help.
 
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.com

-- 
Raincross Technologies
Development and Consulting Services
http://www.raincross-tech.com




[PHP-DB] blob

2003-01-07 Thread Natividad Castro
Hi to all,
I want to be able to load PDFs into mysql DB, but I'm not very familiar with
the blob data type?
Can someone point me on the right direction how to do this?

Thanks in advance
Nato


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




Re: [PHP-DB] blob

2003-01-07 Thread Andrey Hristov
 Keep in mind that BLOB is up to 64k thus you may need larger BLOB.
Look at the mysql's documenations for more information
http://www.mysql.com/doc/en/

Andrey

P.S.
Have a nice night.

- Original Message -
From: Natividad Castro [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 07, 2003 10:17 PM
Subject: [PHP-DB] blob


 Hi to all,
 I want to be able to load PDFs into mysql DB, but I'm not very familiar
with
 the blob data type?
 Can someone point me on the right direction how to do this?

 Thanks in advance
 Nato


 --
 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] Re: blob

2003-01-07 Thread Alex Francis
Why not upload the PDF file to a files directory and just put the path and
filename in your database.

Natividad Castro [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi to all,
 I want to be able to load PDFs into mysql DB, but I'm not very familiar
with
 the blob data type?
 Can someone point me on the right direction how to do this?

 Thanks in advance
 Nato




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




Re: [PHP-DB] Re: blob

2003-01-07 Thread David Smith
On Tue, 2003-01-07 at 15:52, [EMAIL PROTECTED] wrote:
 
 I agree with this method.  i have not yet seen an advantage of storing
 blobs in a database.  Is there one?  i'm sure those on this list would have
 an opinion if there was one.  personally, i like storing all this stuff on
 the file system.

There is one advantage. You must either chown the upload directory to
the user that your web-server runs as, or chmod it to be world-writable.
When creating a web-application that you plan to distribute (like
Slashcode), you can't assume that your users will have that privilege.
So, storing it in MySQL is a great option.

--Dave


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




Re: [PHP-DB] Re: blob

2003-01-07 Thread Jeffrey_N_Dyke

I agree with this method.  i have not yet seen an advantage of storing
blobs in a database.  Is there one?  i'm sure those on this list would have
an opinion if there was one.  personally, i like storing all this stuff on
the file system.

Jeff


   
   
Alex Francis 
   
afrancis@camerondes   To: [EMAIL PROTECTED]
   
ign.co.uk cc: 
   
   Subject: [PHP-DB] Re: blob  
   
01/07/2003 05:18 PM
   
Please respond to  
   
Alex Francis 
   
   
   
   
   




Why not upload the PDF file to a files directory and just put the path and
filename in your database.

Natividad Castro [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi to all,
 I want to be able to load PDFs into mysql DB, but I'm not very familiar
with
 the blob data type?
 Can someone point me on the right direction how to do this?

 Thanks in advance
 Nato




--
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] Breaking up new lines for e-mail

2003-01-07 Thread Gavin Amm
Hi guys,

Would someone mind pointing me to a function, or some code, or give me a
seudo-code start for the following:

I'm using the mail() function.
If someone submits the form with text in the multi-line textarea, any
carrige returns (ie, by pressing ENTER) are taken out  the body is sent
as a single line.
I'm sending the e-mail in plain text.

Thanks,
Gav

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




[PHP-DB] Re: Breaking up new lines for e-mail

2003-01-07 Thread Manuel Lemos
Hello,

On 01/07/2003 10:11 PM, Gavin Amm wrote:

Would someone mind pointing me to a function, or some code, or give me a
seudo-code start for the following:

I'm using the mail() function.
If someone submits the form with text in the multi-line textarea, any
carrige returns (ie, by pressing ENTER) are taken out  the body is sent
as a single line.
I'm sending the e-mail in plain text.


There is wordwrap() but that function is broken in several PHP versions 
and even had a buffer overflow security problem, so I gave up on using 
it at all.

What I use is a function that is part of a message composing and sending 
class that basically does the same as wordwrap except that it works well 
in all PHP versions without any security problems. Check out the 
function WrapText() of the email_message_class here:

http://www.phpclasses.org/mimemessage

--

Regards,
Manuel Lemos


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



[PHP-DB] PHP 4.3 problem

2003-01-07 Thread Ryan Jameson (USA)
using the same extensions path as the previous version I get:

Content-type: text/html X-Powered-By: PHP/4.3.0 PHP Warning: Unknown(): Unable to load 
dynamic library 'C:\Program Files\PHP\extensions\php_ldap.dll' - The specified module 
could not be found. in Unknown on line 0  

when using PHP 4.3 ... anyone know why?

 Ryan

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




RE: [PHP-DB] Re: Breaking up new lines for e-mail

2003-01-07 Thread Gavin Amm
Thanks for your reply.

Word wrap seems to be ok.
What does seem to be a problem is the line breaks...

For example, they might type in the following (between the dashed
lines):
--
  Hi,

  Please send me some info.

  Thanks,
  Gav
--

When I receive the mail, however, it looks like this:
--
  Hi, Please send me some info. Thanks, Gav
--

This is fine for such a short message, but lengthy messages would be
horrid to read if all the line breaks were taken out...

Cheers,
Gav



-Original Message-
From: Manuel Lemos [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, 8 January 2003 11:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Breaking up new lines for e-mail


Hello,

On 01/07/2003 10:11 PM, Gavin Amm wrote:
 Would someone mind pointing me to a function, or some code, or give me

 a seudo-code start for the following:
 
 I'm using the mail() function.
 If someone submits the form with text in the multi-line textarea, any 
 carrige returns (ie, by pressing ENTER) are taken out  the body is 
 sent as a single line. I'm sending the e-mail in plain text.

There is wordwrap() but that function is broken in several PHP versions 
and even had a buffer overflow security problem, so I gave up on using 
it at all.

What I use is a function that is part of a message composing and sending

class that basically does the same as wordwrap except that it works well

in all PHP versions without any security problems. Check out the 
function WrapText() of the email_message_class here:

http://www.phpclasses.org/mimemessage

-- 

Regards,
Manuel Lemos


-- 
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] berkeley db3 on windows

2003-01-07 Thread Dave Viner
hi,
  i just got my windows/php/db3 env compiled.  But
when I run a simple test script, I get this error:

C:\TEMPphp -f simple.php

Notice: dba_open()
[http://www.php.net/function.dba-open]: read:
0x12f8f4, 256:
Permission denied in C:\TEMP\simple.php on line 3

Notice: dba_open()
[http://www.php.net/function.dba-open]:
testdbcache.db: Permi
ssion denied in C:\TEMP\simple.php on line 3

Warning: dba_open(testdbcache.db,c)
[http://www.php.net/function.dba-open]: Driv
er initialization failed for handler: db3: Permission
denied in C:\TEMP\simple.p
hp on line 3
opened testdbcache.db -

C:\TEMP


The script looks like this:
?php
$path = testdbcache.db;
$id = dba_open($path,c,db3);
echo opened $path - $idbr\n;
if($id)
{
dba_close($id);
echo closed $pathbr\n;
}
else
echo nothing openedbr\n;
?


It looks like a simple permissions problem, but the
weird thing is that the testdbcache.db file is
actually created in the directory, with 0 length.

has anyone seen this type of error or know how to fix
it?

thanks
dave





__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




RE: [PHP-DB] Re: blob

2003-01-07 Thread Luke Woollard
I agree with Dave. I wrote an application to allow a client to upload/manage
images and categorise them into diff. parts of their website.

Images were stored as normal image files after upload and a pointer made to
them from the appropriate database record (which had additional image info
e.g. description)

Since I now have to move this website to a new server - transferring all
these files was a bit annoying. Storing them as binary data in mysql would
have been easier to manage...






-Original Message-
From: David Smith [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 8 January 2003 10:19 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: blob


On Tue, 2003-01-07 at 15:52, [EMAIL PROTECTED] wrote:

 I agree with this method.  i have not yet seen an advantage of storing
 blobs in a database.  Is there one?  i'm sure those on this list would
have
 an opinion if there was one.  personally, i like storing all this stuff on
 the file system.

There is one advantage. You must either chown the upload directory to
the user that your web-server runs as, or chmod it to be world-writable.
When creating a web-application that you plan to distribute (like
Slashcode), you can't assume that your users will have that privilege.
So, storing it in MySQL is a great option.

--Dave


--
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] PHP 4.3 problem

2003-01-07 Thread Ryan Jameson (USA)
More info on this:

I tried to create a root directory c:\extensions and put the module in there on the 
off chance that the bug in 4.3 comes from the space in the directory path. It didn't 
help. Nothing seemed to work. If I comment out the line to load the module everything 
works fine (except for the ldap calls).

Anyway, I hunted the archives and no answer, has anyone had any luck moving to 4.3 on 
IIS?

 Ryan



-Original Message-
From: Ryan Jameson (USA) 
Sent: Tuesday, January 07, 2003 5:34 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP 4.3 problem


using the same extensions path as the previous version I get:

Content-type: text/html X-Powered-By: PHP/4.3.0 PHP Warning: Unknown(): Unable to load 
dynamic library 'C:\Program Files\PHP\extensions\php_ldap.dll' - The specified module 
could not be found. in Unknown on line 0  

when using PHP 4.3 ... anyone know why?

 Ryan

-- 
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] Re: Breaking up new lines for e-mail

2003-01-07 Thread Manuel Lemos
Hello,

On 01/07/2003 10:41 PM, Gavin Amm wrote:

Thanks for your reply.

Word wrap seems to be ok.
What does seem to be a problem is the line breaks...

For example, they might type in the following (between the dashed
lines):
--
  Hi,

  Please send me some info.

  Thanks,
  Gav
--

When I receive the mail, however, it looks like this:
--
  Hi, Please send me some info. Thanks, Gav
--

This is fine for such a short message, but lengthy messages would be
horrid to read if all the line breaks were taken out...


That is not the correct behaviour of wordwrap(). As I said, wordwrap() 
is broken in some PHP versions and that is why I use my class function 
WrapText() instead of wordwrap().

Of course I use my class for more than just wrapping text as it is 
mostly meant to compose and send properly formatted e-mail messages, 
some in HTML with alternative text parts, embedded images in HTML, 
attachments, etc.. If you do not need all that, you may just take out 
the WrapText function and use it separately as it does not need the rest 
of the class functions.

Regards,
Manuel Lemos


-Original Message-
From: Manuel Lemos [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, 8 January 2003 11:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Breaking up new lines for e-mail


Hello,

On 01/07/2003 10:11 PM, Gavin Amm wrote:

Would someone mind pointing me to a function, or some code, or give me




a seudo-code start for the following:

I'm using the mail() function.
If someone submits the form with text in the multi-line textarea, any 
carrige returns (ie, by pressing ENTER) are taken out  the body is 
sent as a single line. I'm sending the e-mail in plain text.


There is wordwrap() but that function is broken in several PHP versions 
and even had a buffer overflow security problem, so I gave up on using 
it at all.

What I use is a function that is part of a message composing and sending

class that basically does the same as wordwrap except that it works well

in all PHP versions without any security problems. Check out the 
function WrapText() of the email_message_class here:

http://www.phpclasses.org/mimemessage


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




Re: [PHP-DB] Re: Breaking up new lines for e-mail

2003-01-07 Thread Paul Burney
on 1/7/03 7:41 PM, Gavin Amm at [EMAIL PROTECTED] appended the following bits
to my mbox:

 For example, they might type in the following (between the dashed
 lines):
 --
 Hi,
 
 Please send me some info.
 
 Thanks,
 Gav
 --
 
 When I receive the mail, however, it looks like this:
 --
 Hi, Please send me some info. Thanks, Gav
 --
 
 This is fine for such a short message, but lengthy messages would be
 horrid to read if all the line breaks were taken out...

This probably should be on PHP-General, since it isn't related to databases.

That said and not having seen the code, I'm wondering if the user may be
submitting the form from a Macintosh computer which uses carriage returns as
end of line characters.  If that were the case, they might not show up in a
windows email client as line breaks.

You might want to convert all line breaks to Windows style CRLF, that is
\r\n.  It may be that CRLF is required by one of the email RFCs.

Something like:

$text = str_replace(\r\n,\n,$text); // windows to unix
$text = str_replace(\r,\n,$text); // mac to unix
$text = str_replace(\n,\r\n,$text); // all to windows

HTH.

Sincerely,

Paul Burney

-- 

I'm inhaling Caesar's last gasp...
http://paul.burney.ws/thoughts/caesars_breath.html


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




RE: [PHP-DB] Breaking up new lines for e-mail

2003-01-07 Thread John W. Holmes
 Would someone mind pointing me to a function, or some code, or give me
a
 seudo-code start for the following:
 
 I'm using the mail() function.
 If someone submits the form with text in the multi-line textarea, any
 carrige returns (ie, by pressing ENTER) are taken out  the body is
sent
 as a single line.
 I'm sending the e-mail in plain text.

Maybe try a different WRAP attribute for your textarea. Options are
VIRTUAL, PHYSICAL, and NONE/OFF (can't remember which). You probably
want PHYSICAL, which will insert newlines when the text wraps in the
box.

What are you using to view these emails?

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




[PHP-DB] Retreive email address from MySQL DB

2003-01-07 Thread Tim Best
I have a database: web_feedback, and it has 5 columns:

Firstname varchar(40) not null
Lastname varchar(40) not null
Email varchar(40) PRIMARY KEY not null
ServList varchar(40) not null
Timestamp not null

I run a query in a PHP script to retrieve the email address the line of code
looks like this:


$query_time = mysql_query(select time from DB where email='$email');


This line returns RESOURCE ID #2 in $query_time when I use it to echo it's
value in an email message:


$mailcontent = $firstname. .$lastname. has submitted info as follows:
\n.

First Name: .$firstname.\n.

Last Name: .$lastname.\n.

email: .$email.\n.

Selected Services: .$servList.\n.

Time entered: .$query_time.\n;



Anyone able to see off hand if I'm doing anything obviously wrong?

/T


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




RE: [PHP-DB] Retreive email address from MySQL DB

2003-01-07 Thread John W. Holmes
 I have a database: web_feedback, and it has 5 columns:
 
 Firstname varchar(40) not null
 Lastname varchar(40) not null
 Email varchar(40) PRIMARY KEY not null
 ServList varchar(40) not null
 Timestamp not null
 
 I run a query in a PHP script to retrieve the email address the line
of
 code
 looks like this:
 
 
 $query_time = mysql_query(select time from DB where email='$email');
 
 
 This line returns RESOURCE ID #2 in $query_time when I use it to echo
it's
 value in an email message:
 
 
 $mailcontent = $firstname. .$lastname. has submitted info as
follows:
 \n.
 
 First Name: .$firstname.\n.
 
 Last Name: .$lastname.\n.
 
 email: .$email.\n.
 
 Selected Services: .$servList.\n.
 
 Time entered: .$query_time.\n;
 
 
 
 Anyone able to see off hand if I'm doing anything obviously wrong?

Well, the first thing is that you're selecting 'time' from your table
when the column is named 'timestamp'...

Second, you need to use a mysql_fetch_row/array/object/assoc function to
retrieve the row from the result set returned by mysql_query. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




[PHP-DB] Retreive email address from MySQL DB

2003-01-07 Thread [EMAIL PROTECTED]
I have a database: web_feedback, and it has 5 columns:

Firstname varchar(40) not null
Lastname varchar(40) not null
Email varchar(40) PRIMARY KEY not null
ServList varchar(40) not null
Timestamp not null

I run a query in a PHP script to retrieve the email address the line of code
looks like this:


$query_time = mysql_query(select time from DB where email='$email');


This line returns RESOURCE ID #2 in $query_time when I use it to echo it's
value in an email message:


$mailcontent = $firstname. .$lastname. has submitted info as follows:
\n.

First Name: .$firstname.\n.

Last Name: .$lastname.\n.

email: .$email.\n.

Selected Services: .$servList.\n.

Time entered: .$query_time.\n;



Anyone able to see off hand if I'm doing anything obviously wrong?

/T


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




RE: [PHP-DB] Re: Passing variables through a page

2003-01-07 Thread Michael Conway
Sessions are better.  If you want to use the header to pass the
variable:

header(Location:5-14_select_area.php?department=$department); (use an
ampersand  for adding additional variables as mentioned by Mark.

You should call a clean function from an include file (add the document
root directory in the php.ini file so you can place the file in a
different directory and PHP always knows where to find it when you
include it without having to reference the entire document root - very
handy) to prevent someone from altering your intended input (this is why
sessions are better).
?php
//include.inc
function clean($input, $maxlength)
{
$input = substr($input, 0, $maxlength);
$input = EscapeShellCmd($input);
return ($input);
}
?

Then for the 5-14_select_area.php file:

?php
//5-14_select_area.php
include_once 'include.inc';

if(!empty($department))
{
  $department = clean($department, 15);
}
if(!empty($level))
{
  $level = clean($level, 15);
}
your queries follow
..

?

Hope that is what you were looking for.

Michael Conway
[EMAIL PROTECTED]
(703) 968-8875
 

-Original Message-
From: Mark [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 07, 2003 10:29 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: Passing variables through a page

If you use sessions, you can pass the variables without having to
wory about interim pages. Another option (I don't know if it will
actually work) is to put the variables in the the URL of the location
redirect. Something like:

$loc=http://www.yourdomain.com/nextpage?var1=$var1var2=$var2;;
header(location: $loc);


--- Michael Mauch [EMAIL PROTECTED] wrote:
 Alex Francis [EMAIL PROTECTED] wrote:
  I have a page (dept_select) with two drop down lists populated
 from a table
  in a MySQL Database. If one item is selected in either of the
 lists I need
  to go to one page (5-14_select_area.php). If any other item is
 selected I
  need to go to another page (add_new_resources.php) but I need to
 pass the
  selected items to add_new_resources.php.
 
 I don't think there are many other possiblities, at least if you
 don't
 want to use JavaScript (and I hope you don't).
 
 Instead of the redirect, you could perhaps use require() to include
 one
 of the two possible pages, and thus avoid one server-client
 roundtrip.
 
  At the moment I have created a page between dept_select.php and
 the other
  pages and added the following code to it:
  ?php
  if ($department==5-14 Curriculum)
  {
  header(Location:5-14_select_area.php);
  }
  elseif ($level==5-14 Curriculum)
  {
  header(Location:5-14_select_area.php);
  }
  else
  {
  header(Location:add_new_resources.php);
  }
  ?
 
 The Location header requires an absolute URI, e.g.
 http://your_host/path/your_file.php.
 
 I'm not sure whether this is a database question ;-)
 
 Regards...
   Michael
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight
to death to defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



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




RE: [PHP-DB] displaying a MySQL date in a different format

2003-01-07 Thread John W. Holmes
[snip] 
 In a receipt to the customer you might want to show them their date of
 order and other information using:
 
 $query=SELECT DATE_FORMAT(o.date, '%m/%d/%Y'),
   it.cost
   FROM order o, item it
   WHERE cust_id = $custId;
 
 To display this:
 $date=$row[DATE_FORMAT(o.date, '%m/%d/%Y')];
 
 echo $date;

As an alternative, you can use a query such as this:

$query = SELECT DATE_FORMAT(o.date, '%m/%d/%Y') as alias, ...

and then print the value with

$date = $row['alias'];
echo $date;

instead of using 

row[DATE_FORMAT(o.date, '%m/%d/%Y')];

It makes things easier to read in your code, too...

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




Re: [PHP-DB] blob

2003-01-07 Thread 1LT John W. Holmes
 I want to be able to load PDFs into mysql DB, but I'm not very familiar
with
 the blob data type?
 Can someone point me on the right direction how to do this?

Use fopen() in binary mode and fread() to read the file into a string, then
insert it into the
database as you would any other variable in any other column. Make
sure you have a large enough BLOB to support your file sizes.

---John Holmes...


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