Re: [PHP-DB] PHP and Access to DB2.

2001-04-30 Thread Phil Jackson

Check www.p2p.wrox.com...more later on this
Phil J.

Nicolas Machado wrote:

 Hy, somebody knows if exist a driver for database access to DB2/400, running
 on AS/400.
 Something like a module.

 Thanks.

 ---
 Este Mail NO contiene Virus.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.250 / Virus Database: 123 - Release Date: 18/04/01

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




Re: [PHP-DB] Designing a database

2001-04-22 Thread Phil Jackson

Good Point, Richard - sensible normalization - if duplicating a value here
and there saves you from having to reference 12 tables instead of 3, yes, by
all means.  Also, adapting some standards as to using meaningfull names for
columns - if fieldWidgetSize is char(25) - don't call it something else if
it appears elsewhere - and don't change it's type!

Phil J.

- Original Message -
From: "Richard Scott Crawford" [EMAIL PROTECTED]
To: "Phil Jackson" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, April 22, 2001 1:17 AM
Subject: Re: [PHP-DB] Designing a database


Don't, however, go overboard with trying to normalize your database.
Don't get me wrong: normalization is good because it saves disk and
memory space (and is quite elegant as well); however, too much
normalization can come at a price in PHP in terms of application speed
and server overhead (not to mention creating coding nightmares if you're
using your web-based application to enter data into your database as well
as pull information from it).


 Original Message 

On 4/21/01, 10:10:19 PM, Phil Jackson [EMAIL PROTECTED] wrote regarding
Re: [PHP-DB] Designing a database:


 Well to start with, I would examine the nature of the data you want to
 store, it's datatype, size, ect.  Follow the other reccommendations as to
 not repeating data
 across tables.  I tend to use autonumber fields for keys quite often.
Also,
 think about what data could go into "domain" tables where you have a
fairly
 non-volitile
 and finite set of values, and you plan on searching on this, and don't
want
 to risk the vagaries of a user spelling it a dozen different ways when
 entereing the datafor example - if you have a fixed number of
locations,
 or computer make - i.e.Dell, Compaq, etc.  Also, be sure and provide
admin
 pages to update these domain tables...maybe next month your company
starts
 buying ABC-brand pcs - add it to the domain table.  When entereing or
 searching - the values in these domain tables populate drop-down
listboxes -
 not left to chance to be entered in a text field

 Phil J.

 Joni Jrvinen - Wandu wrote:

  Hey
 
  I'm quite new to databases so I though I'd ask you for
  some tips in designing a database.
 
  The db that I'm supposed to design holds information
  about workstations: Motherboard (Motherboard id, # of pci slots,
  agp slot etc etc.), Harddisks (Size, in what ide and master/slave, etc),
  the physical location of the workstation and it's hardware configuration
  etc.
 
  So if you could give me some tips and pointers for what tables to create
  etc I would be grateful.
 
  TIA
 
  -Joni-
 
  --
  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 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]




Re: [PHP-DB] PHP question needing info

2001-04-22 Thread Phil Jackson

Paul,
You upload the script to your server and request the page in your browser,
as you would any typical html page.  The server retrieves the page, sees the
php or php3 tag, knows to kick in the php interpreter, tries to parse the
script within the various tags, if successfull, and returns to your browser
an html document - perhaps a page generated dynamicaly from a
databasejust a rough, general idea  of what should happen...an exception
might be when the source of an image is a php file...

In repsonse to an earlier reply expecting "flames" to Paul's question - I
hope that type behavior will not be tolerated -  the goal here is to share
info and all benefit and become more proficient - folks come into this from
all levels of experience - The only really stupid questions are those that
go un-asked!

My Thoughts,

Phil J.


Paul S wrote:

 I have a question that I need help with.

 The question is that how do I execute a script in PHP.

 __
 Do You Yahoo!?
 Yahoo! Auctions - buy the things you want at great prices
 http://auctions.yahoo.com/

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




Re: [PHP-DB] Designing a database

2001-04-22 Thread Phil Jackson

