[PHP-DB] Writing to files (db related) ish

2002-09-25 Thread Dave Carrera

Hi All

I know how to open, read  write to files using Php.

But how can you write some content to a particular place in a file,
Not the start or end but say the middle some where.

Example:

Basic html file

html
head
title/title
/head
body

Write my stuff here!!!

/body
/html

This eventually will relate to a db so I hope its not completely of
topic.

Sorry if it is.

Web resources, examples, tutorials gratefully received.

Thanks in advance

Dave C


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




[PHP-DB] Sync MySql to MS Sql database

2002-09-25 Thread Matt Brown

Hi,

I not sure if this maybe the most appropriate group to post to but it is
kind of related.

Here goes:

I have a client who runs an internal Ms Sql database. They have a website
which runs a php/mysql backend for storing data. They want to be able to
synchronize the data between the two to keep it up to date.

Does anyone know of a script/class that handles something similar to this ?

Seems pointless to re-invent the wheel if its already been done.

Regards

Matt


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




[PHP-DB] Stress Test Script?

2002-09-25 Thread Jay

Does anyone have a good php script that will test (i.e. benchmark) my MySQL
machine and my Web server?

Thanks!


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




[PHP-DB] Breeders database

2002-09-25 Thread Russell Griechen

Here is the kernel ...What other attributes/indexes in the  table would
I need to generate a 5 generation pedigree...I am still trying to find
those queries.

# Host: localhost Database : hounds

# 
#
# Table structure for table 'hound'
#

DROP TABLE IF EXISTS hound;
CREATE TABLE hound (
   id bigint(21) NOT NULL auto_increment,
   name varchar(100) NOT NULL,
   PRIMARY KEY (id)
);

#
# Dumping data for table 'hound'
#


# 
#
# Table structure for table 'parent'
#

DROP TABLE IF EXISTS parent;
CREATE TABLE parent (
   id bigint(21) NOT NULL auto_increment,
   sireid bigint(21) DEFAULT '0' NOT NULL,
   damid bigint(21) DEFAULT '0' NOT NULL,
   PRIMARY KEY (id)
);

#
# Dumping data for table 'parent'
#

Russell Griechen


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




[PHP-DB] Multiple Referral Levels

2002-09-25 Thread Daren Cotter

I'm using MySQL to attempt to track multiple referral
levels for a web site. I.e., member 1 refers 2, 2
refers 3, 3 refers 4...member 4 is is on member 1's
3rd referral level.

Anyway, I need to be able to compile a list of the #
of referrals for a specific member on any given level
(up to 12 levels), and I'm trying to determine the
best database setup. I know that a normalized setup
could be:

table:
id int unsigned not null auto_increment
referer int unsigned null
primary key (id)
key (referer)

With this setup, inserting new members would be no
problem. Grabbing the number of referrals for a member
on level 1 would be easy:
SELECT count(*) FROM table WHERE referer = 1
Second level wouldn't be too difficult either, using a
join, but 3rd level and on would be done how? Is it
even possible? I'm aware I could setup some sort of
recursive function, but if a member has 5,000
referrals on level one, I certainly don't want to run
5,000 queries and total the results to get level 2.

So perhaps a design more like:
id
ref1
ref2
ref3
etc
would be better? It's not normalized, but it might do
the job...querying any member's referrals for a
specific level would be no problem. The signup process
would have a bit more work to do, because it'd have to
recursively find the referer all the way up of course.

Bottom line, is I'm looking for the best database
setup that will accomodate my needs (I NEED to be able
to run a queyr that shows me the # of referrals broken
down by level for a member).

Ideally, the # of referral levels would be variable,
meaning the database should not be setup in a way to
accomodate x referral levels, but instead should
accomodate 0-12.

