Re: [PHP-DB] Variables in a loop

2001-10-29 Thread


From: LeTortorec, Jean-Louis <[EMAIL PROTECTED]>
Date: Mon, Oct 29, 2001 at 04:03:45PM -0500
Message-ID: <615315231286D21182E40008C7B1EED23C6E76@COMPAQ3000>
Subject: [PHP-DB] Variables in a loop

> I'm trying to write a loop to read variables I receive from a form:
>  
> 
> 
>  
>  
> 
>  
>  
> I'd like to get something like:
>  
> for ($i=1; $i<=10; $i++) { $tab[$i]="a".$i ;}
>  
>  
> The expression "a".$i is actually a string, not a variable.  Any idea how to
> "read" the value of that string?
>  
> Thanks for your help.
>  
> Jean-Louis





Why don't you just use an array?









-- 

* R&zE:


-- 
-- Renze Munnik
-- DataLink BV
--
-- E: [EMAIL PROTECTED]
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
--
-- Stationsplein 82
-- 2011 LM  HAARLEM
-- Netherlands
--
-- http://www.datalink.nl
-- 

-- 
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] TREE in a database

2001-10-29 Thread Andrey Hristov

The OASIS project for ad-server uses hierchical system for the sections 
stored in Mysql.
the simplest structure is a  row with 3 fields(node_id - autoincrement, 
parent_id int, data - sometype). the root has parent_id NULL or 0(because 
autoincrements usually starts from 1, but this is subject to change by user).
I think that this makes clear how to implement the tree.

Have fun.


-- 
Andrey Hristov
Web Developer
Icygen Corporation
BUILDING SOLUTIONS
http://www.icygen.com

On Monday 29 October 2001 03:02 pm, you wrote:
> Is there an easy way to implement tree structure in a database.
> Something like file systems do for files.
>
> Hints, links, anything.


-- 
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] Need help with duplicate entries

2001-10-29 Thread Chris Payne





  
  

  Hi 
  there everyone,
   
  I'm working on a project for a friend who 
  owns a travel agent, he has a MySQL database which works very fast, but 
  the problem is that there are alot of duplicate entries.  When I am 
  retrieving the results from the DB and getting it ready to display on the 
  page, how do I eliminate duplicates via a query?  What I mean is (See 
  below) I have backpackeurope.com many times but for different countries, 
  when you search for backpacking it brings all the countries up under one 
  another - how do I make it only bring 1 entry up of each entry rather than 
  all of them?
   
  Confused?  That's how I feel 
  :-)
  Thank you all so much.
   
  Chris Payne
   
  www.backpackeurope.com 
  Backpackers/Hostels in Austria 
  
 
  

  Backpacking and hostelling tips and links for student and budget 
  travellers planning a trip to europe. 
 
  

  
  [EMAIL PROTECTED] - 
  rating: . Category: Accommodation 
  

  

  
  
  




  
  
www.backpackeurope.com 
  Backpackers/Hostels in England 
  
 
  

  Backpacking and hostelling tips and links for student and budget 
  travellers planning a trip to europe. 
 
  

  
  [EMAIL PROTECTED] - 
  rating: . Category: Accommodation 


Re: [PHP-DB] PHP Getting Variables from String

2001-10-29 Thread Jason Wong

On Tuesday 30 October 2001 12:41 pm, Anthony C. Yandell wrote:
> I need help. Say I have a string coming from a page via a form 
> $search_var.  I need it split up into multiple variables...
>
> e.g
>
> $string="These are some words"
>
> I want it to turn into $var1=These, $var2=are, $var3=some, $var4=some
>
> I'm doing this for a search script. Want it to take the input, and
> search a mysql db for each of the keywords... Please e-mail a
> response to [EMAIL PROTECTED]

Checkout the explode() function.


-- 
Jason Wong
Gremlins Associates
www.gremlins.com.hk

-- 
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 Getting Variables from String

2001-10-29 Thread Anthony C. Yandell

I need help. Say I have a string coming from a page via a form 
$search_var.  I need it split up into multiple variables...

e.g

$string="These are some words"

I want it to turn into $var1=These, $var2=are, $var3=some, $var4=some

I'm doing this for a search script. Want it to take the input, and search a
mysql db for each of the keywords... Please e-mail a response to
[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] Re: php and oracle

2001-10-29 Thread Jean Tabel

It seems you don't have flex neither bison installed on your system.
Flex is a lexical analyser generator, and Bison is a parser generator.
There are respectively open-source successors to Unix lex and yacc.

You will find plenty of information or tutorials on the Internet if you
want to. Here is one of my favorites links:
http://epaperpress.com/lexandyacc/index.html

Regarding your current problem, you can either:
- install the rpm's that are needed, probably flex-???.rpm and bison-???.rpm
from
your Linux CD(s)
- get flex and bison at ftp://ftp.gnu.org/non-gnu/flex/flex-2.5.4a.tar.gz
 and ftp://ftp.gnu.org/gnu/bison/bison-1.29.tar.gz,
and build/install the two packages (extract, do "./configure", then do "make
install", as
usual).

Jean Tabel
[EMAIL PROTECTED]

"Marco Orsuni" <[EMAIL PROTECTED]> wrote in message
001a01c15c5a$aed2b0e0$770250a0@ised0">news:001a01c15c5a$aed2b0e0$770250a0@ised0...
> Hallo,
> I have problems installing php in Linux Mandrake 7.2.
>
> Php work, but I can't see the oracle funcions. I guessed I had to
recompile
> the source.
>
> I have downloaded the latest version of php from php.net.
>
> I unzipped the file in /tmp but when I write "./configure" the program go
in
> abend with this message:
>
> creating cache ./config.cache
> checking for a BSD compatible install... /usr/bin/install -c
> checking whether build environment is sane... yes
> checking whether make sets ${MAKE}... yes
> checking for working aclocal... missing
> checking for working autoconf... missing
> checking for working automake... missing
> checking for working autoheader... missing
> checking for working makeinfo... missing
> Updated php_version.h
> checking whether to enable maintainer-specific portions of Makefiles... no
> checking host system type... i586-pc-linux-gnu
> checking for gawk... gawk
> checking for bison... no
> checking for byacc... no
> configure: warning: You will need bison if you want to regenerate the PHP
> parsers.
> checking for gcc... gcc
> checking whether the C compiler (gcc  ) works... yes
> checking whether the C compiler (gcc  ) is a cross-compiler... no
> checking whether we are using GNU C... yes
> checking whether gcc accepts -g... yes
> checking how to run the C preprocessor... gcc -E
> checking for AIX... no
> checking for gcc option to accept ANSI C... none needed
> checking for ranlib... ranlib
> checking whether gcc and cc understand -c and -o together... yes
> checking whether ln -s works... yes
> checking for flex... lex
> checking for yywrap in -ll... no
> checking lex output file root... ./configure: lex: command not found
> configure: error: cannot find output from lex; giving up
>
> what is lex??? and where I did wrong?
>
> thank you very much. Bye
>
> Marco R.
>
>
>



