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]




[PHP-DB] trouble reading a database

2001-04-22 Thread johndmiller


Below is the output and code for my problem.  When the database gets read,
it returns 0 rows.  When it writes, it says it can't because of duplicate
entry.  FLD_FileName and FDL_Path are the Primary key.

Two questions, what I am doing wrong and is there a better way to create a
string of text then the one used below.

TIA
John

Read_sql SELECT * FROM TBL_Picture WHERE FLD_FileName = "SailBoat.jpg"and
FLD_Path =" /var/www/html/slidecollection/WinterCarnival"
Result of read Resource id #2
Error Results 0
Number or Rows 0
Insert Sql INSERT INTO TBL_Picture VALUES 
("SailBoat.jpg","/var/www/html/slidecollection/WinterCarnival",
"1234","gfgfdgfddg","gfdgfd")
Error Results Duplicate entry 
'/var/www/html/slidecollection/WinterCarnival-SailBoat.jpg'
for key 1Result is of 2 is

//reading the database to see if record already exists
  $result = mysql_select_db ("Picture_DB", $link) or die ("Could not get the 
database");
  $read_sql  = "SELECT * FROM TBL_Picture WHERE FLD_FileName = \"";
  $read_sql .= $fn_FileName;
  $read_sql .= "\"and FLD_Path =\" ";
  $read_sql .= $fn_Path;
  $read_sql .= "\"";
  echo " Read_sql ";
  echo $read_sql;
  $result = mysql_query($read_sql, $link) or die("could not read the table");
  echo "Result of read ";
  echo $result;
  echo " Error Results ";
  echo mysql_errno ($link);
  $number_of_rows = mysql_num_rows($result);
  echo " Number or Rows ";
  echo $number_of_rows;
//if return no rows then we need to add the record
  if  ($number_of_rows == 0){
$insert_sql  = "INSERT INTO TBL_Picture  VALUES (\"";
$insert_sql .= $fn_FileName;
$insert_sql .= "\",\"";
$insert_sql .= $fn_Path;
$insert_sql .= "\",\"";
$insert_sql .= $fn_Year;
$insert_sql .= "\",\"";
$insert_sql .= $fn_DescriptiveText;
$insert_sql .= "\",\"";
$insert_sql .= $fn_PictureName;
$insert_sql .= "\")";
echo " Insert Sql ";
echo $insert_sql;
$result2 = mysql_query($insert_sql, $link);
 // or die("could not write to the table ");
  echo " Error Results ";
  echo mysql_error ($link);
echo "Result is of 2 is";
echo $result2;




-- 
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] Filemaker w/PHP on Linux?

2001-04-22 Thread Jason Lam

Hello!

I am trying to access some data from a Filemaker Pro 5.0 database on Mac OS
with my PHP server on Linux. I know the best way for this is ODBC ( is there
another way?) I installed the iodbc driver manager. I still need the
FileMaker driver on Linux platform to access the database, right?

I have such a hard time finding this driver Does it exist? Do I even
need a driver on Linux since FM on Mac has ODBC driver?

Jason Lam



-- 
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] PHP and MYSQL

2001-04-22 Thread Hector M Banda

Hi all,
I have a form where I collect some  information and then that information is
saved on a local db (mysql). The problem that I'm having is that when the
server is up an running for few hours and when a user clicks the send
button, my page take a long time to communicate with my database and at the
end, I get an e-mail from the output. But what's really strange is that if I
reboot then server and try the page, everything works really fast and in
matter of seconds I get my confirmation e-mail.

I'm wondering if there are some settings  that I can tweak on the server, OS
or on the CMOS to avoid that kind of delay in my form. I'm guessing that
probably after some time the server is going into sleep mode or something.

I'm using PHP4.0 , mysql and apache.

Thanks again for any information,

-hb


-- 
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 Duke Normandin


On Sun, Apr 22, 2001 at 01:28:34AM -0500, Phil Jackson wrote:

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

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]




Re: [PHP-DB] About Time Consume for Search DB

2001-04-22 Thread Ted Rolle

MySQL is an excellent choice for that type of database.

On Sun, 22 Apr 2001, Nagasea wrote:

> Is MySQL good for database (excel format csv) more than 4 megabyte ?
> Is the query process become slower ?


-- 
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] About Time Consume for Search DB

2001-04-22 Thread Nagasea

Is MySQL good for database (excel format csv) more than 4 megabyte ?
Is the query process become slower ?



_
www.kaskus.com - FREE EMAIL SERVICE

-- 
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] nested ifs?

2001-04-22 Thread Johannes Janson

Hi,

> This is the code that I have so far (please note, it is within a
> function)... any ideas of how I can make it work?

this arouses the assumption that is doesn't work. Did you get
errors? And could you supply more information about
your database relations especially about the one of
orders to (probably existing) "ordering persons".

And yes nesting ifs is possible.

Johannes



-- 
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] calling a column into a popup

2001-04-22 Thread Johannes Janson

Hi,

let me get this right. What I understood is the following:

1. Your admin page where you enter the information of a company
2. A Page with a drop-down list where all the company names are listed.
   (These names should then be linked to an information page with more
info?)
3. A page where new companies can be added.

well the drop-down list you can do with a simple while and a select(html)
like
this:
$result = mysql_query("SELECT companyName FROM companyTable ORDER BY
companyName");
echo "";
while (list($c_name) = mysql_fetch_array($result)) {
echo "$c_name";
}

If this is what you want (what I'm not sure about) I'm glad I understood
you. If not supply more detailed information.

Cheers
Johannes

"Beckie Pack" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm creating a database where I'd like to relate a company name field to
all
> the field in the database (mysql).  what i'm trying to do is have a field
> pop up with all the current company names in a pop up list on a browser.
so,
> for example, using a form i can enter all the data for a company including
> name, address, etc. what i'm trying to do is have a popup for the company
so
> if the information is already entered it is there for selection or the
> person can enter a new company if it's not there.
>
> any ideas?
>
> thanks,
> beckie
>
>
> --
> 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 Richard Scott Crawford

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 Järvinen - 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] 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] 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 ,
> the verify screen shows it as   and it
> is then input into the database as  - 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  - with
> the backslash - but I want viewers to see it as  - 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 .
>
> 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]