I know there are websites that achieve this (whether
they use MySQL, I don't know)...can anyone offer any
insight?



__
Do you Yahoo!?
New DSL Internet Access from SBC  Yahoo!
http://sbc.yahoo.com

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




[PHP-DB] php and javascript

2002-09-25 Thread Smita Manohar

hii all,
in my php script, im havin one form, in which having checkboxes. values for 
which are coming from database, and i want to do some action for  checked 
vales. so i create array of that checkbox.
now i want to include one link for Check All which helps user to check all 
boxes in single click. since that form is too big, i dont want to reload the 
entire page. hence trying to use javascript for this stuff.

i've included one more check box for Check All
which is used as,
INPUT type=checkbox name=chk_select_all 
   onclick=javascript : func_select_all()

which when clicked invokes function to select all checkboxes.

the function func_select_all has been defined in the head /head
as,
script language=javascript
function func_select_all()
{

if(document.subj_frm.chk_select_all.checked)
{
for(i=0;inum_rows ; i++)   //num_rows variables have been defiened 
in the beginning.
 {
  document.subj_frm.chk_id[i].checked=true
}
   }
else
   {
 for(i=0;i=num_rows; i++)
{
document.subj_frm.chk_id[i].checked=false
   }
   }

}
/script

the phpscript where i print checkboxes is,

while ($row = mysql_fetch_array($result))
 {
.
.
.
 echo  td align=centerinput type=checkbox name=chk_id[]  
 value=.$row[subj_id]. /td ; // values for which 
are coming from database

.
.
.
}
now in the above line (in phpscript) name of the checkbox is chk_id[] i 
should define it as array, since i have to pass array of all checked values. 
but when i select the check box named,  chk_select_all (see above code) it 
goes to the function defined in javascript func_select_all but there it 
gives error for checkbox name, since i've defined it as an array(in 
phpscript), instead if in my phpscript i dont specify it as an array, ie,
  echo  td align=centerinput type=checkbox name=chk_id   
value=.$row[subj_id]. /td ;

javascript function works fine, and it selects all checkbox values. but in 
that case, my php code doesn't work fine, since checkbox value is not array, 
it cant remeber checked values.

can anyone pls suggest something? of can give other solution to check all 
values without reloading the page

thanks in advance
smita.



_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




RE: [PHP-DB] Multiple Referral Levels

2002-09-25 Thread Ryan Jameson (USA)

For performance sake I'd recommend having a table configured just like your first 
example minus referer as well as a seperate table that is:

(table references)
id
referer
int level

Anytime you add a new user you climb the chain until you hit the top of the chain, for 
each user you pop in an id, referer combination. Level would be how far away the user 
is or which recursion you're on. That way to get a list of referers within N 
generations you would say:

select * from references left join people on references.referer = people.id where id = 
thePersonIAmLookingFor and level = N

This does mean all inserts must occur in this way or you would have to process the 
existing data to create the references table.
... there may of course be a better way. :-)

 Ryan