-- 
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] Fatal error: Call to undefined function: pg_connect() in ...

2001-10-29 Thread Fotwun

Compile a dynamic module for use with the dl() function or the php.ini.

./configure --with-pg=shared
make

cp the module in the src/module (pgsql.so) into the location defined for
modules in your php.ini.

either add line to the ini or use the dl('pgsql.so') in your script to call
it.

if you are using a windows box i'm not sure what you do, besides first
switching to an open source OS =). they may already have binaries for
windows modules, though in my experience on unix boxes is that it compares
the the version of php you are running against the version it was compiled
with. if they are different it will error. so watch for that if you find a
compiled module to use. if you do not have access to modify the ini or place
files in the appropriate library directory you will have to request your
admin to do it. if they do not you will need to find another host or use
your own server.

> -Original Message-
> From: Rodolfo Napoles [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 29, 2001 1:43 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Fatal error: Call to undefined function:
> pg_connect() in ...
>
>
> Is there a way to configure php (through the conf file?) to support the pg
> commands? Is there a manual (link) where I can find how to
> compile postgreSQL
> support into PHP? does it mean to compile PHP ?
>
> Thanks
>
> Rick Emery wrote:
>
> > This means that PostgreSQL support was NOT compiled into PHP.
> Therefore,
> > you cannot use PostgreSQL commands.
> >
> > -Original Message-
> > From: Rodolfo Napoles [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, October 29, 2001 2:17 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Fatal error: Call to undefined function: pg_connect()
> > in ...
> >
> > Hello,
> >
> > I am trying to run my first php script to connect to a PostgreSQL
> > database on a Linux box with apache web server.
> >
> > When I try to load the page with the browser i get the following error:
> >
> > Fatal error: Call to undefined function: pg_connect() in
> > /dirname/tryit.php on line 9
> >
> > I was able to create tables on the database via the webadmin tool, so I
> > know that postgres is running properly.
> >
> > Here is my code.
> >
> > 
> > 
> > TESTING PHP4 with PG
> > 
> > 
> > Testing connection to Postgres using php4 from
> > an apache webserver on Linux Mandrake 8.0
> >  >$conn = pg_connect("host=localhost dbname=databasename");
> >if (! $conn) { ?>
> >Can not open connection to Database, contact the site
> > administrator   >   }
> >else
> >   {
> >   $SQL = "SELECT * FROM TABLENAME";
> >   $rs = pg_query($SQL, $conn);
> >   if (! $rs) {?>
> >   Can not execute SQL statement, contact the site
> > administrator   >   }
> >   else
> >   {
> >  do {
> >  while ($row = pg_fetch_row($rs)) { ?>
> > > }
> >  } while (pg_next_result($rs));
> >  pg_freeresult($rs);
> >  pg_close ($conn);
> >}
> >}
> > ?>
> > 
> > 
> >
> > Thanks in advance
> >
> > --
> > 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] get field content

2001-10-29 Thread Rick Emery

$query =  "select ColumnName from tableName WHERE rowNumber =
$rowNumber,$db";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$answer = $row['ColumnName'];


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 29, 2001 4:07 PM
To: PHP DataBase-List
Subject: [PHP-DB] get field content


Help!
I have drawn a blank..
I want to get the content of a field in a table where I know the
databaseName,tableName and columnName and the rowNumber.
Like:
$answer =  mysqlCommand("select ColumnName from tableName WHERE rowNumber =
$rowNumber,$db)


-- 
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] get field content

2001-10-29 Thread phpnet

Help!
I have drawn a blank..
I want to get the content of a field in a table where I know the 
databaseName,tableName and columnName and the rowNumber.
Like:
$answer =  mysqlCommand("select ColumnName from tableName WHERE rowNumber = 
$rowNumber,$db)


-- 
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 PLEASE!! Get query error when inserting into My Sql

2001-10-29 Thread Rick Emery

I don't know about SQL server 7.  However, when using MySQL (as indicated by
your code), it will work.
For instance, if your table is:

CREATE TABLE mytable (
myID int unsigned auto_increment,
value2 int unsigned,
value3 char(50)
)

Then this will automatically increment myID:
INSERT INTO mystable VALUES(NULL,123,"A text string");
INSERT INTO mystable VALUES(NULL,456,"A text string");
INSERT INTO mystable VALUES(NULL,789,"A text string");

-Original Message-
From: Ricky Theil [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 29, 2001 3:12 PM
To: 'Rick Emery'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] HELP PLEASE!! Get query error when inserting into
My Sql


I was never able to assign a null value to get a row to automatically insert
into SQL server 7.  It would always give me an error that said something
like "you cannot assign the value NULL to an identity field."

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent: Monday, October 29, 2001 10:46 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] HELP PLEASE!! Get query error when inserting into My
Sql


This also works:
INSERT INTO vcstats VALUES( NULL,column2,column3,column4,column5)

The NULL value will be replaced with theauto-incremented value in the table
-Original Message-
From: Ricky Theil [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 29, 2001 10:26 AM
To: '[EMAIL PROTECTED]'; Robby Whiteside; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] HELP PLEASE!! Get query error when inserting into My
Sql


If your first field is an auto insert field, then you have to do it like
this:

insert into tablename (column2,column3,column4,column5) values
(value2,value3,value4,value5)

The auto incremented field will be automatically be filled in with the next
available value.

Ricky

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Monday, October 29, 2001 9:24 AM
To: Robby Whiteside; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] HELP PLEASE!! Get query error when inserting into
MySql


If any of the values you are trying to insert are not integers, you need to 
put single quotes around the variables, ie. $SCRIPT_NAME, $date, $BName, etc

in the insert statement.


Robby Whiteside <[EMAIL PROTECTED]> said:

> Hi There,
> 
> I have a query whenever I try to insert something into a mysql table.
> This
is 
> the code I am using:
>  
> $host1 = gethostbyaddr("$REMOTE_ADDR");
> $date = date("Y-m-d h:i:s");
> $link = mysql_connect("$host", "$user", "$passwd");
> mysql_select_db("$database", $link); $sql = "INSERT INTO vcstats 
> VALUES('', $SCRIPT_NAME, $date,
$HTTP_USER_AGENT, 
> $BName, $BVersion, $BPlatform, $REMOTE_ADDR, $host1)"; $result =
> mysql_query($sql) or die("query error" . mysql_error()); 
> mysql_close();
> 
> ?>
> 
> Thanks,
> Robby
> 
> -
> This message was sent using Endymion MailMan.
> http://www.endymion.com/products/mailman/
> 
> 
> 
> --
> 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]



-- 
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] php and outlook2000

2001-10-29 Thread Jingzhao Ou

Hi,

I have maintained a calendar myself using PHP. I wonder if there is any way
that can let my own calendar synchronized with the calendar in outlook2000.
That is, if I add any event to my PHP calendar, then, I can add this to my
outlook2000 as well, and vice versa.

Can anyone help me with this? Thanks a lot in advance!

Best regards,
Jingzhao



-- 
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 PLEASE!! Get query error when inserting into My Sql

2001-10-29 Thread Ricky Theil

I was never able to assign a null value to get a row to automatically insert
into SQL server 7.  It would always give me an error that said something
like "you cannot assign the value NULL to an identity field."

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent: Monday, October 29, 2001 10:46 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] HELP PLEASE!! Get query error when inserting into My
Sql


This also works:
INSERT INTO vcstats VALUES( NULL,column2,column3,column4,column5)

The NULL value will be replaced with theauto-incremented value in the table
-Original Message-
From: Ricky Theil [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 29, 2001 10:26 AM
To: '[EMAIL PROTECTED]'; Robby Whiteside; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] HELP PLEASE!! Get query error when inserting into My
Sql


If your first field is an auto insert field, then you have to do it like
this:

insert into tablename (column2,column3,column4,column5) values
(value2,value3,value4,value5)

The auto incremented field will be automatically be filled in with the next
available value.

Ricky

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Monday, October 29, 2001 9:24 AM
To: Robby Whiteside; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] HELP PLEASE!! Get query error when inserting into
MySql


If any of the values you are trying to insert are not integers, you need to 
put single quotes around the variables, ie. $SCRIPT_NAME, $date, $BName, etc

in the insert statement.


Robby Whiteside <[EMAIL PROTECTED]> said:

> Hi There,
> 
> I have a query whenever I try to insert something into a mysql table.
> This
is 
> the code I am using:
>  
> $host1 = gethostbyaddr("$REMOTE_ADDR");
> $date = date("Y-m-d h:i:s");
> $link = mysql_connect("$host", "$user", "$passwd");
> mysql_select_db("$database", $link); $sql = "INSERT INTO vcstats 
> VALUES('', $SCRIPT_NAME, $date,
$HTTP_USER_AGENT, 
> $BName, $BVersion, $BPlatform, $REMOTE_ADDR, $host1)"; $result =
> mysql_query($sql) or die("query error" . mysql_error()); 
> mysql_close();
> 
> ?>
> 
> Thanks,
> Robby
> 
> -
> This message was sent using Endymion MailMan.
> http://www.endymion.com/products/mailman/
> 
> 
> 
> --
> 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]



-- 
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] Variables in a loop

2001-10-29 Thread Rick Emery

Lookup "Variable Variables" in the PHP manual.  You'll use something like:
${$i}

-Original Message-
From: LeTortorec, Jean-Louis [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 29, 2001 3:04 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] Variables in a loop


I'm trying to write a loop to read variables I receive from a form:
 


 
 

 
 
I'd like to get something like:
 
for ($i=1; $i<=10; $i++) { $tab[$i]="a".$i ;}
 
 
The expression "a".$i is actually a string, not a variable.  Any idea how to
"read" the value of that string?
 
Thanks for your help.
 
Jean-Louis
 
 
 
 


-- 
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 in a loop

2001-10-29 Thread Mark Newnham

http://www.php.net/manual/en/language.variables.variable.php

> -Original Message-
> From: LeTortorec, Jean-Louis [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 29, 2001 2:04 PM
> To: '[EMAIL PROTECTED]'
> Subject: [PHP-DB] Variables in a loop
> 
> 
> I'm trying to write a loop to read variables I receive from a form:
>  
> 
> 
>  
>  
> 
>  
>  
> I'd like to get something like:
>  
> for ($i=1; $i<=10; $i++) { $tab[$i]="a".$i ;}
>  
>  
> The expression "a".$i is actually a string, not a variable.  
> Any idea how to
> "read" the value of that string?
>  
> Thanks for your help.
>  
> Jean-Louis
>  
>  
>  
>  
> 

-- 
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] Variables in a loop

2001-10-29 Thread LeTortorec, Jean-Louis

I'm trying to write a loop to read variables I receive from a form:
 


 
 

 
 
I'd like to get something like:
 
for ($i=1; $i<=10; $i++) { $tab[$i]="a".$i ;}
 
 
The expression "a".$i is actually a string, not a variable.  Any idea how to
"read" the value of that string?
 
Thanks for your help.
 
Jean-Louis
 
 
 
 



Re: [PHP-DB] Fatal error: Call to undefined function: pg_connect() in ...

2001-10-29 Thread Rodolfo Napoles

Is there a way to configure php (through the conf file?) to support the pg
commands? Is there a manual (link) where I can find how to compile postgreSQL
support into PHP? does it mean to compile PHP ?

Thanks

Rick Emery wrote:

> This means that PostgreSQL support was NOT compiled into PHP.  Therefore,
> you cannot use PostgreSQL commands.
>
> -Original Message-
> From: Rodolfo Napoles [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 29, 2001 2:17 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Fatal error: Call to undefined function: pg_connect()
> in ...
>
> Hello,
>
> I am trying to run my first php script to connect to a PostgreSQL
> database on a Linux box with apache web server.
>
> When I try to load the page with the browser i get the following error:
>
> Fatal error: Call to undefined function: pg_connect() in
> /dirname/tryit.php on line 9
>
> I was able to create tables on the database via the webadmin tool, so I
> know that postgres is running properly.
>
> Here is my code.
>
> 
> 
> TESTING PHP4 with PG
> 
> 
> Testing connection to Postgres using php4 from
> an apache webserver on Linux Mandrake 8.0
> $conn = pg_connect("host=localhost dbname=databasename");
>if (! $conn) { ?>
>Can not open connection to Database, contact the site
> administrator }
>else
>   {
>   $SQL = "SELECT * FROM TABLENAME";
>   $rs = pg_query($SQL, $conn);
>   if (! $rs) {?>
>   Can not execute SQL statement, contact the site
> administrator }
>   else
>   {
>  do {
>  while ($row = pg_fetch_row($rs)) { ?>
> }
>  } while (pg_next_result($rs));
>  pg_freeresult($rs);
>  pg_close ($conn);
>}
>}
> ?>
> 
> 
>
> Thanks in advance
>
> --
> 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] Fatal error: Call to undefined function: pg_connect() in ...

2001-10-29 Thread Rick Emery

This means that PostgreSQL support was NOT compiled into PHP.  Therefore,
you cannot use PostgreSQL commands.

-Original Message-
From: Rodolfo Napoles [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 29, 2001 2:17 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Fatal error: Call to undefined function: pg_connect()
in ...


Hello,

I am trying to run my first php script to connect to a PostgreSQL
database on a Linux box with apache web server.

When I try to load the page with the browser i get the following error:

Fatal error: Call to undefined function: pg_connect() in
/dirname/tryit.php on line 9

I was able to create tables on the database via the webadmin tool, so I
know that postgres is running properly.

Here is my code.




TESTING PHP4 with PG


Testing connection to Postgres using php4 from
an apache webserver on Linux Mandrake 8.0

   Can not open connection to Database, contact the site
administrator  
  Can not execute SQL statement, contact the site
administrator  
   



Thanks in advance


-- 
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] TREE in a database

2001-10-29 Thread Rick Emery

Relational databases really are tree structures.  However, whereas a tree
parent node has pointers to children or sibling nodes; in a relational
database, the nodes "point up" to the parent node.  The nodes might also
maintain a field to identify sibling nodes.

-Original Message-
From: Robert Vukovic [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 29, 2001 2:03 PM
To: 'Php-DB'
Subject: [PHP-DB] TREE in a database


Is there an easy way to implement tree structure in a database.
Something like file systems do for files.

Hints, links, anything.


-- 
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] Fatal error: Call to undefined function: pg_connect() in ...

2001-10-29 Thread Rodolfo Napoles

Hello,

I am trying to run my first php script to connect to a PostgreSQL
database on a Linux box with apache web server.

When I try to load the page with the browser i get the following error:

Fatal error: Call to undefined function: pg_connect() in
/dirname/tryit.php on line 9

I was able to create tables on the database via the webadmin tool, so I
know that postgres is running properly.

Here is my code.




TESTING PHP4 with PG


Testing connection to Postgres using php4 from
an apache webserver on Linux Mandrake 8.0

   Can not open connection to Database, contact the site
administrator  
  Can not execute SQL statement, contact the site
administrator  
   



Thanks in advance


-- 
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] TREE in a database

2001-10-29 Thread Robert Vukovic

Is there an easy way to implement tree structure in a database.
Something like file systems do for files.

Hints, links, anything.


-- 
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] Compilation question regarding PHP and MS SQL support

2001-10-29 Thread Scott Teglasi

Hi,  have a compilation question here related to databases.

I'm trying to compile MS SQL support into php by using the freetds 
library, and the --with-sybase-ct directive on the configuration 
script.  I have a problem when trying to link, saying that there's a 
missing library called sybtcl, and a few other ones.. Hunting around for 
some info on this, I found that there's a patch available for PHP 
4.0.3pl1, however not for the latest version (4.0.6)..   

Has anyone had any experience with this?  The MS SQL server runs on a 
win2k box, and I'm compiling PHP for solaris.  Can anyone help?

Thanks,

Scotty



-- 
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] Did you use PHP-Nuke? Need help.

2001-10-29 Thread Jason Wong

On Monday 29 October 2001 20:09 pm, Body of Shadows wrote:
> I installed Red Hat 7.1 (PHP included)  + MySQL 3.23 and wanted
> to launch PHP-Nuke to create sample web site. I got little Linux
> and zero PHP/MySQL knowledge, maybe I am doing something wrong
> but after 2 days of fighting I got enough.
>
> Install file suggests to launch page "admin.php" after the
> installation on the local host,as the result I am getting error:
>
> Fatal error: Call to undefined function: mysql_connect() in
> /var/www/html/mainfile.php on line 42

This error suggests that MySQL support for PHP has not been installed. 
If you used the Redhat RPMs to install PHP then install the PHP-MySQL 
rpm (possibly php-mysql-4.0.4pl1-9.i386.rpm).

So that you won't be mislead, this error has nothing to do with 
PHP-Nuke.

regards
-- 
Jason Wong
Gremlins Associates
www.gremlins.com.hk

-- 
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 PLEASE!! Get query error when inserting into My Sql

2001-10-29 Thread Rick Emery

This also works:
INSERT INTO vcstats VALUES( NULL,column2,column3,column4,column5)

The NULL value will be replaced with theauto-incremented value in the table
-Original Message-
From: Ricky Theil [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 29, 2001 10:26 AM
To: '[EMAIL PROTECTED]'; Robby Whiteside; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] HELP PLEASE!! Get query error when inserting into
My Sql


If your first field is an auto insert field, then you have to do it like
this:

insert into tablename (column2,column3,column4,column5) values
(value2,value3,value4,value5)

The auto incremented field will be automatically be filled in with the next
available value.

Ricky

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Monday, October 29, 2001 9:24 AM
To: Robby Whiteside; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] HELP PLEASE!! Get query error when inserting into
MySql


If any of the values you are trying to insert are not integers, you need to 
put single quotes around the variables, ie. $SCRIPT_NAME, $date, $BName, etc

in the insert statement.


Robby Whiteside <[EMAIL PROTECTED]> said:

> Hi There,
> 
> I have a query whenever I try to insert something into a mysql table. 
> This
is 
> the code I am using:
>  
> $host1 = gethostbyaddr("$REMOTE_ADDR");
> $date = date("Y-m-d h:i:s");
> $link = mysql_connect("$host", "$user", "$passwd"); 
> mysql_select_db("$database", $link); $sql = "INSERT INTO vcstats 
> VALUES('', $SCRIPT_NAME, $date,
$HTTP_USER_AGENT, 
> $BName, $BVersion, $BPlatform, $REMOTE_ADDR, $host1)"; $result = 
> mysql_query($sql) or die("query error" . mysql_error()); 
> mysql_close();
> 
> ?>
> 
> Thanks,
> Robby
> 
> -
> This message was sent using Endymion MailMan. 
> http://www.endymion.com/products/mailman/
> 
> 
> 
> --
> 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]