Well to start with, I would examine the nature of the data you want to
store, it's datatype, size, ect.  Follow the other reccommendations as to
not repeating data
across tables.  I tend to use autonumber fields for keys quite often.  Also,
think about what data could go into "domain" tables where you have a fairly
non-volitile
and finite set of values, and you plan on searching on this, and don't want
to risk the vagaries of a user spelling it a dozen different ways when
entereing the datafor example - if you have a fixed number of locations,
or computer make - i.e.Dell, Compaq, etc.  Also, be sure and provide admin
pages to update these domain tables...maybe next month your company starts
buying ABC-brand pcs - add it to the domain table.  When entereing or
searching - the values in these domain tables populate drop-down listboxes -
not left to chance to be entered in a text field

Phil J.

Joni Jrvinen - Wandu wrote:

 Hey

 I'm quite new to databases so I though I'd ask you for
 some tips in designing a database.

 The db that I'm supposed to design holds information
 about workstations: Motherboard (Motherboard id, # of pci slots,
 agp slot etc etc.), Harddisks (Size, in what ide and master/slave, etc),
 the physical location of the workstation and it's hardware configuration
 etc.

 So if you could give me some tips and pointers for what tables to create
 etc I would be grateful.

 TIA

 -Joni-

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




Re: [PHP-DB] PROBLEM IN INSERTING TEXT WITH SINGLE QUOTE

2001-04-22 Thread Phil Jackson

Try stripslashes(fieldname) to "unescape" those slashes when retieving from DB

Phil J.


Jennifer Arcino Demeterio wrote:

 Hello all,

 I am having a problem in inserting text with apostrophe to mysql database.

 When a user fills out a form field that includes an apostrophe ex. Jen's ,
 the verify screen shows it as  Jen\'s and it
 is then input into the database as Jen\'s - automatically adding
 the backslash.  The problem is that when the record is pulled out of the MySQL
 database into my display script it also shows up as Jen\'s - with
 the backslash - but I want viewers to see it as Jen's - without the
 slash.  Then, if I modify the record and don't take out the slash, it adds
 an additional slash so I wind up with Jen\\'s.

 Can someone help me with my problem?

 Thanks in advance,
 Jen


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




Re: [PHP-DB] mysql -- Commercial DBs, When will I need to upgrade?

2001-04-22 Thread Phil Jackson

Some good advice already given, and I quite agree.  MySQL is no light-weight - 
comparable to MS SQLServer and Oracle in performance.  Also, running the DB on a 
dedicated DB server may buy some performance.  If you must check out SQLServer, then 
http://www.sqlteam.com is a good place to start.  At work we are an ASP shop, and have 
used Access for some lightweight apps, but the mandate now is to use IBM's DB2 UDB 
product - a DB2 database server, also, a mainframe IBM OS-390 DB2 database.  Don't 
know the price tag, but they are very robust databases, if a bit quirky getting 
Microsoft stuff to talk to IBM stuff...
You could connect via the ODBC functions of PHP.
Also try looking at http://www.4guysfromrolla.com and http://www.asptoday.com - not 
trying to sell ASP - just good and varied resources with good articles about
databases in general can be found there in addition to asp material...

Phil J.


Doug Schasteen wrote:

 I've been programming PHP w/ mysql for almost 2 years now for my company. We develop 