Odp: [PHP-DB] ? interbase ?

2001-04-22 Thread Jarek Zgoda

Od: "Bart A. Verbeek" <[EMAIL PROTECTED]>
Temat: [PHP-DB] ? interbase ?


> 1.> Can interbase be installed and run on every Unix-type (BSD)?
> I've taken a look on the borland site but they only speak of Linux and
> windows.

Official Borland builds run only on Win32 and Linux. There are several other
platforms supported by Firebird Project (firebird.sourceforge.net).

> 3.> Is it possible to run MySQL and Interbase on the same server?

Yes, they use different ports (MySQL 3360, IB 3050).

> 5.> Does PHP have the same capabilities for Interbase as for MySQL?

Bit less, but Interbase has bit more capabilities than MySQL.

> 6.> How difficult is it to install a binary (not found on Borland site) or
> to compile it from source for a BSD-server?

You can find binaries at firebird.sourceforge.net and www.ibphoenix.com.

> 9.> Why would anyone choose Interbase when they can use MySQL on the same
> server?

IB is best used when you don't want separate data accessible from www and
your corporate data or your site data will be often updated concurrently by
many users.

Cheers
Jarek Zgoda


-- 
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] uploaded images display

2001-04-22 Thread Sharmad Naik

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
 
   
   



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;$i");
}



?>







Home page



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




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 Järvinen - 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 Rasmus Lerdorf

> When a user fills out a form field that includes an apostrophe ,
> the verify screen shows it as   and it

That's because magic_quotes_gpc is enabled in your php.ini file.  You can
turn this off if you wish, or simply do a stripslashes() on the string
you are displaying.

> is then input into the database as  - automatically adding
> the backslash.

No, here you are confused.  Unless you are doing an addslashes() yourself,
it will go into MySQL correctly.

-Rasmus


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




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

2001-04-22 Thread Todd Pillars

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]




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

2001-04-22 Thread John Lim

Some people in the APC mailing list have said that mysql blows up at around
200-300 queries a second.

http://lists.communityconnect.com/pipermail/apc-cache/2001-April/000611.html

Phil Jackson <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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]
>



-- 
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 Järvinen - 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] Can't recognize new line

2001-04-22 Thread Rasmus Lerdorf

nl2br()

On Sun, 22 Apr 2001, Jennifer Arcino Demeterio wrote:

> It works! Thanks for the help!
>
> Anyway, I hope you won't mind if I'll ask you another question, when the
> text type is pulled out from the MySQL
> database into my display script it can't recognize the new line. It diplays
> the text continuously.
>
> Ex.
> < Has He increased his knowledge in his field, the business and its
> operations since his last evaluation?
>
> Has He acquired new skills; upgraded his skills or improved his competence
> level since his last evaluation? >
>
> it displays
>
> < Has He increased his knowledge in his field, the business and its
> operations since his last evaluation? Has He acquired new skills; upgraded
> his skills or improved his competence level since his last evaluation? >
>
>
> 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]
>


-- 
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 "";
 echo "";

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

Notice that the  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
>
> 
> 
> 
> 
> 
> $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;$i $images=pg_Result($result,$i,0);
> copy ("$file_dir/$images",$ftupload);
> echo ( $images);
> echo ( $ftupload);
> echo ("");
> }
>
> ?>
> 
>  enctype="multipart/form-data">
> 
> 
> 
> 
> 
> Home page
> 
> 
>
>
> -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]




[PHP-DB] mssql 2000

2001-04-22 Thread Gian Luca Quinci

Why the mssql_connect don't function with mssql server 2000 ?

Bye
Gian Luca



-- 
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] Can't recognize new line

2001-04-22 Thread Jennifer Arcino Demeterio

It works! Thanks for the help!

Anyway, I hope you won't mind if I'll ask you another question, when the
text type is pulled out from the MySQL
database into my display script it can't recognize the new line. It diplays
the text continuously.

Ex.
< Has He increased his knowledge in his field, the business and its
operations since his last evaluation?

Has He acquired new skills; upgraded his skills or improved his competence
level since his last evaluation? >

it displays

< Has He increased his knowledge in his field, the business and its
operations since his last evaluation? Has He acquired new skills; upgraded
his skills or improved his competence level since his last evaluation? >


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]




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

2001-04-22 Thread Jennifer Arcino Demeterio

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 ,
the verify screen shows it as   and it 
is then input into the database as  - 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  - with 
the backslash - but I want viewers to see it as  - 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 .  

Can someone help me with my problem?

Thanks in advance,
Jen







Re: [PHP-DB] Loading jpg (etc)

2001-04-22 Thread Phil Jackson

Probably the most efficient method - but if you must see:

http://www.zdnet.com/devhead/stories/articles/0,4413,2643888,00.html

For an excellent tutorial by Julie Meloni - her knowledge of PHP is
impressive!

Phil J.


Johannes Janson wrote:

> Hi,
>
> why storing the pictures in the db. just store the link to
> it.
>
> just a thought
> Johannes
>
> "Sharmad Naik" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi,
> > I wanted to know how to store and retrive images like jpeg,bmp from
> > database.I have a table called member with mem_id and photo.
> > Pls instruct how to do it
> > I m using postgresql but any reference would do
> >
> > --
> > 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]


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