-- 
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 PLEASE!! Get query error when inserting into MySql

2001-10-29 Thread Ricky Theil

If your first field is an auto insert field, then you have to do it like
this:

insert into tablename (column2,column3,column4,column5) values
(value2,value3,value4,value5)

The auto incremented field will be automatically be filled in with the next
available value.

Ricky

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Monday, October 29, 2001 9:24 AM
To: Robby Whiteside; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] HELP PLEASE!! Get query error when inserting into
MySql


If any of the values you are trying to insert are not integers, you need to 
put single quotes around the variables, ie. $SCRIPT_NAME, $date, $BName, etc

in the insert statement.


Robby Whiteside <[EMAIL PROTECTED]> said:

> Hi There,
> 
> I have a query whenever I try to insert something into a mysql table. 
> This
is 
> the code I am using:
>  
> $host1 = gethostbyaddr("$REMOTE_ADDR");
> $date = date("Y-m-d h:i:s");
> $link = mysql_connect("$host", "$user", "$passwd"); 
> mysql_select_db("$database", $link); $sql = "INSERT INTO vcstats 
> VALUES('', $SCRIPT_NAME, $date,
$HTTP_USER_AGENT, 
> $BName, $BVersion, $BPlatform, $REMOTE_ADDR, $host1)"; $result = 
> mysql_query($sql) or die("query error" . mysql_error()); 
> mysql_close();
> 
> ?>
> 
> Thanks,
> Robby
> 
> -
> This message was sent using Endymion MailMan. 
> http://www.endymion.com/products/mailman/
> 
> 
> 
> --
> 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] HELP PLEASE!! Get query error when inserting into MySql

2001-10-29 Thread biorn

If any of the values you are trying to insert are not integers, you need to 
put single quotes around the variables, ie. $SCRIPT_NAME, $date, $BName, etc 
in the insert statement.


Robby Whiteside <[EMAIL PROTECTED]> said:

> Hi There,
> 
> I have a query whenever I try to insert something into a mysql table. This 
is 
> the code I am using:
>  
> $host1 = gethostbyaddr("$REMOTE_ADDR");
> $date = date("Y-m-d h:i:s");
> $link = mysql_connect("$host", "$user", "$passwd");
> mysql_select_db("$database", $link);
> $sql = "INSERT INTO vcstats VALUES('', $SCRIPT_NAME, $date, 
$HTTP_USER_AGENT, 
> $BName, $BVersion, $BPlatform, $REMOTE_ADDR, $host1)";
> $result = mysql_query($sql) or die("query error" . mysql_error());
> mysql_close();
> 
> ?>
> 
> Thanks,
> Robby
> 
> -
> This message was sent using Endymion MailMan.
> http://www.endymion.com/products/mailman/
> 
> 
> 
> -- 
> 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] Mathematics Examples MySQL and PHP

2001-10-29 Thread Tamas Arpad

> Does anybody have some examples about howto make mathematic
> functions in PHP with values from any
> MySQL table such as:
>
> Value 1 + Value 2 = Value 3
> Value 1 - Value 2 = Value 3
> Value 1 * Value 2 = Value 3
> Value 1 / Value 2 = Value 3

maybe
UPDATE tablename SET field3=field1+field2
...

but it's somewhat hard to undertsand yor question

Arpi

-- 
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] Performance problems in NC

2001-10-29 Thread Mark Newnham

This could be due to missing tags such as /body and /html

> -Original Message-
> From: Andy [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 29, 2001 6:41 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Performance problems in NC
> 
> 
> Hi there,
> 
> I have problems with the performance while using NC. It 
> workes fine with IE.
> As soon as I access the db. It takes aproximatelly 1 -2 min 
> till I see the
> page.
> 
> Does anybody know some help?
> 
> Thank you
> 
> Andy
> 
> 
> 
> -- 
> 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] Resource id #2

2001-10-29 Thread Rick Emery

Change code as follows:

".$row['msg']."";
 ?>

-Original Message-
From: Andrew Duck [mailto:[EMAIL PROTECTED]]
Sent: Sunday, October 28, 2001 7:00 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Resource id #2


I am trying to select a message from a table in a database. the message will
will be in column 'msg' and will be in same row as id='0'.
I need that msg put to the screen. With the code below I get the error:
Resource id #2

Can someone please explain how I can fix this..

Thankyou in advance.

$msg";
 ?>




-- 
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] Mathematics Examples MySQL and PHP

2001-10-29 Thread Rick Emery

What are you trying to do?  Your question/example is very unclear.

-Original Message-
From: Mark Weber [mailto:[EMAIL PROTECTED]]
Sent: Sunday, October 28, 2001 3:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Mathematics Examples MySQL and PHP


Hello Everybody,

Does anybody have some examples about howto make mathematic functions in 
PHP with values from any
MySQL table such as:

Value 1 + Value 2 = Value 3
Value 1 - Value 2 = Value 3
Value 1 * Value 2 = Value 3
Value 1 / Value 2 = Value 3

With kind regards,


-- 
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 table update

2001-10-29 Thread Niklas Lampén

Ok, found the problem.. I've been fighting with this for like an hour
but the error was here:

POSITION() should be LOCATION().. Way to go Niklas! :)


Niklas

-Original Message-
From: Niklas Lampén [mailto:[EMAIL PROTECTED]] 
Sent: 29. lokakuuta 2001 15:46
To: Php-DB
Subject: RE: [PHP-DB] mySQL table update


I have a problem here which I can not find an answer.

My date fields (EmailD in this case) can be in four different formats:

a) dd.mm.
b) d.mm.
c) dd.m.
d) d.m.

So this is what I've tried to do to convert the dates to -mm-dd
format:


INSERT INTO feCompsT (ID, Company, EmailD)
SELECT ID, Company,
CONCAT_WS(
"-",
### Pick the year part, last four charters
RIGHT(
EmailD,
4
), 
### Trying to pick the part from first dot to second dot
### 01.01.2001 or 1.1.2001 etc...
###^^   ^
### This is the problem part. What am I doing wrong?
### It doesn't even work without +1 and -1 thingies
SUBSTRING(
EmailD,
POSITION(
".",
EmailD
)+1,
POSITION(
".",
SUBSTRING(
EmailD,
POSITION(
".",
EmailD
)+1
)
)-1
),
### And finally pick the part before first dot
LEFT(
EmailD,
POSITION(
".",
EmailD
)-1
)
)
FROM feComps LIMIT 50


Thanks in advance!


Niklas


-- 
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 table update

2001-10-29 Thread Niklas Lampén

I have a problem here which I can not find an answer.

My date fields (EmailD in this case) can be in four different formats:

a) dd.mm.
b) d.mm.
c) dd.m.
d) d.m.

So this is what I've tried to do to convert the dates to -mm-dd
format:


INSERT INTO feCompsT (ID, Company, EmailD)
SELECT ID, Company,
CONCAT_WS(
"-",
### Pick the year part, last four charters
RIGHT(
EmailD,
4
), 
### Trying to pick the part from first dot to second dot
### 01.01.2001 or 1.1.2001 etc...
###^^   ^
### This is the problem part. What am I doing wrong?
### It doesn't even work without +1 and -1 thingies
SUBSTRING(
EmailD,
POSITION(
".",
EmailD
)+1,
POSITION(
".",
SUBSTRING(
EmailD,
POSITION(
".",
EmailD
)+1
)
)-1
),
### And finally pick the part before first dot
LEFT(
EmailD,
POSITION(
".",
EmailD
)-1
)
)
FROM feComps LIMIT 50


Thanks in advance!


Niklas


-- 
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] Performance problems in NC

2001-10-29 Thread Andy

Hi there,

I have problems with the performance while using NC. It workes fine with IE.
As soon as I access the db. It takes aproximatelly 1 -2 min till I see the
page.

Does anybody know some help?

Thank you

Andy



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

2001-10-29 Thread DL Neil

ric,
Apologies. Abbreviation "m/c" means "machine".
=dn

- Original Message -
From: "Ric Manalac" <[EMAIL PROTECTED]>
To: "DL Neil" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: 29 October 2001 12:03
Subject: Re: [PHP-DB] background process


> hi,
>
> thanks for the reply. i will look up docs that discuss
> cron. i'm sorry but i didn't get what you mean by
> "m/c". please explain. thanks!
>
> regards,
>
> ric
>
> DL Neil wrote:
>
> > > has anyone here created an application using
> > > background processes? what i have in mind
> > > is to be able to run the background process
> > > once a day to check for files that are more than
> > > 5 days old and delete them. thanks in advance.
> >
> > ric,
> >
> > PHP (and scripts) can be executed from the command line (given that it has been 
>appropriately set up on your
> > m/c). This is discussed in the docs. Thereafter it becomes a matter of setting up 
>a 'trigger' to kick-off
> > execution at set times using CRON (*nix) or AT (Windows?32-bit).
> >
> > =dn
>
> --
>
> ==
> Note: The information contained in this message may be privileged
> and confidential and protected from disclosure. If the reader of
> this message is not the intended recipient,or an employee or agent
> responsible for delivering this to the intended recipient,you are
> hereby notified that any dissemination, distribution or copying of
> this communication is strictly prohibited. If you have received
> this communication in error, please notify us immediately by
> replying to the message and deleting it from your computer.
> Thank you.
> ==
>
>


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

2001-10-29 Thread DL Neil

Olinux,


> Yes, I know what a tree data structure is - how to
> "walk the tree" I'm not sure what you mean.

="Walk the tree" means using the logic of the 'pointers' in each row to work out which 
sub-categories fit within
each category...

But I've
> come up with something quite cool. but still not
> working.

=you haven't shown what the output should look like.
=having unloaded the entire database into an array (and assuming this is 
realistic/possible in the production
environment), there should be no need to go back to the database at all.
=do you have a particular reason for putting the data into an associative array? If 
you make the first
index/dimension into an enumerative array then the pointers in the data will work as 
array elements. What I mean
is, can you turn this schema:

> > > id | parentid | category
> > >  1 | 0 | blah1   top
> > >  2 | 1 | blah2   sub
> > >  3 | 1 | blah3   sub2
> > >  4 | 3 | blah4   sub2->sub

into a table thus:

$menu[1] = 0 | blah1   top
$menu[2] = 1 | blah2   sub
$menu[3] = 1 | blah3   sub2
$menu[4] = 3 | blah4   sub2->sub

Then use a loop to process each row in turn (using, eg index of $i) and when you wish 
to print/process $menu[3]
($i=3 and thus $menu[$i])  you search down the [parentid] column (loop index, eg $j) 
looking for ( $menu[ $j ] =
$menu[ $i ] )
- NB I'm making an assumption about the id-column data!

Ok, regardless, you appear to need an outer 'processing' loop to print each category, 
and an inner loop to pick
up each sub-category (if any exist).

=I'm feeling as if I've made a number of assumptions because I lack the data you know.
=Hope it helps,
=dn


> I select all the data from the catagories table [id |
> pid | category] and drop it into the array
>
> =
> $menu = array();
>
> while ($row = mysql_fetch_array($result)) {
> $id = $row['cat_id'];
> $category = $row['category'];
> $pid = $row['pid'];
>
> $menu[$pid][$id] = $category;
> }
>
>
> foreach($menu as $key1 => $value1) {
> echo "Key: $key1; Value: $value1\n";
>foreach ($value1 as $key2 => $value2) {
>   echo "Key: $key2; Value: $value2\n";
> // delete array that has been printed
> unset($menu[$key1][$key2]);
> }
> }
> =
>
> and out comes:
> Key: 0; Value: Array
> Key: 1; Value: Automotive
> Key: 4; Value: Technology
> Key: 1; Value: Array
> Key: 2; Value: Repair Shops
> Key: 3; Value: Glass Replacement
> etc..
>
> So now what i need is the ability to go thru all of
> the menu array with index of $menu[0][*] one at a time
> and then print out all $menu indicies where [*]
> matches $menu[THIS][]
> the unset removes a category once it's been printed
>
> Any ideas?
> I don't want to recursively hit the database a bunch
> of times.
>
> Thanks,
> olinux
>
> --- DL Neil <[EMAIL PROTECTED]> wrote:
> >
> > - Original Message -
> > From: "olinux" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: 29 October 2001 08:16
> > Subject: [PHP-DB] category structure
> >
> >
> > > anyone have any ideas on this
> > >
> > > I have a table of directory categories
> > > id | parentid | category
> > >
> > > so...
> > >  1 | 0 | blah1   top
> > >  2 | 1 | blah2   sub
> > >  3 | 1 | blah3   sub2
> > >  4 | 3 | blah4   sub2->sub
> > >
> > > I want to hit the DB only once so i select all and
> > > drop into array
> > >
> > > Now i've created array with these like so:
> > > $category[$parentid][$id]
> > >
> > > But now what?
> > >
> > > trouble is that
> > > $msub[2][4] is a sub category of $msub[1][2]
> > > so i can't just run thru and print the array -
> > need to
> > > manipulate a little.
> > >
> > > Any ideas? [or even a beeter way to do this?]
> >
> > Olinux,
> >
> > What you are asking is a fairly common requirement,
> > with well-known solutions.
> > In what format do you require the output printed?
> > Do you know what a "tree" data structure is, and how
> > to 'walk the tree'?
> >
> > =dn
> >
>
>
> __
> Do You Yahoo!?
> Make a great connection at Yahoo! Personals.
> http://personals.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]