online testing and surveying software. We are currently running operations for a few 
specific companies where maybe 20-30 tests will be taken online per day (it requires 
pulling the test questions out of the database in random order, and then putting all 
of their answers into the database at the end of the test.) This is currently running 
on a shared webserver using php3 and mysql. Recently we've been talking about some 
projects that will require a lot more use. (Could be 100 people taking a test at once 
or it could be 1000 people taking a test at once. We don't know yet.)

 If anyone has had some experience with upgrading as your operations grow, I'd 
appreciate if you could answer ANY of the following questions:

 1. At what point will mysql blow up (how many tests could be taken at once? How many 
rows of results could be stored in a table before it bogs down?)

 2. At what point will we need a dedicated server instead of shared-hosting?

 3. How fast of a server do we need? Will a 1ghz server outperform a 500mhz server 
when using apache-php-mysql?

 4. If we need a new database, what is the next step above mysql? I have some 
experience with Oracle but it is too expensive. Is there anything inbetween that is 
friendly to PHP?

 5. If MS-SQL is an option for a database-upgrade. What are the implications of 
switching our server to a win32-based server? Will we have problems with PHP on 
windows when all of our scripts were programmed for unix?

 I realize these are a lot of questions and that we probably need some consulting 
work done, but if any of you could share your knowledge on any one of those topics I 
would really appreciate it. I just need something to give me a head start in my 
research. Point me in the right direction!

 - Doug Schasteen
   [EMAIL PROTECTED]

 P.S. - if you know of any good articles online that compare different servers or 
databases please share.


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




Re: [PHP-DB] Designing a database

2001-04-22 Thread Phil Jackson

Duke,
The best thing is to get a good book on the subject.  There is 1st normal
form, 2nd normal formetc. (quite a few).

I would think that 1st normal form should do (i.e. no repeating groups as in
address1, address2...addressN)  Look at how the data relates to each other.
The nature of relationships - one to one, one to many, many to one.

Example - database of students, classes, and class schedules - at minimum you
would have a table of student data, a table of all course offerenings as
classes, and a table that
associated a student with a particular class for a particular date/time.
Take that further, you might want to break out the class descriptions, etc.
into a separate table, associate
by the course-id, and perhaps a section number uniquely identifies a class,
ex. - Computer Science 302 at 10:00 am MWF...

The key is to create your tables so that there is maximum flexiblity, but
keep it simple enough that you don't have to join 30 tables together to
display one studen't class schedule...

Phil J.

Duke Normandin wrote:
I asked this a year or so ago, but never did receive a "practical" reply

 that I could understand. So I'll give it another shot...

 What are the "nuts-and-bolts" of normalization? In a "practical" sense,
 how do you guys go about doing it? Do you create a spreadsheet or
 something, and start creating 'test' tables and see how they pan out?

 I understand what the 'goal' of normalization is suppose to be, I just
 never stumbled on a method of achieving it. Know what I mean?
 Tia...
 --
 -duke
 Calgary, Alberta, Canada

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




Re: [PHP-DB] selecting from multiple tables on one database

2001-04-22 Thread Phil Jackson

Try using :
SELECT table1.UserName
 , table1.City
 , table1.State
 , table2.Sex
 , table2.Age
 ,table3.SpouseAge
FROM   table1
, table2
, table3
WHERE table1.UserName = table2.UserName
AND table1.UserName = table3.UserName

You have to have a common field upon which to join the tables - I'm suprised you only
got 12 rows back - you haven't given any selection criteria for tables 2 and
3!  Also, if you'll format your queries as above (with whatever line continuation
character PHP requires, if any...don't remember!)  you will find them easier to read,

maintain, and also spot obvious errors.

Hope this helps,
Phil J.


Todd Pillars wrote:

 I have checked the mysql.com docs and phpbuilder.com and zend.com and I am
 more confused than ever on selecting a single common record from multiple
 tables. Here is what I have so far.

 MySQL 3.23.22
 PHP 4.0.3pl1
 RedHat 6.1

 members

 table1
 ID  # auto_increment
 UserName# unique
 Name
 Address
 City
 State
 ZIP

 table2
 ID  # auto_increment independent of table1
 UserName# unique
 Birthday
 Sex
 Age

 table3
 ID  # auto_increment independent of table1 and table2
 UserName
 SpouseName
 SpouseBirthay
 SpouseAge
 DateTime# last update

 I am trying to pull out UserName, City, State from table1 - Sex, Age from
 table2 - and Age from table3 where the ID number of table1 is '1'; Meaning I
 only want one row containing the common information.

 If I use the following select statement I get 12 rows of data that do not
 contain what I am looking for!

 SELECT table1.UserName, table1.City, table1.State, table2.Sex, table2.Age,
 table3.SpouseAge FROM table1, table2, table3 WHERE table1.ID = '1'

 Can someone help please, or at least send me in the right direction?

 t.

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




Re: [PHP-DB] uploaded images display

2001-04-22 Thread Phil Jackson

In the last part of a script that loads the image into the database:

 $qs = FetchImage.php3?nbr=.$lastone;
 echo center;
 echo image src='.$qs.';

Where $lastone is a reference to the image just inserted into the DB:
  $lastone = mysql_insert_id($someonnection);

Notice that the img src is a php file - we have to change gears here and fetch
the image from the DB and set the content type accordingly to a binary type

from FetchImage.php3:
 $db = mysql_select_db(fractalv, $someonnection) or die (db);
 $sql = SELECT * FROM pictures WHERE picturesID =.$nbr;
 $sql_result = mysql_query($sql,$someonnection) or die (no result);
 $RecordCount = mysql_num_rows($sql_result);
 $row = mysql_fetch_array($sql_result);
 $thisphoto = $row[picture];
 $contenttype = $row[pictureType];
 mysql_close($fvconnection);
 header(Content-type: $contenttype);
 echo $thisphoto;
  ?

Make sense?  Follow the link I gave to the previous post for more extensive
info...

Phil J.





Sharmad Naik wrote:

 I have written a small script having connectivity with postgresql which
 can upload an image and display the already uploaded images.
 But it doesn't display the uploaded images. I guess the problem lies somewhere
 in  $file_url.
 Pls help me

 HTML
 HEAD
 TITLE/TITLE
 /HEAD
 ?

 $database=pg_connect(dbname=testdb user=postgres)

 ?
 ?
 if ($submit) {

 $result = pg_Exec($database,INSERT INTO .
 images (mem_id,mem_image) VALUES(NULL,'$fupload_name'));

 $file_dir = /tmp;

 $file_url = http://sanico.sharmad.org;;
 if (isset($fupload ))
 {
 if ($fupload_type == image/jpg ||$fupload_type == image/jpeg)
 {
  copy ($fupload, $file_dir/$fupload_name) or die (Couldn't copy);
 echo($file_dir/$fupload_name);
 }
 }
 }

 $result=pg_Exec($database,SELECT mem_image from images);
 for($i=0;$ipg_NumRows($result);$i++){
 $images=pg_Result($result,$i,0);
 copy ($file_dir/$images,$ftupload);
 echo ( $images);
 echo ( $ftupload);
 echo (IMG SCR= $ftupload);
 }

 ?
 BODY BGCOLOR=#FF
 FORM  action=? print $PHP_SELF? method=post
 enctype=multipart/form-data
 !-- INPUT TYPE=hidden name=MAX_FILE_SIZE VALUE=51200 --
 INPUT TYPE=hidden NAME=$fupload_name VALUE=? echo $fupload_name ?
 INPUT TYPE=file name=fupload VALUE=BR
 INPUT TYPE=submit NAME=submit VALUE=Send File to Web Server
 /FORM
 A HREF=index.php CLASS=contentHome page/A
 /BODY
 /HTML


 -thanks
 --
 The secret of the universe is @*í!'ñ^#+ NO CARRIER
 ___  _  _  _
 |_|_||_||_||\/||_|| \
 _|| || || \|  || ||_/

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




Re: [PHP-DB] sessions and page has expired warning

2001-04-12 Thread Phil Jackson

Here, I think you may be over - using session variables a bit...have not used them in 
php, as I have version 3, which doesn't support them.  However, by day I am an ASP 
developer, and article after article I read warns about session variables!  They are 
great, but can hog
memory, especially if you have many users concurrently, so I would use them sparingly, 
just when you have to.

The "back" button problem - here is where a session variable might be usefull, if you 
want to force a particular order of website traversal and not allow them to go back - 
when leaving, say page 1 - set a session variable $visitedPageOne = true
On the top of that page, first thing - check for the value of $visitedPageOne, if 
true, redirect to the next page, ect.

Phil J.


olinux wrote:

 I am using sessions to store variables until all forms have been filled out. at this 
point they are put into the db.
 I would like to know how i can eliminate the problem that occurs when the user 
presses the back button.  I receive a "warning, page has expired... press refresh" I 
know that pressing refresh works fine, but some people do not understand and get 
confused. How can i fix this?

 thanks much
 olinux


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




Re: [PHP-DB] Uploading file into database

2001-04-12 Thread Phil Jackson

Hi,
ok, first of all make sure your form tag is like :
form method="POST" name="ImageForm" action="UploadImage.php3" 
ENCTYPE="multipart/form-data"

The ENCTYPE is important!

Next, make sure you have a field like:
input type="file" size="50" name="txtImage"
type="file" is important!  This will present a browse button for the user to browse 
their drives


something like this seems to work - drop the addslashes if it is not a binary file, 
such as an image

$filecontents = addslashes(fread(fopen($txtImage, "r"), filesize($txtImage)));
$thisfiletype = $txtImage_type;
 $db = mysql_select_db("somedb", $someconnection) or die ("db");
 $sql = "INSERT INTO Images (..all the fields...) VALUES ('$filecontents',...and all 
the rest of the fields')";

 $sql_result = mysql_query($sql,$someconnection) or die ("could not insert into DB");
  mysql_close($someconnection);

--

Hope this helps..

Phil J.








Zeus wrote:

 I'm trying to do a filexchange script.

 Does anyone know how to upload a file into the database such that when I do a 
'select *' query, I can click on a link the download that file.


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




Re: [PHP-DB] insert binary file into MSSQL

2001-04-06 Thread Phil Jackson

Hi,
Check out
http://www.zdnet.com/devhead/stories/articles/0,4413,2643888,00.html
for a good workable example of using PHP/MySql to do this - the principles
should
be the same.

Also, search www.asptoday.com for the word "blob" to find some good articles

on the topic.

Phil J.


Marcel Liberda wrote:

 Anybody got a sample script for store/retrieve binary data (images, wav
 files, mp3) to/from a MSSQL database (7.0)?

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




Re: [PHP-DB] Oracle vs MS SQL vs MySQL

2001-04-04 Thread Phil Jackson

Brian,
To echo your other replies, there is always a trade-off between cost, ease of
mainenance, usability, and functionality.
PHP seems to go quite hand-in-hand with MySQL, despite some limitations.  I'd
take a look at the MySQL site and
see first if you can live with those limitations.

Ive been living in an ASP/Access world for the past year, for mostly "light"
internet and intranet applications.  Due to the mainfame
side of our IS dept. and the fact that we have a Data Adminstration dept.
that is dedicated to IBM's DB2, we are required to use
the DB2 UDB database (a DB2 server on PC, if you will) for future
development.  Best I can say here to anyone is "stay away"!
My vote is with MySql, unless you'vegot to do triggers, sub-selects, or
views, or simply have to create work for a pre-existing DBA

Phil J.




"Brian.J.Mauter" wrote:

 Hey,

 Has anyone tried out all three of these DBMS packages and evaluated them?
 I was wondering what everyone is having the best luck with when writing
 PHP scripts.

 I'm using Oracle8i and if you don't mind, it's a pain in the tail.  :-P

 While I'm asking, let's not limit it to just those three, if anyone is
 overwhelmingly pleased with something else, name it please! :-)

 Thanks,
 Brian

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




Re: [PHP-DB] Varible insert

2001-04-04 Thread Phil Jackson

Hmmm...given that the form fields all had the same names - i.e. you were
performing
the same sql, you could use and include or "required" file that did all the DB
work.
Or - you could have a generic includr file function that you passed a
connectstring and
sqlstring to as variables

Phil J.


Shannon Doyle wrote:

 Hi People,

 It seems like all I am doing lately is going into areas of php that I
 haven't done before and get stuck. Anyway, here is another small request
 that I have.

 I have a series of pages that must insert into a mysql database the results
 of the entries. I know how to insert these details into a database, however
 there are over 200 entries across 20 or so pages. What I am in need of doing
 is the following:

 Is there a way of creating one insert statement that can be used by all
 pages to insert the data from the fields into the appropriate fields in the
 database? ie the sql insert statement is dynamic and will adapt.

 I have an idea that maybe the "get" method on the form will be of some help,
 but not sure.

 Any ideas etc would be helpful.

 - Shannon

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




Re: [PHP-DB] Validating forms

2001-04-02 Thread Phil Jackson

Julio,

It is much more efficient to do that type of validation client-side, using
Javascript.  No
sense in making another round trip to the server if not necessary.

Here is a quicke example:
  if (document.autoform.txtVehicleNumber.value == ""){
  document.autoform.txtVehicleNumber.focus()
  alert("Enter fleet vehicle number")
  return false
}

Have a look at http://www.wsabstract.com/ for good javascript info.

good luck,

Phil J.

"Julio Cuz, Jr." wrote:

 Hi--

 I have a form that cannot have a specific field blank, so I would like to
 add a message box saying "fill out the x field," is there a way to do this
 WITHOUT having to refresh the page?

 Julio Cuz, Jr.
 Riverside Community College
 [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 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]




Re: [PHP-DB] Search results

2001-04-01 Thread Phil Jackson

I've not seen the limit function, but it sounds quite uselfull.  Whatever method,
you could
pass the first or last keys related to the current page and an indication as to
whether you
are going forwards or backwards - I suppose that in PHP it could all be done in
one file,
self-referential-like, as the "arrows" would somehow comprise a form.

Phil J.


CC Zona wrote:

 In article 001301c0bafa$34d15be0$[EMAIL PROTECTED],
  [EMAIL PROTECTED] ("David Drummond") wrote:

  Can anyone tell me what is the best way to implement displaying multiple
  search results using next and previous buttons to cycle through all the
  results.  I see this method done on a lot of sites but don't know how to do
  it in PHP.

 "Limit" is how it's commonly done (though what's "best" really depends on
 what you're doing).  In mysql, it would be something like:

 mysql_query("select foo from bar limit 5,10",$connect) //show ten records
 from result set, starting with the sixth

 I believe phpbuilder.com has a tutorial on this.  If not them, then you
 shouldn't have much trouble finding examples on one of the other PHP
 tutorial sites.

 --
 CC

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




Re: [PHP-DB] send a html page into an email

2001-03-31 Thread Phil Jackson

I think you will have to send mime mail to send the page as an attachment.
See
http://www.wrox.com/Books/Book_down.asp?section=11_3isbn=1861002963subject=subject_id=

There you can download some source code from the "Proffesional PHP" book as
a zip file.  There will be a "mime_mail.inc" and a "mail.php" file that are
good examples.

Phil J.


"Pedro M. S. Oliveira" wrote:

 hello all. this is what i need to do
 i have a dinamic page, buitl with mysql and php,
 and then i have this form saying, send this page to a friend.
 how can i send the content of the page to an email addy?
 thank you all

 ***
 Pedro Miguel Silva Oliveira
 Cell Phone: +351 96 5867227
 SMS: [EMAIL PROTECTED]
 Email: [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 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]




Re: [PHP-DB] count function?

2001-03-30 Thread Phil Jackson

What is retrieved if you do a Select Count(*) from myDb where
condition = parameters?

Seems your result set should contain this value...
Phil J.


DC wrote:

 Hi All
 I cant quite work out how to count the number of rows in my mysql db that
 match a certain critieria and the show that number numericaly in my pages.

 Checked books, php.net etc.

 Any help is appreciated

 Yours Dave C

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




Re: [PHP-DB] How to eliminate bad fields from a mysql query?

2001-03-30 Thread Phil Jackson

If there are some fields that you absolutley require, or must be in a valid
format,  I'd
use javascript to edit the form first - no reason to make a round trip to
the server for
something you can do server-side.

**Or** - say the form is for selecting an automobile - make is required but
color isn't
nor is model.
$sql = "Select * from someDB where make =" . $make;

If $model  "" {
  $sql = $sql . " And model = " . $model;
  }

If $color  "" {
  $sql = $sql . " and color=" . $color
  }

Build your sql string incrementally and conditionally - check what you can
client-side..

Phil J.


Bob Stone wrote:

 Dear PHP Helpers,

 Can you direct me to a solution for this problem:

 How can I eliminate bad (blank or incorrect) fields
 from a mysql query? In other words, if someone leaves
 a form field blank or enters a value that does not
 have a matching entry in the database, how can I
 eliminate that variable from the query?

 The query that I am using now works fine if the user
 enters a value in field that exists in the database.
 However if a field is left blank or incorrect data is
 entered, no results will display on the screen.

 Here is the code that I am using:

 $result = mysql_query("SELECT salutation, first_name,
 mid_name, user_name, cert_deg, job_title, institution,
 address_1, address_2, geo_loc, state, zip, country,
 phone, fax, e_mail FROM svt_members where first_name
 like '$first_name'  user_name like '$user_name' 
 institution like '$institution'  state='$state' 
 country like '$country'", $db);

 while ($myrow = mysql_fetch_array($result)) {

 printf("Name: bfont color=\"green\" size=\"5s\"%s
 %s %s %s\nbr/b/font", $myrow["salutation"],
 $myrow["first_name"], $myrow["mid_name"],
 $myrow["user_name"]);

 printf("Credentials and Degrees: bfont
 color=\"blue\" size=\2\"%s/font/bbrJob Title:
 bfont color=\"blue\"
 size=\2\"%s/font/bbrCompany/Institution:
 bfont color=\"blue\"
 size=\2\"%sbr/font/bAddress: bfont
 color=\"blue\" size=\2\"%s %sbr/font/bCity:
 bfont color=\"blue\" size=\2\"%s/font/b
 State/Province: bfont color=\"blue\"
 size=\2\"%sbr/font/bCountry: bfont
 color=\"blue\" size=\2\"%s/font/b   Postal Code:
 bfont color=\"blue\"
 size=\2\"%sbr/font/bVoice: bfont
 color=\"blue\" size=\2\"%s/font/b   Fax: bfont
 color=\"blue\" size=\2\"%sbr/font/bE-mail:
 bfont color=\"blue\" size=\2\"%s\nP/b/font",
 $myrow["cert_deg"], $myrow["job_title"],
 $myrow["institution"], $myrow["address_1"],
 $myrow["address_2"], $myrow["geo_loc"],
 $myrow["state"], $myrow["country"], $myrow["zip"],
 $myrow["phone"], $myrow["fax"], $myrow["e_mail"]);
 }

 So if (for instance) a user enters data for each field
 except institution, how can I get the query to
 disregard $institution?

 Or if there is a better approach that I should be
 using instead of the above, please let me know.

 Thank you,

 Bob

 __
 Do You Yahoo!?
 Get email at your own domain with Yahoo! Mail.
 http://personal.mail.yahoo.com/?.refer=text

 --
 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] MySql Connect question

2001-03-29 Thread Phil Jackson

Hi,
If I were to try to connect to a MySQL DB from some scripting language,
in the connection string what do I put in the "provider=" string for
an ODBC connection?

I'd like to try this from an ASP application using ADO, but need to know
this.  Before
you boo and hiss - I've duplicated the functionality just fine using PHP
and MySQL at
home to grab the binary data from a posted form and upload images just
fine.  We are
attempting to do this using ASP and an IBM DB2 UDB database, and it
seems to choke on the blob field.If I can show that with some minor
changes, an open-source DB could be used for this...

Many thanks to the folks on the list that directed me to the
"addslashes" function that was the key to getting the binary data
cleaned up and into the DB - ask a question of
IBM folks and they'll either try to sell you another product or chuckle
and offer to send
consultants for hundreds of dollars an hour to tell you what you could
figure out if their
reference manuals weren't circular refernces to obtuse garbage...

Phil J.



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




Re: [PHP-DB] variables

2001-03-29 Thread Phil Jackson

Dunno without looking at code, but try storing the value of $customer into a
local variable when the script is invoked - something is wiping it clean.
my thunks,
Phil J.


Scott Kalbach wrote:

 I am having a problem with losing a variables value. What I am doing is
 taking the value from a database, 'customer_id',  and putting it into a
 hidden form value called 'customer'. When I hit submit on the form it sends
 me to a page where it does several queries to several databases and pulls
 information all based on the value $customer.

 I have the individual queries in include files. It does the first 2 queries
 fine,but when it gets to the third, the value of $customer seems to be gone,
 so I get no result for the rest of the query's. I looked in my scripts but
 can't figure out any reason it would lose this value.

 Any ideas?

 Thanks,

 Scott Kalbach

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




Re: [PHP-DB] PHP on WIN32 with DB2 CLI

2001-03-29 Thread Phil Jackson

Chris - I think to use DB2's CLI interface, you need a compiled langauge, like
some flavor of C++ or VB.  I've seen some examples using the CLI interface, so
my question is why on earth would you chose that over generic ODBC?  That CLI is
nasty-looking,
pages of code versus what you can do in a few lines with ODBC.. - but I have a
project
using both DB2 on a mainframe and DB2 UDB - so I am very interested in your
thoughts on all this!
Phil J.


Chris Book wrote:

 Hi,

 I've compiled php before with --with-ibm-db2 to use DB2's CLI driver.  Now
 I'm working on NT with the php binary, and I can't figure out how to connect
 to DB2 except with ODBC.  I would prefer to use the CLI interface than an
 ODBC interface.  Is this possible or am I stuck with ODBC on NT?

 Thanks,
 Chris Book
 [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 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]




Re: [PHP-DB] $vars to JS in a linked js page.

2001-03-29 Thread Phil Jackson

I think your only choices are to put this value into either a database or if
you are using
php4 - to use a session varible - or use a cookie if you are trying to
persist this value
across multiple pages for multiple users...or pass as a querystring to the
next page..
or as a hidden form variable if processed on the same page...depends


psj


John Starkey wrote:

 I've got 2000 pages that are dependent on one include and I don't wanna
 alter it too much and I'd like to use some JS in a linked file. I don't
 wanna include it in and have it displayed.

 Is there a way to do:

 $some_number = $mysql_num_rows;

 link lanuguage="JavaScript" type="text/javascript" src="external.js"

 And use the $some_number variable in that external.js file?

 I've tried several ideas, to no avail. Like: changing the .js to a .php
 and echoing the value, etc.

 Thanks,

 John

 --
 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] Inserting Image as Blob in MySql DB