-Original Message-
From: Daren Cotter [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 25, 2002 12:08 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Multiple Referral Levels


I'm using MySQL to attempt to track multiple referral
levels for a web site. I.e., member 1 refers 2, 2
refers 3, 3 refers 4...member 4 is is on member 1's
3rd referral level.

Anyway, I need to be able to compile a list of the #
of referrals for a specific member on any given level
(up to 12 levels), and I'm trying to determine the
best database setup. I know that a normalized setup
could be:

table:
id int unsigned not null auto_increment
referer int unsigned null
primary key (id)
key (referer)

With this setup, inserting new members would be no
problem. Grabbing the number of referrals for a member
on level 1 would be easy:
SELECT count(*) FROM table WHERE referer = 1
Second level wouldn't be too difficult either, using a
join, but 3rd level and on would be done how? Is it
even possible? I'm aware I could setup some sort of
recursive function, but if a member has 5,000
referrals on level one, I certainly don't want to run
5,000 queries and total the results to get level 2.

So perhaps a design more like:
id
ref1
ref2
ref3
etc
would be better? It's not normalized, but it might do
the job...querying any member's referrals for a
specific level would be no problem. The signup process
would have a bit more work to do, because it'd have to
recursively find the referer all the way up of course.

Bottom line, is I'm looking for the best database
setup that will accomodate my needs (I NEED to be able
to run a queyr that shows me the # of referrals broken
down by level for a member).

Ideally, the # of referral levels would be variable,
meaning the database should not be setup in a way to
accomodate x referral levels, but instead should
accomodate 0-12.

I know there are websites that achieve this (whether
they use MySQL, I don't know)...can anyone offer any
insight?



__
Do you Yahoo!?
New DSL Internet Access from SBC  Yahoo!
http://sbc.yahoo.com

-- 
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] I need some information!!!

2002-09-25 Thread Rodrigo

Does anyone know any good scripts for authentication in a site or have specials tips 
to say.i´m using sessions, but do i have to use session before or after the login 
page???


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




RE: [PHP-DB] I need some information!!!

2002-09-25 Thread Hutchins, Richard

Rodrigo,

Check the PHP-DB archives from yesterday and the day before. Lots of
comments about this very subject.

Happy hunting.

Rich

 -Original Message-
 From: Rodrigo [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, September 25, 2002 2:32 PM
 To: PHP
 Subject: [PHP-DB] I need some information!!!
 
 
 Does anyone know any good scripts for authentication in a 
 site or have specials tips to say.i´m using sessions, but 
 do i have to use session before or after the login page???
 
 
 Rodrigo  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




[PHP-DB] Re: unicode with postgresql

2002-09-25 Thread Yasuo Ohgaki

Roslyn Jose wrote:
 hello,
 
 when im creating the postgres database how do i set the character set to utf-8, i 
want to work with unicode, could u give me the syntax. thanks alot.
 

You have things to do. Follow the manual,
then you should be able to use UTF-8

http://www.postgresql.org/idocs/

--
Yasuo Ohgaki


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




[PHP-DB] How to read an image file into a string/array/etc ....???

2002-09-25 Thread Chris Payne

Hi there everyone,

I use the following to read in a text/php etc . file into a string so I can zip 
it, works no problem:

$filename2 = /home/domain/domain33/web/zip/whois.php;
$fd = fopen ($filename2, r);
$filedata = fread ($fd, filesize ($filename2));
fclose ($fd);

However, how can I read a .gif file (For example) into a string or array or something 
so that I can work with it?

Thanks everyone, this is a great list

Chris


[PHP-DB] Re:[PHP-DB] php and javascript

2002-09-25 Thread xde7ori

hy,
if you have found the answer plz send me a copy...
i'm having the same type of problems...
I want to modify or to create a new select option when someone clicks a button.
1. I extract some values from a database
2. i want when someone clicks a button, in the same page, to load other values from 
the database and put them there

it's a sort of dynamic loading ...
thanks for reading and i will help you if could solve this problem..
the part with inserting values from database to the form is done but the rest of the 
part is done in a javascript function that does not works...

 
 From: Smita Manohar [EMAIL PROTECTED]
 Date: 2002/09/25 Wed PM 06:20:48 GMT+03:00
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] php and javascript
 
 hii all,
 in my php script, im havin one form, in which having checkboxes. values for 
 which are coming from database, and i want to do some action for  checked 
 vales. so i create array of that checkbox.
 now i want to include one link for Check All which helps user to check all 
 boxes in single click. since that form is too big, i dont want to reload the 
 entire page. hence trying to use javascript for this stuff.
 
 i've included one more check box for Check All
 which is used as,
 INPUT type=checkbox name=chk_select_all 
onclick=javascript : func_select_all()
 
 which when clicked invokes function to select all checkboxes.
 
 the function func_select_all has been defined in the head /head
 as,
 script language=javascript
 function func_select_all()
 {
 
 if(document.subj_frm.chk_select_all.checked)
 {
 for(i=0;inum_rows ; i++)   //num_rows variables have been defiened 
 in the beginning.
  {
   document.subj_frm.chk_id[i].checked=true
 }
}
 else
{
  for(i=0;i=num_rows; i++)
 {
 document.subj_frm.chk_id[i].checked=false
}
}
 
 }
 /script
 
 the phpscript where i print checkboxes is,
 
 while ($row = mysql_fetch_array($result))
  {
 .
 .
 .
  echo  td align=centerinput type=checkbox name=chk_id[]  
  value=.$row[subj_id]. /td ; // values for which 
 are coming from database
 
 .
 .
 .
 }
 now in the above line (in phpscript) name of the checkbox is chk_id[] i 
 should define it as array, since i have to pass array of all checked values. 
 but when i select the check box named,  chk_select_all (see above code) it 
 goes to the function defined in javascript func_select_all but there it 
 gives error for checkbox name, since i've defined it as an array(in 
 phpscript), instead if in my phpscript i dont specify it as an array, ie,
   echo  td align=centerinput type=checkbox name=chk_id   
 value=.$row[subj_id]. /td ;
 
 javascript function works fine, and it selects all checkbox values. but in 
 that case, my php code doesn't work fine, since checkbox value is not array, 
 it cant remeber checked values.
 
 can anyone pls suggest something? of can give other solution to check all 
 values without reloading the page
 
 thanks in advance
 smita.
 
 
 
 _
 MSN Photos is the easiest way to share and print your photos: 
 http://photos.msn.com/support/worldwide.aspx
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

Free Email Account at www.flash.ro


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