Re: [PHP-DB] background process

2001-10-29 Thread Ric Manalac

hi,

thanks for the reply. i will look up docs that discuss
cron. i'm sorry but i didn't get what you mean by
"m/c". please explain. thanks!

regards,

ric

DL Neil wrote:

> > has anyone here created an application using
> > background processes? what i have in mind
> > is to be able to run the background process
> > once a day to check for files that are more than
> > 5 days old and delete them. thanks in advance.
>
> ric,
>
> PHP (and scripts) can be executed from the command line (given that it has been 
>appropriately set up on your
> m/c). This is discussed in the docs. Thereafter it becomes a matter of setting up a 
>'trigger' to kick-off
> execution at set times using CRON (*nix) or AT (Windows?32-bit).
>
> =dn

--

==
Note: The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient,or an employee or agent
responsible for delivering this to the intended recipient,you are
hereby notified that any dissemination, distribution or copying of
this communication is strictly prohibited. If you have received
this communication in error, please notify us immediately by
replying to the message and deleting it from your computer.
Thank you.
==




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

2001-10-29 Thread DL Neil

> has anyone here created an application using
> background processes? what i have in mind
> is to be able to run the background process
> once a day to check for files that are more than
> 5 days old and delete them. thanks in advance.


ric,

PHP (and scripts) can be executed from the command line (given that it has been 
appropriately set up on your
m/c). This is discussed in the docs. Thereafter it becomes a matter of setting up a 
'trigger' to kick-off
execution at set times using CRON (*nix) or AT (Windows?32-bit).

=dn



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

2001-10-29 Thread olinux

Yes, I know what a tree data structure is - how to
"walk the tree" I'm not sure what you mean. But I've
come up with something quite cool. but still not
working.

I select all the data from the catagories table [id |
pid | category] and drop it into the array

= 
$menu = array();

while ($row = mysql_fetch_array($result)) {
$id = $row['cat_id'];
$category = $row['category'];
$pid = $row['pid'];

$menu[$pid][$id] = $category;
}


foreach($menu as $key1 => $value1) {
echo "Key: $key1; Value: $value1\n";
   foreach ($value1 as $key2 => $value2) {
  echo "Key: $key2; Value: $value2\n";
// delete array that has been printed
unset($menu[$key1][$key2]);
} 
}
= 

and out comes:
Key: 0; Value: Array
Key: 1; Value: Automotive
Key: 4; Value: Technology
Key: 1; Value: Array
Key: 2; Value: Repair Shops
Key: 3; Value: Glass Replacement
etc..

So now what i need is the ability to go thru all of
the menu array with index of $menu[0][*] one at a time
and then print out all $menu indicies where [*]
matches $menu[THIS][]
the unset removes a category once it's been printed

Any ideas?
I don't want to recursively hit the database a bunch
of times.

Thanks,
olinux

--- DL Neil <[EMAIL PROTECTED]> wrote:
> 
> - Original Message - 
> From: "olinux" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: 29 October 2001 08:16
> Subject: [PHP-DB] category structure
> 
> 
> > anyone have any ideas on this 
> > 
> > I have a table of directory categories 
> > id | parentid | category
> > 
> > so...
> >  1 | 0 | blah1   top
> >  2 | 1 | blah2   sub
> >  3 | 1 | blah3   sub2
> >  4 | 3 | blah4   sub2->sub
> > 
> > I want to hit the DB only once so i select all and
> > drop into array
> > 
> > Now i've created array with these like so:
> > $category[$parentid][$id]
> > 
> > But now what?
> > 
> > trouble is that 
> > $msub[2][4] is a sub category of $msub[1][2]
> > so i can't just run thru and print the array -
> need to
> > manipulate a little.
> > 
> > Any ideas? [or even a beeter way to do this?] 
> 
> Olinux,
> 
> What you are asking is a fairly common requirement,
> with well-known solutions.
> In what format do you require the output printed?
> Do you know what a "tree" data structure is, and how
> to 'walk the tree'?
> 
> =dn
> 


__
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.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-DB] Did you use PHP-Nuke? Need help.

2001-10-29 Thread Body of Shadows

I installed Red Hat 7.1 (PHP included)  + MySQL 3.23 and wanted
to launch PHP-Nuke to create sample web site. I got little Linux
and zero PHP/MySQL knowledge, maybe I am doing something wrong
but after 2 days of fighting I got enough.

Install file suggests to launch page "admin.php" after the installation
on the local host,as the result I am getting error:

Fatal error: Call to undefined function: mysql_connect() in
/var/www/html/mainfile.php on line 42

It seems that PHP is working fine, MySQL too.
What should I do? I enabled [mysql.so] in PHP "ini" file but no change.

Thanks for help,


BOFS




-- 
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] MSSQL.DLL <-> MSSQL70.DLL ?

2001-10-29 Thread Hace

On Fri, 19 Oct 2001 10:26:14 +0200, [EMAIL PROTECTED] (Thorsten Hock)
wrote:

>Sorry, natürlich benutze auch ich mssql_connect(). Der Zugriff funktioniert
>aber leider nur, wenn sich der SQL-Server und der WEB-Server auf dem
>gleichen Host befinden. Ein Zugriff über das Internet auf einen anderen
>Server ist nicht möglich. Und genau das ist mein Problem.