2001-03-25 Thread Phil Jackson

Hi,
Does anyone know the proper method for inserting an image(*.jpg or
*.gif) into a MySql database blob field?  I am recieving the file via an
html form with the usual enctype for this and input type=file
parameters.  I can save it as just a regular file and then display it
fine on the page, but no way can I update the database with this...and
have tried everything imaginable...surely this is done everyday and is
quite simple.

code snippet below - and yes, I am a php beginner...ASP by day and
trying to learn
PHP by night..
-
$photo  = fopen($txtImage, "r");
$filecontents = fread($photo, filesize($txtImage));
echo "br";
echo "img src='$photo'";
$anotherfile = fopen("/www/htdocs/Survey/$thisfile", "a+");
fputs($anotherfile, $filecontents);
//fclose($anotherfile);
echo "br";
echo "img src='$anotherfile'";
echo "br";
echo $photo;
echo "brbrcenter";
echo "img src='$thisfile'";
$crapola = "101010101";
echo "brbrcenter";



 $connection = mysql_connect("mysql.iticom.net","fractalv","fw348vnj")
or die ("crap!");
 $db = mysql_select_db("fractalv", $connection) or die ("db");
 $sql = "INSERT INTO Images (Image,
ImageType,ImageGallery,ImageLink,ThumbnailLink) VALUES
('$filecontents','$txtImageType', '$txtImageGallery', '$txtImageLink',
'$txtThumbnailLink')";
 $sql_result = mysql_query($sql,$connection) or die ("could not insert
into DB");
 mysql_close($connection);
-ect.

thanks in advance for absolutley any ideas!

Phil J.

.


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




Re: [PHP-DB] Help?

2001-03-25 Thread Phil Jackson

Perhaps the quote marks within quote marks?  PHP,as is javascript, very
particular..
Try:
echo "Name: $row['user_id'].'br\n"; or some such.
or
echo "Name".$row[user_id]."br\n";
It's the quote marks within that are playing havoc..

Phil J.

Chris Hall wrote:

 I keep getting this error on a little project im working on to learn PHP and
 MySQL better:
 Parse error: parse error, expecting `','' or `';'' in
 f:\inetpub\wwwroot\forums\index.php on line 38
 line 38 would be:
 echo "Name: "$row["user_id"]."br\n";
 Can anyone help?

 --
 Chris Hall
 sytems administrator
 funnelbox mediaworks
 [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 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]