RE: [PHP-DB] Re: onnecting to MSSQL database from Linux?

2002-09-26 Thread Chris Grigor

I have got a copy of ctllib-linux-elf.tgz as it says on the php website, but
I need another file called
devlib.tgz.
Anyone know where I can get a copy from???


Chris



-Original Message-
From: Avi Schwartz [mailto:[EMAIL PROTECTED]]
Sent: 18 September 2002 02:44
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: onnecting to MSSQL database from Linux?


I did build it with --with-sybase, but then I forgot to install the new
version.  Face turning red...  Sorry for the false alarm.  It now works
like a charm.

Avi

Adam Williams wrote:

 He's using microsoft sql server, not mysql.

 try --with-mssql

 On Wed, 18 Sep 2002, Jason Morehouse wrote:

 It means you haven't compiled mysql support into php.  Recompile it using
 --with-mysql
 On Tue, 17 Sep 2002 15:30:29 +, Avi Schwartz wrote:

  I have PHP4 and freetds installed and I am trying to connect to a mssql
  server.  The problem I am having is that the mssql_connect() call
  generates the following error:
 
  Fatal error: Call to undefined function: mssql_connect()
--
Avi Schwartz   Universe-watching, like golf and aging,
[EMAIL PROTECTED] promotes humility - William R. Everdell

--
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] using more that 2 conditions to obtain info from db

2002-09-26 Thread Earl Clare

hi everyone,

I am new to all php and mySQL.
What i am trying to do is to obtain information from the db using 3 conditions.
this is what i've got

$sql_num = mysql_query(SELECT * FROM siteinfo WHERE dive_operator = '1' AND status = 
'1',$db) or die (mysql_error());

the 3 conditions i need is

dive_operator=1
destination=whatever
status=1

how can i add destination=whatever to the mix?

thanks in advance for your assistance.



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

2002-09-26 Thread Miguel Carvalho

Hi,

 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.


  It doesn't seam to be database related...
  But any way

  Two solutions:
  1st solution( recommended ):
- read the entire file into a string( fread, )
- do a string relacement, ie: replace the string body/body with
the  string bodywhat you want/body.  2st solution:
- use fseek function to place the file pointer where you want
- write the string to the file


Miguel



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




[PHP-DB] Caculating minutes since DATETIME column?

2002-09-26 Thread Leif K-Brooks

I need a way to calculate the number of minutes since the value of a 
DATETIME column in mysql.  Any ideas?  Thanks.


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




RE: [PHP-DB] Caculating minutes since DATETIME column?

2002-09-26 Thread John Holmes

SELECT UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(your_column) / 60 AS
Minutes FROM your_table

---John Holmes...

 -Original Message-
 From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 26, 2002 12:29 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Caculating minutes since DATETIME column?
 
 I need a way to calculate the number of minutes since the value of a
 DATETIME column in mysql.  Any ideas?  Thanks.
 
 
 --
 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] Session understanding

2002-09-26 Thread Rodrigo

Hi people,


if i use this code:

?php
session_start();
if(empty($_SESSION['username'])) {
die('An error has ocurred. It may be that you have not logged in, or 
that your session has expired.
Please try a href=login.phplogging in/a again or contact 
the 
a href=mailto:[EMAIL PROTECTED];system administrator/a');
}
?
in one page to check if the user is logged, and in this same page i include another 
page, do i have to put this same test in this page that is beiing included??? this 
question may be dumb but i don´t knowthnaks a lot for the help.



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




RE: [PHP-DB] Session understanding

2002-09-26 Thread Steve Bradwell

If you include the other page AFTER you do this check you'll be fine. So run
your if statement and then add an else...include other.php;

HTH,
Steve.

-Original Message-
From: Rodrigo [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 9:38 AM
To: PHP
Subject: [PHP-DB] Session understanding


Hi people,


if i use this code:

?php
session_start();
if(empty($_SESSION['username'])) {
die('An error has ocurred. It may be that you have not
logged in, or that your session has expired.
Please try a href=login.phplogging in/a again
or contact the 
a href=mailto:[EMAIL PROTECTED];system
administrator/a');
}
?
in one page to check if the user is logged, and in this same page i include
another page, do i have to put this same test in this page that is beiing
included??? this question may be dumb but i don´t knowthnaks a lot for
the help.




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


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




Re: [PHP-DB] Caculating minutes since DATETIME column?

2002-09-26 Thread Leif K-Brooks

Thanks a lot for your help, but just a not to anuyone else who tries 
this.  Since there's no ()s around

UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(your_column)

, it thinks that you're trying to get:

UNIX_TIMESTAMP(NOW()) - (UNIX_TIMESTAMP(your_column) /60)


Instead of:

(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(your_column)) / 60



John Holmes wrote:

SELECT UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(your_column) / 60 AS
Minutes FROM your_table

---John Holmes...

  

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 12:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Caculating minutes since DATETIME column?

I need a way to calculate the number of minutes since the value of a
DATETIME column in mysql.  Any ideas?  Thanks.


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





  





[PHP-DB] Re: Setting up a web server wit Redhat 7.3

2002-09-26 Thread Peter Goggin

I dont know if this is the right list.
I have installed the php-mysql package and can now connect to the database.
There is however  error which I do not undertand.

Warning: No MySQL-Link resource supplied in
/usr/local/www/vantweststamps/databaselogin.php on line 15
Connected successfully
,Line 15 is
mysql_close();


If I then go on top use a page which requires the database connection I get:
Warning: Supplied argument is not a valid MySQL result resource in
/usr/local/www/vantweststamps/stampconditionlist.php on line 39
Line 39 is:
if ($row= mysql_fetch_array($result))

These pages all work without error on my win98 machine with apache, mysql
and php.

Is there any documentation which lists all of these error conditions and
suggests ways of solving them?

Regards

Peter Goggin







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




[PHP-DB] Current row of query

2002-09-26 Thread Patrick Lebon

Is there a mysql or array variable for the current row of a query array?
I want to alternate background colours for each row of the query output so i
need to know the current row number.

Thanks



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




RE: [PHP-DB] Session understanding

2002-09-26 Thread Griffiths, Daniel

as long as that same session code is present at the top of all the included files that 
are  put in later. basicaly you need to put the session code in every page (even if 
you only intend use it as an include) you wish to protect otherwise its contents can 
be read by directly typing in the url in the same way that you can read included .js 
and .css files.

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: 26 September 2002 15:57
To: Griffiths, Daniel; Steve Bradwell; Rodrigo; PHP
Subject: RE: [PHP-DB] Session understanding


Can't you get around this by making the session code a separate,
required file that is at the beginning of every protected page?  I think
this is basically the same thing, just making sure because I am about to try
and implement some session controls myself.  Thanks.

-Original Message-
From: Griffiths, Daniel [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 9:55 AM
To: Steve Bradwell; Rodrigo; PHP
Subject: RE: [PHP-DB] Session understanding


make sure that the test code is in every page you wish to protect, even the
included ones, if its not there someone could still get the contents simply
be typing in the url of 'other.php' should they guess it etc, better to be
safe than sorry

-Original Message-
From: Steve Bradwell [mailto:[EMAIL PROTECTED]]
Sent: 26 September 2002 15:02
To: Rodrigo; PHP
Subject: RE: [PHP-DB] Session understanding


If you include the other page AFTER you do this check you'll be fine. So run
your if statement and then add an else...include other.php;

HTH,
Steve.

-Original Message-
From: Rodrigo [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 9:38 AM
To: PHP
Subject: [PHP-DB] Session understanding


Hi people,


if i use this code:

?php
session_start();
if(empty($_SESSION['username'])) {
die('An error has ocurred. It may be that you have not
logged in, or that your session has expired.
Please try a href=login.phplogging in/a again
or contact the 
a href=mailto:[EMAIL PROTECTED];system
administrator/a');
}
?
in one page to check if the user is logged, and in this same page i include
another page, do i have to put this same test in this page that is beiing
included??? this question may be dumb but i don´t knowthnaks a lot for
the help.




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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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




Re: [PHP-DB] Current row of query

2002-09-26 Thread Brad Bonkoski

oops...

I meant:
(if $i is odd)
...

because $i would be the current index in the array.


Brad Bonkoski wrote:

 why not this?

 $result = mysql_query(Select * from table');
 $num_rows = mysql_num_rows($rows);

 for ($i=0; $i$num_rows, $i++)
 {
 $row = mysql_fetch_array($result);
 if ($num_rows is odd)
 {
 print $row with BG color of red;
 }
 else
 {
 printf $row with BG color of purple;
 }
 }

 HTH
 -Brad

 Patrick Lebon wrote:

  Is there a mysql or array variable for the current row of a query array?
  I want to alternate background colours for each row of the query output so i
  need to know the current row number.
 
  Thanks
 
  --
  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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Current row of query

2002-09-26 Thread Adam Williams

why not

if (!($1%2))
{
echo even!;
}
else
{
echo odd!;
}

Adam

On Thu, 26 Sep 2002, Brad Bonkoski wrote:

 oops...

 I meant:
 (if $i is odd)
 ...

 because $i would be the current index in the array.


 Brad Bonkoski wrote:

  why not this?
 
  $result = mysql_query(Select * from table');
  $num_rows = mysql_num_rows($rows);
 
  for ($i=0; $i$num_rows, $i++)
  {
  $row = mysql_fetch_array($result);
  if ($num_rows is odd)
  {
  print $row with BG color of red;
  }
  else
  {
  printf $row with BG color of purple;
  }
  }
 
  HTH
  -Brad
 
  Patrick Lebon wrote:
 
   Is there a mysql or array variable for the current row of a query array?
   I want to alternate background colours for each row of the query output so i
   need to know the current row number.
  
   Thanks
  
   --
   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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Current row of query

2002-09-26 Thread Hutchins, Richard

Not sure here, but you might also run into a problem if you start your if
statement with $i=0. If PHP does not treat the value 0 as even or odd, your
first row is most likely going to be purple along with your second row. I
know it's nitpicky, but I could see myself spending half an hour trying to
figure out why the code works, but not the way I want it to.

 -Original Message-
 From: Brad Bonkoski [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 26, 2002 11:10 AM
 To: Patrick Lebon; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Current row of query
 
 
 oops...
 
 I meant:
 (if $i is odd)
 ...
 
 because $i would be the current index in the array.
 
 
 Brad Bonkoski wrote:
 
  why not this?
 
  $result = mysql_query(Select * from table');
  $num_rows = mysql_num_rows($rows);
 
  for ($i=0; $i$num_rows, $i++)
  {
  $row = mysql_fetch_array($result);
  if ($num_rows is odd)
  {
  print $row with BG color of red;
  }
  else
  {
  printf $row with BG color of purple;
  }
  }
 
  HTH
  -Brad
 
  Patrick Lebon wrote:
 
   Is there a mysql or array variable for the current row of 
 a query array?
   I want to alternate background colours for each row of 
 the query output so i
   need to know the current row number.
  
   Thanks
  
   --
   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 Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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




Re: [PHP-DB] Current row of query

2002-09-26 Thread Patrick Lebon

Thanks, im currently doing something similar to this but I was wondering if
there was an already defined variable that i could use rather then have to
create a value and increment it myself. I guess am being picky, but was just
curious as im new to php.

This is how im currently doing it...

 $rowNum = 0;
 while ( $row = mysql_fetch_array($result) )
 {
 $rowNum++;
 if ($rowNum % 2) { $bgCol = #EADBC6; } else { $bgCol = #EFE1CE; }
echo ..;
}


Brad Bonkoski [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 why not this?

 $result = mysql_query(Select * from table');
 $num_rows = mysql_num_rows($rows);

 for ($i=0; $i$num_rows, $i++)
 {
 $row = mysql_fetch_array($result);
 if ($num_rows is odd)
 {
 print $row with BG color of red;
 }
 else
 {
 printf $row with BG color of purple;
 }
 }

 HTH
 -Brad

 Patrick Lebon wrote:

  Is there a mysql or array variable for the current row of a query array?
  I want to alternate background colours for each row of the query output
so i
  need to know the current row number.
 
  Thanks
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php




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




Re: [PHP-DB] Current row of query

2002-09-26 Thread Brad Bonkoski

then add an extra conditional to check if $i is equal to 0, or start $ off as
1so,
for ($i=1, $i$num_rows+1; $i++)
-or-
if ($i==0)
//treat as even

either way woudl work.
-Brad

Hutchins, Richard wrote:

 Not sure here, but you might also run into a problem if you start your if
 statement with $i=0. If PHP does not treat the value 0 as even or odd, your
 first row is most likely going to be purple along with your second row. I
 know it's nitpicky, but I could see myself spending half an hour trying to
 figure out why the code works, but not the way I want it to.

  -Original Message-
  From: Brad Bonkoski [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, September 26, 2002 11:10 AM
  To: Patrick Lebon; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Current row of query
 
 
  oops...
 
  I meant:
  (if $i is odd)
  ...
 
  because $i would be the current index in the array.
 
 
  Brad Bonkoski wrote:
 
   why not this?
  
   $result = mysql_query(Select * from table');
   $num_rows = mysql_num_rows($rows);
  
   for ($i=0; $i$num_rows, $i++)
   {
   $row = mysql_fetch_array($result);
   if ($num_rows is odd)
   {
   print $row with BG color of red;
   }
   else
   {
   printf $row with BG color of purple;
   }
   }
  
   HTH
   -Brad
  
   Patrick Lebon wrote:
  
Is there a mysql or array variable for the current row of
  a query array?
I want to alternate background colours for each row of
  the query output so i
need to know the current row number.
   
Thanks
   
--
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 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Current row of query

2002-09-26 Thread Brad Bonkoski

Last I checked there was no way to retrieve the current index into the result
array, you can set the index manually with mysql_seek_data(), but I don't think
that is what you want, so the best solution IMHO, is to do what you are doing
and manually keep track of the index.
-Brad

Patrick Lebon wrote:

 Thanks, im currently doing something similar to this but I was wondering if
 there was an already defined variable that i could use rather then have to
 create a value and increment it myself. I guess am being picky, but was just
 curious as im new to php.

 This is how im currently doing it...

  $rowNum = 0;
  while ( $row = mysql_fetch_array($result) )
  {
  $rowNum++;
  if ($rowNum % 2) { $bgCol = #EADBC6; } else { $bgCol = #EFE1CE; }
 echo ..;
 }

 Brad Bonkoski [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  why not this?
 
  $result = mysql_query(Select * from table');
  $num_rows = mysql_num_rows($rows);
 
  for ($i=0; $i$num_rows, $i++)
  {
  $row = mysql_fetch_array($result);
  if ($num_rows is odd)
  {
  print $row with BG color of red;
  }
  else
  {
  printf $row with BG color of purple;
  }
  }
 
  HTH
  -Brad
 
  Patrick Lebon wrote:
 
   Is there a mysql or array variable for the current row of a query array?
   I want to alternate background colours for each row of the query output
 so i
   need to know the current row number.
  
   Thanks
  
   --
   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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Session understanding

2002-09-26 Thread Ford, Mike [LSS]

 -Original Message-
 From: Griffiths, Daniel [mailto:[EMAIL PROTECTED]]
 Sent: 26 September 2002 16:09
 
 as long as that same session code is present at the top of 
 all the included files that are  put in later. basicaly you 
 need to put the session code in every page (even if you only 
 intend use it as an include) you wish to protect otherwise 
 its contents can be read by directly typing in the url in the 
 same way that you can read included .js and .css files.

... and this is precisely why all your include files should be in directories which 
are not servable by your Web server -- if your Web server can't serve them, then they 
can't be accidentally served by someone typing their URL in directly, because they 
don't have a URL!

Personally, I don't put *any* files with live code in http-servable directories.  All 
of my PHP scripts that Apache can serve as top-level scripts look pretty much like 
this:

?php
   ini_set('include_path', '../../dir-not-in-http-space/include');
   require 'the_real_script.php';
?

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




RE: [PHP-DB] Current row of query

2002-09-26 Thread Ford, Mike [LSS]

 -Original Message-
 From: Patrick Lebon [mailto:[EMAIL PROTECTED]]
 Sent: 26 September 2002 16:20
 
 This is how im currently doing it...
 
  $rowNum = 0;
  while ( $row = mysql_fetch_array($result) )
  {
  $rowNum++;
  if ($rowNum % 2) { $bgCol = #EADBC6; } else { $bgCol = #EFE1CE; }
 echo ..;
 }

Looks like a good 'un to me, although I wonder why you're incrementing
$rowNum and then doing a separate access to it, when the ++ operator is
designed precisely to avoid the need for this; the following is identical in
functionality to the above:

  $rowNum = 0;
  while ( $row = mysql_fetch_array($result) )
  {
if ($rowNum++ % 2) { $bgCol = #EADBC6; } else { $bgCol = #EFE1CE; }
echo ..;
  }

And, having got this far, I'd probably then go on to rewrite the if line
using the ?: operator instead:

$bgCol = ($rowNum++ % 2) ? #EADBC6 : #EFE1CE;

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




RE: [PHP-DB] Current row of query

2002-09-26 Thread John Holmes

You can use  instead of %, and it may be quicker.

$rowNum = 0;
while ( $row = mysql_fetch_array($result) )
{
$bgcolor = ($rowNum++  1) ? #EADBC6 : #EFE1CE;
...

---John Holmes...

 -Original Message-
 From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 26, 2002 11:42 AM
 To: 'Patrick Lebon'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Current row of query
 
  -Original Message-
  From: Patrick Lebon [mailto:[EMAIL PROTECTED]]
  Sent: 26 September 2002 16:20
 
  This is how im currently doing it...
 
   $rowNum = 0;
   while ( $row = mysql_fetch_array($result) )
   {
   $rowNum++;
   if ($rowNum % 2) { $bgCol = #EADBC6; } else { $bgCol = #EFE1CE;
}
  echo ..;
  }
 
 Looks like a good 'un to me, although I wonder why you're incrementing
 $rowNum and then doing a separate access to it, when the ++ operator
is
 designed precisely to avoid the need for this; the following is
identical
 in
 functionality to the above:
 
   $rowNum = 0;
   while ( $row = mysql_fetch_array($result) )
   {
 if ($rowNum++ % 2) { $bgCol = #EADBC6; } else { $bgCol =
#EFE1CE;
 }
 echo ..;
   }
 
 And, having got this far, I'd probably then go on to rewrite the if
line
 using the ?: operator instead:
 
 $bgCol = ($rowNum++ % 2) ? #EADBC6 : #EFE1CE;
 
 Cheers!
 
 Mike
 
 -
 Mike Ford,  Electronic Information Services Adviser,
 Learning Support Services, Learning  Information Services,
 JG125, James Graham Building, Leeds Metropolitan University,
 Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
 Email: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


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




RE: [PHP-DB] Current row of query

2002-09-26 Thread John Holmes

 Is there a mysql or array variable for the current row of a query
array?
 I want to alternate background colours for each row of the query
output so
 i
 need to know the current row number.

There is a way with SQL variables, but you're better off just letting
PHP keep track of it.

---John Holmes...


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




[PHP-DB] Valid IP

2002-09-26 Thread Wilmar Perez

Hello guys

I know this should be asked in another list but don't want to subcribe just 
for a simple question.  I apologise in advance if that bothers anyone.

I'm trying to check valid IPs that come from a form filled by a user so I'm 
using the following:

function valid_ip($ip)
{
//Check whether it is a valid IP
if (ereg(^[1-9]{2,3}+\.[1-9]{2,3}+\.[1-9]{2,3}+\.[1-9]{2,3}+$, $ip))
return true;
else
return false;
}

However it just accepts IPs such as xxx.xxx.xxx.xxx  Errors arise whith IP 
such as xxx.xx.xxx.xxx that is every part of the IP should be 3 numbers 
lenght to be accepted making the function not very handy.

Any idea?


***
 Wilmar Pérez
 Network Administrator
   Library System
  Tel: ++57(4)2105145
University of Antioquia
   Medellín - Colombia
  2002
***
 
 

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




[PHP-DB] Need help urgent!!

2002-09-26 Thread Thomas \omega\ Henning

I'm using PHP4.2.2 Win with MySQL 3.2.52 Win and PHP doesn't pass vars from
1 php to the other how i fix it?

Thanks



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




RE: [PHP-DB] Need help urgent!!

2002-09-26 Thread Ryan Jameson (USA)

Do you mean passing vars between forms, between functions, or between includes?

 Ryan

-Original Message-
From: Thomas omega Henning [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 10:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need help urgent!!


I'm using PHP4.2.2 Win with MySQL 3.2.52 Win and PHP doesn't pass vars from
1 php to the other how i fix it?

Thanks



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


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




RE: [PHP-DB] Need help urgent!!

2002-09-26 Thread Hutchins, Richard

What's you register_globals set to?

 -Original Message-
 From: Thomas omega Henning [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 26, 2002 12:49 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Need help urgent!!
 
 
 I'm using PHP4.2.2 Win with MySQL 3.2.52 Win and PHP doesn't 
 pass vars from
 1 php to the other how i fix it?
 
 Thanks
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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




Re: [PHP-DB] Need help urgent!!

2002-09-26 Thread Pierre-Alain Joye

On Thu, 26 Sep 2002 19:48:31 +0300
Thomas \omega\ Henning [EMAIL PROTECTED] wrote:

 I'm using PHP4.2.2 Win with MySQL 3.2.52 Win and PHP doesn't pass vars from
 1 php to the other how i fix it?

Read the documentation, register_globals is SET to off by default.
http://www.php.net/manual/en/language.variables.external.php

pa

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




Re: [PHP-DB] Need help urgent!!

2002-09-26 Thread Dan Brunner

Check your register_globals value in your PHP.INI!!

Dan


On Thursday, September 26, 2002, at 11:48  AM, [EMAIL PROTECTED] wrote:

 I'm using PHP4.2.2 Win with MySQL 3.2.52 Win and PHP doesn't pass vars 
 from
 1 php to the other how i fix it?

 Thanks



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



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




RE: [PHP-DB] Valid IP

2002-09-26 Thread Ryan Jameson (USA)

Try this:

function padIP($ip){
  $ar = explode(.,$ip);
  $ip = ;
  $xt = ;
  for ($i = 0; $icount($ar); $i++){
$ip .= $xt.substr(($ar[$i]+1000),1);
$xt = .;
}
  return $ip;
  }



-Original Message-
From: Wilmar Perez [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 10:40 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Valid IP


Hello guys

I know this should be asked in another list but don't want to subcribe just 
for a simple question.  I apologise in advance if that bothers anyone.

I'm trying to check valid IPs that come from a form filled by a user so I'm 
using the following:

function valid_ip($ip)
{
//Check whether it is a valid IP
if (ereg(^[1-9]{2,3}+\.[1-9]{2,3}+\.[1-9]{2,3}+\.[1-9]{2,3}+$, $ip))
return true;
else
return false;
}

However it just accepts IPs such as xxx.xxx.xxx.xxx  Errors arise whith IP 
such as xxx.xx.xxx.xxx that is every part of the IP should be 3 numbers 
lenght to be accepted making the function not very handy.

Any idea?


***
 Wilmar Pérez
 Network Administrator
   Library System
  Tel: ++57(4)2105145
University of Antioquia
   Medellín - Colombia
  2002
***
 
 

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


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




RE: [PHP-DB] Valid IP

2002-09-26 Thread John Holmes

Take out those + in your regular expression and it works fine for me,
for any format.

---John Holmes...

 -Original Message-
 From: Wilmar Perez [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 26, 2002 12:40 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Valid IP
 
 Hello guys
 
 I know this should be asked in another list but don't want to subcribe
 just
 for a simple question.  I apologise in advance if that bothers anyone.
 
 I'm trying to check valid IPs that come from a form filled by a user
so
 I'm
 using the following:
 
 function valid_ip($ip)
 {
 //Check whether it is a valid IP
 if (ereg(^[1-9]{2,3}+\.[1-9]{2,3}+\.[1-9]{2,3}+\.[1-9]{2,3}+$,
$ip))
 return true;
 else
 return false;
 }
 
 However it just accepts IPs such as xxx.xxx.xxx.xxx  Errors arise
whith IP
 such as xxx.xx.xxx.xxx that is every part of the IP should be 3
numbers
 lenght to be accepted making the function not very handy.
 
 Any idea?
 
 
 ***
  Wilmar Pérez
  Network Administrator
Library System
   Tel: ++57(4)2105145
 University of Antioquia
Medellín - Colombia
   2002
 ***
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


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




RE: [PHP-DB] Valid IP

2002-09-26 Thread John Holmes

Shouldn't it be [0-9] for each of the elements, also?

What if I want to put 123.012.123.123 or something similar?

---John Holmes...

 -Original Message-
 From: Wilmar Perez [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 26, 2002 12:40 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Valid IP
 
 Hello guys
 
 I know this should be asked in another list but don't want to subcribe
 just
 for a simple question.  I apologise in advance if that bothers anyone.
 
 I'm trying to check valid IPs that come from a form filled by a user
so
 I'm
 using the following:
 
 function valid_ip($ip)
 {
 //Check whether it is a valid IP
 if (ereg(^[1-9]{2,3}+\.[1-9]{2,3}+\.[1-9]{2,3}+\.[1-9]{2,3}+$,
$ip))
 return true;
 else
 return false;
 }
 
 However it just accepts IPs such as xxx.xxx.xxx.xxx  Errors arise
whith IP
 such as xxx.xx.xxx.xxx that is every part of the IP should be 3
numbers
 lenght to be accepted making the function not very handy.
 
 Any idea?
 
 
 ***
  Wilmar Pérez
  Network Administrator
Library System
   Tel: ++57(4)2105145
 University of Antioquia
Medellín - Colombia
   2002
 ***
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


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




Re: [PHP-DB] Valid IP

2002-09-26 Thread Pierre-Alain Joye

On Thu, 26 Sep 2002 11:39:40 -0500
Wilmar Perez [EMAIL PROTECTED] wrote:

 Hello guys
 
 I know this should be asked in another list but don't want to subcribe just 
 for a simple question.  I apologise in advance if that bothers anyone.
 
 I'm trying to check valid IPs that come from a form filled by a user so I'm 
 using the following:

If you do not need to check the range, why do not simply use ip2long ?

http://www.php.net/manual/en/function.ip2long.php

pa

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




[PHP-DB] MySQL Server Problem

2002-09-26 Thread Peter Rektorschek

Hi,

I don't know if I'm right at this list.

I have installed the mysql server on my debian Linux Server and it runs
perfectly if I'm connecting it from my Puretec Webspace. But if I'm
connecting from Apache with PHP4 running on localhost with the same script
it won't run but no Error are logged in /var/log/mysql.log or
/var/log/mysql/mysql.err.

Can anybody help me to fix the problem.
mfG Peter ([EMAIL PROTECTED])

http://www.reknet.de
http://www.rektorschek.de
http://www.petershomepage.de
http://www.klo-papier.de ;-)





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

2002-09-26 Thread Smita Manohar


heyyy i got the solution for this !!(after spending whole 
day...)

in my code,  javascript was not accepting the statement :

document.subj_frm.chk_id[i].checked=true

cos in php script i was using :
input type=checkbox name=chk_id[] value=.$row[subj_id]. /td

i changed the javascript code to :

var max = document.forms[0].elements.length ;
for(i=3; i=max; i=i+4)
{
   document.forms[0].elements[i].checked=true
}

value of i initialised to 3 and incremented with 4 as per requirement of 
my script. since 3rd,  7th, 11th  elements are checkbox elements in my 
form. its little bit hard coded. but could solve the conflict problem for 
php array and javascript.

i got the clue from : http://www.php.net/manual/en/language.types.array.php

thanks to php.net 
smita.


From: To: Smita Manohar , Subject: Re:[PHP-DB] php and javascript Date: 
Thu, 26 Sep 2002 8:17:39 +0300

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  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,
onclick=javascript : func_select_all()   which when clicked invokes 
function to select all checkboxes.   the function func_select_all has 
been defined in the  as,the phpscript where i print checkboxes is, 
   while ($row = mysql_fetch_array($result))  {  .  .  .  echo
value=.$row[subj_id]. ; // 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
value=.$row[subj_id]. ;   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

_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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




[PHP-DB] binary data?

2002-09-26 Thread Chris Payne

Hi there everyone,

How can I import binary data - say from a gif file, into a string or array in PHP?  I 
can do text files/csv etc . but using the same method it won't do binary (I'm sure 
for some obvious reason).

Thanks for your help

Chris


RE: [PHP-DB] Valid IP

2002-09-26 Thread Wilmar Perez

You're right, thanks.

Shouldn't it be [0-9] for each of the elements, also?

***
 Wilmar Pérez
 Network Administrator
   Library System
  Tel: ++57(4)2105145
University of Antioquia
   Medellín - Colombia
  2002
***
 
 

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




[PHP-DB] Return Array from Function

2002-09-26 Thread Hutchins, Richard

Can somebody tell me what I might be doing wrong in the code below? I'm
trying to use a function to perform an often-used db query and return the
resulting resource to the calling script. I keep getting this error though:

Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$'
in c:\spidey\public\addleveltwo.php on line 51

I've looked and looked, but I can't find what could be causing a parse
error. Most likely, I've just been looking at it for too long. Any fresh
eyes available?

?php
include(../protected/getContent.php);

getLevelOnes($docnum); //user-defined function from included file.
Definition appears after this snippet.

$num=mysql_num_rows($levelones);

if($num1)
{
echo(There is no level one (Section) content for this
document in the database.);
exit();
}

while($row=mysql_fetch_array($levelones))
{
$1contentID=$row[1contentID];
$parentID=$row[parentID];
$1child=$row[childID];
$1content=$row[1content];
$1ordinal=$row[ordinal];

echo(trtd.$1content./tdtda
href=\contentMgr.php?docnum=.$docnum.\
target=\_right\Add/a/td/tr);
}
?

?php
function getLevelOnes($docnum)
{
$sql=SELECT 1contentID, parentID, childID, 1content, 1ordinal FROM
levelone WHERE 1contentID='$docnum';
$levelones=mysql_query($sql)
or die(mysql_error());
return $levelones;
}
?


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




RE: [PHP-DB] Return Array from Function

2002-09-26 Thread Hutchins, Richard

Sorry, line 51 is the one that reads:
$1contentID=$row[1contentID];


 -Original Message-
 From: Hutchins, Richard [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 26, 2002 4:19 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Return Array from Function
 
 
 Can somebody tell me what I might be doing wrong in the code 
 below? I'm
 trying to use a function to perform an often-used db query 
 and return the
 resulting resource to the calling script. I keep getting this 
 error though:
 
 Parse error: parse error, unexpected T_LNUMBER, expecting 
 T_VARIABLE or '$'
 in c:\spidey\public\addleveltwo.php on line 51
 
 I've looked and looked, but I can't find what could be causing a parse
 error. Most likely, I've just been looking at it for too 
 long. Any fresh
 eyes available?
 
 ?php
   include(../protected/getContent.php);
 
   getLevelOnes($docnum); //user-defined function from 
 included file.
 Definition appears after this snippet.
   
   $num=mysql_num_rows($levelones);
 
   if($num1)
   {
   echo(There is no level one (Section) content for this
 document in the database.);
   exit();
   }
 
   while($row=mysql_fetch_array($levelones))
   {
   $1contentID=$row[1contentID];
   $parentID=$row[parentID];
   $1child=$row[childID];
   $1content=$row[1content];
   $1ordinal=$row[ordinal];
 
   echo(trtd.$1content./tdtda
 href=\contentMgr.php?docnum=.$docnum.\
 target=\_right\Add/a/td/tr);
   }
 ?
 
 ?php
 function getLevelOnes($docnum)
 {
   $sql=SELECT 1contentID, parentID, childID, 1content, 
 1ordinal FROM
 levelone WHERE 1contentID='$docnum';
   $levelones=mysql_query($sql)
   or die(mysql_error());
   return $levelones;
 }
 ?
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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




Re: [PHP-DB] Return Array from Function

2002-09-26 Thread 1LT John W. Holmes

You can't start variables with a number.

---John Holmes...

- Original Message -
From: Hutchins, Richard [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 26, 2002 4:18 PM
Subject: [PHP-DB] Return Array from Function


 Can somebody tell me what I might be doing wrong in the code below? I'm
 trying to use a function to perform an often-used db query and return the
 resulting resource to the calling script. I keep getting this error
though:

 Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or
'$'
 in c:\spidey\public\addleveltwo.php on line 51

 I've looked and looked, but I can't find what could be causing a parse
 error. Most likely, I've just been looking at it for too long. Any fresh
 eyes available?

 ?php
 include(../protected/getContent.php);

 getLevelOnes($docnum); //user-defined function from included file.
 Definition appears after this snippet.

 $num=mysql_num_rows($levelones);

 if($num1)
 {
 echo(There is no level one (Section) content for this
 document in the database.);
 exit();
 }

 while($row=mysql_fetch_array($levelones))
 {
 $1contentID=$row[1contentID];
 $parentID=$row[parentID];
 $1child=$row[childID];
 $1content=$row[1content];
 $1ordinal=$row[ordinal];

 echo(trtd.$1content./tdtda
 href=\contentMgr.php?docnum=.$docnum.\
 target=\_right\Add/a/td/tr);
 }
 ?

 ?php
 function getLevelOnes($docnum)
 {
 $sql=SELECT 1contentID, parentID, childID, 1content, 1ordinal FROM
 levelone WHERE 1contentID='$docnum';
 $levelones=mysql_query($sql)
 or die(mysql_error());
 return $levelones;
 }
 ?


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



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




Re: [PHP-DB] Return Array from Function

2002-09-26 Thread Dave Smith

Try single-quotes instead of double (' instead of ). Could be an 
interpolation issue.

--Dave

On Thu, 26 Sep 2002, Hutchins, Richard wrote:

 Can somebody tell me what I might be doing wrong in the code below? I'm
 trying to use a function to perform an often-used db query and return the
 resulting resource to the calling script. I keep getting this error though:
 
 Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$'
 in c:\spidey\public\addleveltwo.php on line 51
 
 I've looked and looked, but I can't find what could be causing a parse
 error. Most likely, I've just been looking at it for too long. Any fresh
 eyes available?
 
 ?php
   include(../protected/getContent.php);
 
   getLevelOnes($docnum); //user-defined function from included file.
 Definition appears after this snippet.
   
   $num=mysql_num_rows($levelones);
 
   if($num1)
   {
   echo(There is no level one (Section) content for this
 document in the database.);
   exit();
   }
 
   while($row=mysql_fetch_array($levelones))
   {
   $1contentID=$row[1contentID];
   $parentID=$row[parentID];
   $1child=$row[childID];
   $1content=$row[1content];
   $1ordinal=$row[ordinal];
 
   echo(trtd.$1content./tdtda
 href=\contentMgr.php?docnum=.$docnum.\
 target=\_right\Add/a/td/tr);
   }
 ?
 
 ?php
 function getLevelOnes($docnum)
 {
   $sql=SELECT 1contentID, parentID, childID, 1content, 1ordinal FROM
 levelone WHERE 1contentID='$docnum';
   $levelones=mysql_query($sql)
   or die(mysql_error());
   return $levelones;
 }
 ?
 
 
 

-- 
  ,-._.-._.-._.-._.-.
  `-. ,-'
 .--.   | |
| Cool nerds use ASCII   |  | |
| art at the bottom of   |  | |
| their emails.  |  | |
|| ,';..-.
|| ;';_' )]
||; `-|
|`.`T-|
 `--._ \| |
  `-;   | |
|....-|
   /\/ |..|
  ,'`./  ,(   |
  \_.-|_/,-/   ii  |   |
   `.' `-/  .-|||
/`^-;   ||||
   / /   `.__/  | ||
/   | ||
| ||


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




RE: [PHP-DB] Return Array from Function - SOLVED

2002-09-26 Thread Hutchins, Richard

John Holmes pointed out to me that I had made a stupid error by starting my
variable names with a number. Cardinal no-no. I know better. Really.

That solved the parse error. Another error popped up after that stating that
the variable $levelones was not a valid resource whenever I tried to
manipulate it. I assigned the results of the function call to another
variable ($stuff=getLevelOnes($docnum)) and the script works now. Must be
that $levelones is an out-of-scope variable on the calling page, thus the
need to assign the results of the function call to a local variable.

Maybe my pain can save you some. ;)

Thanks for the help.

 -Original Message-
 From: Dave Smith [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 26, 2002 4:31 PM
 To: Hutchins, Richard
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Return Array from Function
 
 
 Try single-quotes instead of double (' instead of ). Could be an 
 interpolation issue.
 
 --Dave
 
 On Thu, 26 Sep 2002, Hutchins, Richard wrote:
 
  Can somebody tell me what I might be doing wrong in the 
 code below? I'm
  trying to use a function to perform an often-used db query 
 and return the
  resulting resource to the calling script. I keep getting 
 this error though:
  
  Parse error: parse error, unexpected T_LNUMBER, expecting 
 T_VARIABLE or '$'
  in c:\spidey\public\addleveltwo.php on line 51
  
  I've looked and looked, but I can't find what could be 
 causing a parse
  error. Most likely, I've just been looking at it for too 
 long. Any fresh
  eyes available?
  
  ?php
  include(../protected/getContent.php);
  
  getLevelOnes($docnum); //user-defined function from 
 included file.
  Definition appears after this snippet.
  
  $num=mysql_num_rows($levelones);
  
  if($num1)
  {
  echo(There is no level one (Section) content for this
  document in the database.);
  exit();
  }
  
  while($row=mysql_fetch_array($levelones))
  {
  $1contentID=$row[1contentID];
  $parentID=$row[parentID];
  $1child=$row[childID];
  $1content=$row[1content];
  $1ordinal=$row[ordinal];
  
  echo(trtd.$1content./tdtda
  href=\contentMgr.php?docnum=.$docnum.\
  target=\_right\Add/a/td/tr);
  }
  ?
  
  ?php
  function getLevelOnes($docnum)
  {
  $sql=SELECT 1contentID, parentID, childID, 1content, 
 1ordinal FROM
  levelone WHERE 1contentID='$docnum';
  $levelones=mysql_query($sql)
  or die(mysql_error());
  return $levelones;
  }
  ?
  
  
  
 
 -- 
   ,-._.-._.-._.-._.-.
   `-. ,-'
  .--.   | |
 | Cool nerds use ASCII   |  | |
 | art at the bottom of   |  | |
 | their emails.  |  | |
 || ,';..-.
 || ;';_' )]
 ||; `-|
 |`.`T-|
  `--._ \| |
   `-;   | |
 |....-|
/\/ |..|
   ,'`./  ,(   |
   \_.-|_/,-/   ii  |   |
`.' `-/  .-|||
 /`^-;   ||||
/ /   `.__/  | ||
 /   | ||
 | ||
 

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




[PHP-DB] Update involving a list field

2002-09-26 Thread Shiloh Madsen

Hi,

Im using a form that updates a database entry. In it one of my fields is a drop 
down/list field. Whenever the value in this field is changed, instead of updating it 
to the new item, it is deleted entirely. I have the same field in my entry page that 
inserts just fine, but for some reason the update deletes the info. Is there something 
special about updating a recordset off of a dropdown field that I am missing? if it 
matters, im pulling the initial value of the field from the value in the database 
row.I can send the code for the page to anyone who needs more info.

Shiloh



[PHP-DB] Categorized list?

2002-09-26 Thread Leif K-Brooks

I'm trying to create a system to store virtual objects.  Each object 
will be in a category, and the categories may be in other categories. 
 The categorie list might look something like:
Food
Candy
Healthy Food
Vegeterian food
Organic food
Gross food

I'm thinking of a datbase structure for the categorys something like:
id (int, auto_inc, primary)
name (text)
insideof(int, id of other catrgory which this one is inside of)

The problem is, I need to generate an indented list such as I showed 
before.  I know how to do this with a lot of colors (selecting what each 
category contains, etc.), but is there a more effieient way?  I use 
mysql.  Thanks for any ideas.
   


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




Re: [PHP-DB] Categorized list?

2002-09-26 Thread Mihail Bota

Leif,

You may want to look over the system I am creating. It is for
neurobiology, but it uses categories. The URL
is http://brancusi.usc.edu/bkms
I am using both trees and colors.

Regarding your specific problem, you have to have an indexing table, which
will make the necessary relations between the different objects.

Mihai

On Thu, 26 Sep 2002, Leif K-Brooks wrote:

 I'm trying to create a system to store virtual objects.  Each object
 will be in a category, and the categories may be in other categories.
  The categorie list might look something like:
 Food
 Candy
 Healthy Food
 Vegeterian food
 Organic food
 Gross food

 I'm thinking of a datbase structure for the categorys something like:
 id (int, auto_inc, primary)
 name (text)
 insideof(int, id of other catrgory which this one is inside of)

 The problem is, I need to generate an indented list such as I showed
 before.  I know how to do this with a lot of colors (selecting what each
 category contains, etc.), but is there a more effieient way?  I use
 mysql.  Thanks for any ideas.



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




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




Re: [PHP-DB] Current row of query

2002-09-26 Thread Patrick Lebon

Thanks for your help. As i said im quite new to php so all your help in
simplifying my code has been appeciated.



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




[PHP-DB] New Question...tables

2002-09-26 Thread Shiloh Madsen

Thanks to Micah Ive resolved my old problem, but now im working on something new and 
fairly gnarly...i ahve a data entry form and one of the textareas on the form needs to 
have the ability to take a table...from users who dont know html. does anyone know any 
possible solutions to this dilemma? It would be easy if the field would always have a 
table with specific properties, but that is not the case, there may or may not be a 
table and the number of rows and colums used and data input into the table if it does 
exist will vary from record to record. Is there any way to accomplish this tha tyou 
can think of? Im almost certain that there is nothing quick and easy but i was 
wondering if anyone out there had ideas. Just FYI i plan on having a seperat page to 
view data with that will pull the data out of a table, and, ideally format the html 
into a table for display. 



[PHP-DB] Re: [PHP] New Question...tables

2002-09-26 Thread Tom Rogers

Hi,

Friday, September 27, 2002, 10:20:32 AM, you wrote:
SM Thanks to Micah Ive resolved my old problem, but now im working on something new 
and fairly gnarly...i ahve a data entry form and one of the textareas on the form 
needs to have the ability to
SM take a table...from users who dont know html. does anyone know any possible 
solutions to this dilemma? It would be easy if the field would always have a table 
with specific properties, but that
SM is not the case, there may or may not be a table and the number of rows and colums 
used and data input into the table if it does exist will vary from record to record. 
Is there any way to
SM accomplish this tha tyou can think of? Im almost certain that there is nothing 
quick and easy but i was wondering if anyone out there had ideas. Just FYI i plan on 
having a seperat page to view
SM data with that will pull the data out of a table, and, ideally format the html 
into a table for display. 

Have them enter the data as a comma delimited list like this:

[table]
Name,Address,City,Country
Tom,Home,Brisbane,Australia
...
[/table]

Then you could parse looking for [table] and work on the data after till
[/table] The first row would be the column headers.

-- 
regards,
Tom


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




[PHP-DB] query fails with mysql_query but success with direct SQL from command line

2002-09-26 Thread Thoenen, Peter Mr. EPS

Hello everybody,

This command fails when ran with mysql_query but succeeds when ran command
line.  Have verified connection good... a simple mysql_query(SELECT * FROM
{$user}_tickets); returns true.  Any ideas?

$query=mysql_query(
  SELECT *, UNIX_TIMESTAMP(date_submitted) AS n,
UNIX_TIMESTAMP(date_updated) AS out FROM {$user}_tickets
  WHERE (
((UNIX_TIMESTAMP(date_submitted)-0)259200 AND
issue='LSR' AND date_updated IS NULL) OR
 
((UNIX_TIMESTAMP(date_submitted)-UNIX_TIMESTAMP(date_updated))259200 AND
issue='LSR' AND date_updated IS NOT NULL)
  ) OR (
((UNIX_TIMESTAMP(date_submitted)-0)86400 AND
issue='LSR' AND date_updated IS NULL) OR
 
((UNIX_TIMESTAMP(date_submitted)-UNIX_TIMESTAMP(date_updated))86400 AND
issue='LSR' and date_updated IS NOT NULL)
  );
);

Cheers,

-Peter

##
Peter Thoenen - Systems Programmer
Commercial Communications
Camp Bondsteel, Kosovo
##

Stumbled Upon...heh (Score:5, Funny) /.
by $carab on 23:00 23 August 2002 (#4131637)

ForensicTec officials said they stumbled upon the military networks about
two months ago, while checking on network security for a private-sector
client.

Someone new to a Dvorak probably tried to type in lynx
http://www.google.com; but instead got nmap -v -p 1-1024 -sS -P0 army.mil
-T paranoid.

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




[PHP-DB] [PHP-MySQL] Locking record

2002-09-26 Thread ¥ì¹F¬F©v

I'm a newbie of PHP and MySQL. Would anyone tell me that how to lock and
unlock a record of MySQL from PHP? And how other can detect whether this
record is locked or not?

Thanks for your help.

Regards,
Michael Wai



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




[PHP-DB] [PHP-MySQL] lock a record of MySQL from PHP

2002-09-26 Thread Michael Wai

I'm a newbie of PHP and MySQL. Would anyone tell me that how to lock and
unlock a record of MySQL from PHP? And how other can detect whether this
record is locked or not?

Thanks for your help.

Regards,
Michael Wai




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




RE: [PHP-DB] query fails with mysql_query but success with direct SQL from command line

2002-09-26 Thread John W. Holmes

How do you know if fails? What does mysql_error() say?

---John Holmes...

 -Original Message-
 From: Thoenen, Peter Mr. EPS
 [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 26, 2002 10:13 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] query fails with mysql_query but success with direct
SQL
 from command line
 
 Hello everybody,
 
 This command fails when ran with mysql_query but succeeds when ran
command
 line.  Have verified connection good... a simple mysql_query(SELECT *
 FROM
 {$user}_tickets); returns true.  Any ideas?
 
 $query=mysql_query(
   SELECT *, UNIX_TIMESTAMP(date_submitted) AS n,
 UNIX_TIMESTAMP(date_updated) AS out FROM {$user}_tickets
   WHERE (
 ((UNIX_TIMESTAMP(date_submitted)-0)259200 AND
 issue='LSR' AND date_updated IS NULL) OR
 
 ((UNIX_TIMESTAMP(date_submitted)-UNIX_TIMESTAMP(date_updated))259200
AND
 issue='LSR' AND date_updated IS NOT NULL)
   ) OR (
 ((UNIX_TIMESTAMP(date_submitted)-0)86400 AND
 issue='LSR' AND date_updated IS NULL) OR
 
 ((UNIX_TIMESTAMP(date_submitted)-UNIX_TIMESTAMP(date_updated))86400
AND
 issue='LSR' and date_updated IS NOT NULL)
   );
 );
 
 Cheers,
 
 -Peter
 
 ##
 Peter Thoenen - Systems Programmer
 Commercial Communications
 Camp Bondsteel, Kosovo
 ##
 
 Stumbled Upon...heh (Score:5, Funny) /.
 by $carab on 23:00 23 August 2002 (#4131637)
 
 ForensicTec officials said they stumbled upon the military networks
about
 two months ago, while checking on network security for a
private-sector
 client.
 
 Someone new to a Dvorak probably tried to type in lynx
 http://www.google.com; but instead got nmap -v -p 1-1024 -sS -P0
army.mil
 -T paranoid.
 
 --
 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] o mica problema cu PHP

2002-09-26 Thread xde7ori

Salut,
te-am vazut in lista PHP si m-am gandit ca poate m-ai putea ajuta intr-o problema.
interoghez o baza de date si extrag anumite campuri pe care le asez intr-o pagina.
Vreau ca in functie de valorile existente si selectate de catre user sa reinteroghez 
baza de date si in cadrul aceleasi pagini sa apara noi campuri cu informatiile 
cerute. 
Mai tehnic vorbind nu stiu cum sa fac ca o functie scrisa special pentru reinterogarea 
bazei sa se activeze la un moment dat si sa refac pagina, un fel de creare 
dinamica...partea cu reintroducerea datelor am rezolvat-o dar functia nu se executa la 
acel eveniment...
multumesc


Free Email Account at www.flash.ro


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