Seems I do not have that problem with our intranet.

We have installed PHP on two different W2000/IIS5 servers.

On both servers, MSSQL2000 is also installed and we use PHP4.06 with
the php_mssql.dll. We can connect both databases from both servers by
using the servername, or by using the IP-address of the servername.

BTW: If you want to connect to an MSSQL server over the internet, you
might want to make sure you make use of some secure connection, like
make use of PPTP, tunneling?

Cheers,

-- 
  http://hace.dyndns.org/ 
  Everything I say is my own opinion and not necessarily that of my employer.


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

2001-10-29 Thread Ric Manalac

hi everyone,

has anyone here created an application using
background processes? what i have in mind
is to be able to run the background process
once a day to check for files that are more than
5 days old and delete them. thanks in advance.

regards,

ric

--

==
Note: The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient,or an employee or agent
responsible for delivering this to the intended recipient,you are
hereby notified that any dissemination, distribution or copying of
this communication is strictly prohibited. If you have received
this communication in error, please notify us immediately by
replying to the message and deleting it from your computer.
Thank you.
==




-- 
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 table update

2001-10-29 Thread Niklas Lampén

What can I say? Thank you very much for working on this problem! Helped
me a lot!


Niklas


-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]] 
Sent: 29. lokakuuta 2001 12:27
To: Niklas Lampén; Php-DB; Php-General
Subject: Re: [PHP-DB] mySQL table update


> I have a large table with quite many dates in format dd.mm. (don't

> ask why :) and I want to convert them into -mm-dd for obvious 
> reasons. How can I do this the smartest way? I know I could do it with

> php and update it row by row but that doesn't seem too smart. Can I 
> somehow do a copy from table to table at the same time? Table 1:
> Name = John Doe
> Date1 = 01.01.2001
> Date2 = 02.02.2001
> Table 2:
> Name = NULL
> Date1 = -00-00
> Date2 = -00-00
> And now I want to set Table 2 to this:
> Name = John Doe
> Date1 = 2001-01-01 // Value from Table 1
> Date2 = 2001-02-02 // Value from Table 1


Niklas,

> At least tell me what to look for in the manual. :)
7 MySQL Language Reference
SELECT
SUBSTRING()
INSERT INTO
CONCAT_WS()

Used MySQL-Front as a convenient prototyping tool. Created the two
tables and slotted in sample data - would be big mistake/more
time-consuming trying to work with full-sized files (and if you do,
hint: use LIMIT).

Decided to approach the problem as a 'game of two halves'. First worked
on the SELECT statement to pull rows off the table and format the date
components using substring(). Then tried to figure out how to get the
results into Table 2 - first of all as separate fields, then using
concat_ws() to combine them into one. Only worked on one date column -
figured the other was simply a replication task...

Thus a part-solution:

insert into TBL_NIKLAS2 (NAME, DATE1)
  select
NAME,
concat_ws("/", substring(DATE1, 7, 4), substring(DATE1, 4, 2),
substring(DATE1, 1, 2))
  from TBL_NIKLAS1

(NB solution fails if existing dates are not strings and/or dates do not
conform to dd.mm. format).

I was a little surprised that I couldn't structure the commands: ...
  select...
substring(DATE1, 7, 4) as DATE...
concat_ws("/", DATE, ...

which seemed a logical/self-documenting way to go about it, but someone
more familiar with SQL than I will have to explain why...?

Regards,
=dn




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

2001-10-29 Thread DL Neil


- Original Message - 
From: "olinux" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 29 October 2001 08:16
Subject: [PHP-DB] category structure


> anyone have any ideas on this 
> 
> I have a table of directory categories 
> id | parentid | category
> 
> so...
>  1 | 0 | blah1   top
>  2 | 1 | blah2   sub
>  3 | 1 | blah3   sub2
>  4 | 3 | blah4   sub2->sub
> 
> I want to hit the DB only once so i select all and
> drop into array
> 
> Now i've created array with these like so:
> $category[$parentid][$id]
> 
> But now what?
> 
> trouble is that 
> $msub[2][4] is a sub category of $msub[1][2]
> so i can't just run thru and print the array - need to
> manipulate a little.
> 
> Any ideas? [or even a beeter way to do this?] 

Olinux,

What you are asking is a fairly common requirement, with well-known solutions.
In what format do you require the output printed?
Do you know what a "tree" data structure is, and how to 'walk the tree'?

=dn


-- 
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 table update

2001-10-29 Thread DL Neil

> I have a large table with quite many dates in format dd.mm. (don't
> ask why :) and I want to convert them into -mm-dd for obvious
> reasons. How can I do this the smartest way? I know I could do it with
> php and update it row by row but that doesn't seem too smart. Can I
> somehow do a copy from table to table at the same time?
> Table 1:
> Name = John Doe
> Date1 = 01.01.2001
> Date2 = 02.02.2001
> Table 2:
> Name = NULL
> Date1 = -00-00
> Date2 = -00-00
> And now I want to set Table 2 to this:
> Name = John Doe
> Date1 = 2001-01-01 // Value from Table 1
> Date2 = 2001-02-02 // Value from Table 1


Niklas,

> At least tell me what to look for in the manual. :)
7 MySQL Language Reference
SELECT
SUBSTRING()
INSERT INTO
CONCAT_WS()

Used MySQL-Front as a convenient prototyping tool. Created the two tables and slotted 
in sample data - would be
big mistake/more time-consuming trying to work with full-sized files (and if you do, 
hint: use LIMIT).

Decided to approach the problem as a 'game of two halves'. First worked on the SELECT 
statement to pull rows off
the table and format the date components using substring(). Then tried to figure out 
how to get the results into
Table 2 - first of all as separate fields, then using concat_ws() to combine them into 
one. Only worked on one
date column - figured the other was simply a replication task...

Thus a part-solution:

insert into TBL_NIKLAS2 (NAME, DATE1)
  select
NAME,
concat_ws("/", substring(DATE1, 7, 4), substring(DATE1, 4, 2), substring(DATE1, 1, 
2))
  from TBL_NIKLAS1

(NB solution fails if existing dates are not strings and/or dates do not conform to 
dd.mm. format).

I was a little surprised that I couldn't structure the commands:
...
  select...
substring(DATE1, 7, 4) as DATE...
concat_ws("/", DATE, ...

which seemed a logical/self-documenting way to go about it, but someone more familiar 
with SQL than I will have
to explain why...?

Regards,
=dn



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