[PHP-DB] Scheduling php task

2001-03-05 Thread Valerio Ferrucci


Does anyone know if is it possible to run a php script periodically (for
example every night)?

My system is Apache, LinuxPPC, php4


Thanks

==
Valerio FerrucciTabasoft Sas
[EMAIL PROTECTED]  http://tabasoft.ancitel.it
[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] Scheduling php task

2001-03-05 Thread Cosenza, Mario


You can compile it as an executable (not an apache module), then schedule it
with cron.

Run ./configure without the -with-apache= switch. It should reconfigure for
"cgi mode" (I think that's what it's called).

After you 'make' it you'll get an executable called 'php'. Use can use this
to process you php scripts from the command line ('php test.php'). 

They just warn you not to put this in your web directory, because it can be
used against you to compromise your security.

Hope it helps,

Mario



-Original Message-
From: Valerio Ferrucci [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 05, 2001 7:38 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Scheduling php task



Does anyone know if is it possible to run a php script periodically (for
example every night)?

My system is Apache, LinuxPPC, php4


Thanks

==
Valerio FerrucciTabasoft Sas
[EMAIL PROTECTED]  http://tabasoft.ancitel.it
[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] mysql_fetch_array problem...!

2001-03-05 Thread Trond Erling Hundal

I want to run a query to my db, fetching different fields from three
different tables.
In order to recognise the individual fields I give them names:

select portal.portal as portal, portal.portalid as id... etc etc


How can I refer to one specific row in this query..?
What I mean is, how can i refer to result row number 4...?

If I only selected rows from one table I could do something like this:

$i = mysql_fetch_array($sql) ;

echo "$i[4]" ;




-- 
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_fetch_array problem...!

2001-03-05 Thread Darryl Friesen

 How can I refer to one specific row in this query..?
 What I mean is, how can i refer to result row number 4...?

 If I only selected rows from one table I could do something like this:

 $i = mysql_fetch_array($sql) ;
 echo "$i[4]" ;

Actually, no.  mysql_fetch_array return the _current row_ from the query
(use this function in a loop to process each row of the resulting data).
$i[4] in your case is the fourth field in the current row.

If you really don't want to process the rows in order, look at the
documentation for mysql_data_seek; it can be used to jump around the result
set.


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education  Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] Problem getting PostgreSQL to compile

2001-03-05 Thread The Hermit Hacker

On Mon, 5 Mar 2001, K Old wrote:

 Yes, I've checked phpinfo() and not it is not compiled in.  That is the
 problem.  I have recompiled PHP with pgsql support and there is some
 problem.  I'm not sure why it isn't compiling it in.  I've tried everything
 I knowthe installation goes fine...no error messages, everything seems
 ok.

 Any ideas?

when you run configure, the status messages that are output, do they list
pgsql as being found?  even with --with-pgsql enabled, if it can't find
the libraries or header files, it will re-disable it again ...

 

 From: The Hermit Hacker [EMAIL PROTECTED]
 To: K Old [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: Re: [PHP] Problem getting PostgreSQL to compile
 Date: Fri, 2 Mar 2001 22:30:11 -0400 (AST)
 
 
 have you checked phpinfo() to make sure that pgsql support is actually
 compiled in?  if so, any errors on connection, or just silently fails?
 
 On Fri, 2 Mar 2001, K Old wrote:
 
   Hello,
  
   I'm running RH 7 and Apache.  I have the latest version of PostgreSQL
 and it
   is installed and running correctly.  I have installed PHP with the
   --with-pgsql and it seems to install everything needed, but when I try
 to
   use pg_connect() it fails to connect.  Any ideas what I can do?
  
   Thanks,
   Kevin
   [EMAIL PROTECTED]
   _
   Get your FREE download of MSN Explorer at http://explorer.msn.com
  
  
   --
   PHP General 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]
  
  
 
 Marc G. Fournier   ICQ#7615664   IRC Nick:
 Scrappy
 Systems Administrator @ hub.org
 primary: [EMAIL PROTECTED]   secondary:
 scrappy@{freebsd|postgresql}.org
 
 
 --
 PHP General 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]
 

 _
 Get your FREE download of MSN Explorer at http://explorer.msn.com



Marc G. Fournier   ICQ#7615664   IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: [EMAIL PROTECTED]   secondary: scrappy@{freebsd|postgresql}.org


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Problem with odbc_field_type?

2001-03-05 Thread Mark Newnham

Is there a problem with odbc_field_type? I always receive a null back. I
dont have a problem with odbc_field_len. Is it perhaps that some db types
don't respond correctly.

Thanks

Mark

-- 
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] Sybase-ct in Linux and MS SQL 2000

2001-03-05 Thread Sergio Murillo

I just installed  a Sybase_CT module in php 4.0 on a linux machine. I'm
trying to move a web site from a buggy and crashy NT box but I'm having
trouble with the mssql_result call.

This is what I get.

Warning: 2 is not a valid Sybase result resource in
/var/www/html/crap.php on line 54

Line 54 reads:

$ssn = mssql_result($result,$a,0);


I also get this error on all the mssql_result on the for loop.

I made it work changing it with mssql_fetch_* calls but I want to move a
big site to the Linux box and it would be a momumetal task rewriting the
whole code.

Can you please help?

Thanks

Sergio

PS The same problem occurs with MS SQL 7.0 and MS SQL 2000




-- 
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] Display random image within loop problem

2001-03-05 Thread Fates

I want to display a random image on a web page every 30 seconds.   The
problem I am having is that I get multiple images on the same web page
all at once.  It's not clearing the previous image and then displaying
the new image.  Must have something to do with the loop its in:

!-- Warning poor codinig listed below: --
TABLE
?
 mysql_connect("blah.com", "blah", "password");
 $query = "SELECT * FROM graphicstable ORDER by ID";
 $result = mysql_db_query("graphics", $query);

 $query = "SELECT COUNT(*) FROM graphicstable";
 $numguests = mysql_query($query) or die("Select Failed!");
 $numguest = mysql_fetch_array($numguests);
// echo "Result is: $result";


// Begin Randomizer Function
function random($max = 1) {
  static $startseed = 0;
  if (!$startseed) {
$startseed = hexdec(uniqid(''))%getrandmax();
srand($startseed);
  }
  return ((rand()/getrandmax())*$max);
} //end function

if ($result) {

$i = 0;
$number = 3;  //just to test number is total records in database

IF ($number == 0) :
PRINT "CENTERPThere were no records matching
your   query/CENTER";
ELSEIF ($number  0) :
//PRINT "CENTERPSearch Results Returned:
$number/CENTERBRBR";

WHILE ($i  $number):

// Assign variables within the loop
// sleep (10);
$bar =$numguest[0];
$foo = random($bar);   // call random function to get a new random pic

$record = mysql_result($result,$foo,"ID");
$cat = mysql_result($result,$foo,"category");
$name = mysql_result($result,$foo,"picture_name");
$rating = mysql_result($result,$foo,"rating");

// $name = mysql_result($result,$i,"name");
?

TR  bgcolor="#00" THsmallName:? echo "$name"; ? Record: ?
echo "$record"; ? Category: ? echo "$cat"; ? Rating: ? echo
"$rating"; ?Total Records: ? echo $numguest[0]; ? /small/TH/TR
!-- 99 is red --
!-- TRTD ? // echo "img src=/graphics/uploads/$name width=$width
height=$heightbr\n"; ? /TD/TR --
TR  bgcolor="#00" THRandom Number: ? echo "$foo"; ? Record: ?
echo "$record"; ? Height= ? echo "$height"; ? Width= ? echo
"$width"; ?/TH/TR
/TR

?

//PRINT "BRBR";
$i++;
ENDWHILE;
//PRINT "/CENTER";
ENDIF;

}
?
/TABLE


-- 
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_fetch_array problem...!

2001-03-05 Thread JJeffman

You must use a loop to show each row of your query.
"mysql_fetch_array($result)" only get the current row.

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

// do something

}

The "mysql_fetch_array" function returns an associative array where you can
use the field names  to have access to its value :

$row = mysql_fetch_array($result) ;
$v1 = $row["fieldname1"] ;
$v2 = $row["fieldname2"] ;
$v3 = $row["fieldname3"] ;

You're going to  use the alias names you are creating on the query.

See more details on php manual at mysql functions.

HTH.

Jayme.

-Mensagem Original-
De: Trond Erling Hundal [EMAIL PROTECTED]
Para: PHP-DB-LIST [EMAIL PROTECTED]
Enviada em: segunda-feira, 5 de maro de 2001 09:56
Assunto: [PHP-DB] mysql_fetch_array problem...!


 I want to run a query to my db, fetching different fields from three
 different tables.
 In order to recognise the individual fields I give them names:

 select portal.portal as portal, portal.portalid as id... etc etc


 How can I refer to one specific row in this query..?
 What I mean is, how can i refer to result row number 4...?

 If I only selected rows from one table I could do something like this:

 $i = mysql_fetch_array($sql) ;

 echo "$i[4]" ;




 --
 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 - Problem with multiple INSERTs?

2001-03-05 Thread JJeffman

Have you put an echo with mysql_error() after performing each query ?

Jayme.


-Mensagem Original-
De: Chris [EMAIL PROTECTED]
Para: [EMAIL PROTECTED]
Enviada em: segunda-feira, 5 de maro de 2001 05:04
Assunto: [PHP-DB] MySQL - Problem with multiple INSERTs?


 Howdy,

 I'm getting weird problems trying to INSERT to two different tables, in
 consecutive mysql_queries. Before, I had 3 queries going, and only 2 would
 work at any time. It seemed like it was 'rotating' the bad query - first
 the 1st query would fail (the other two were fine), then I'd empty all my
 tables and refresh, and this time the 2nd query was the problem, and if I
 did it again the 3rd was. All queries worked fine in phpMyAdmin, both
 individually and when executed en masse.

 I've boiled it down to just two queries that don't work. I've included
 everything below (including table schemata), to enable reproduction. It
 seems like a bug to me - the question is, is the bug in PHP, MySQL, or my
 brain?

 This is driving me CRAZY
   - Chris

 mysql_connect("localhost", "myusername", "mypassword");
 mysql_db_query("DocCountry", "INSERT INTO projects (idCreator, name,
 comment) VALUES (1, 'sysmsg9.txt', 'Some file')");
 mysql_db_query("DocCountry", "INSERT INTO files (idProject, name, comment)
 VALUES (1, 'sysmsg9.txt', 'Some file')");

 CREATE TABLE projects ( id int(11) NOT NULL auto_increment, timestamp
 timestamp(14), idCreator int(11) DEFAULT '0' NOT NULL, name varchar(80)
NOT
 NULL, comment text NOT NULL, authLevel varchar(32) NOT NULL, PRIMARY KEY
 (id) );

 CREATE TABLE files ( id tinyint(4) NOT NULL auto_increment, idProject
 tinyint(4) DEFAULT '0' NOT NULL, name tinyint(4) DEFAULT '0' NOT NULL,
 comment text NOT NULL, PRIMARY KEY (id) );

 (P.S. I've tried things like using SET syntax, using mysql_query instead
of
 mysql_db_query, etc. Nothing helps.)


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Insert a file in a mysql database!

2001-03-05 Thread Beau Lebens

check in the manual under the features section, a part called Handling file 
uploads.

you need to use a multipart/form-data html form, which then posts the 
contents of the file to the server. once it is there, you can parse it into 
a single variable and save that into the db just like you would anything 
else, or you can write it to disk somewhere and save a path for it.

getting it back out - make sure you also save the mime-type of the file, 
then just pass the mimetype as a header, and then spit out the contents of 
the file (if it's saved in the db)

HTH
Beau

At 01:03 PM 3/3/01 -0800, Pedro M. S. Oliveira wrote:
Hi all...
Here i am once again asking for advice :)
well i need to put a file (something lika *.doc or *.rtf) on a mysql
database.
The thing is: the user need to upload a computer file to the mysql runing
over a linux box.

i would like to know:
1) what is the best way to do this?
2) what is the html code i have to generate do do this?
3) how can i read this back from the database?

i read something about sending the file over ftp and then on the database
put just the path to the file.
but what is your opinion?
thankx



***
Pedro Miguel Silva Oliveira
Cell Phone: +351 96 5867227
SMS: [EMAIL PROTECTED]
Email: [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
Beau Lebens - Web Master
Insurance My Way, Your Friendly Online Broker
(08) 9226 5888
http://www.insurancemyway.com.au/


-- 
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] Scheduling php task

2001-03-05 Thread Beau Lebens

or alternatively, if you don't have access to recompiling or anything like 
that,
set up a cron job to use lynx to hit a page (which is your php script) when 
required.

you can even set event times in a db and have that script check the db for 
anything that needs to be run and then perform that operation.


At 07:59 AM 3/5/01 -0500, Cosenza, Mario wrote:

You can compile it as an executable (not an apache module), then schedule it
with cron.

Run ./configure without the -with-apache= switch. It should reconfigure for
"cgi mode" (I think that's what it's called).

After you 'make' it you'll get an executable called 'php'. Use can use this
to process you php scripts from the command line ('php test.php').

They just warn you not to put this in your web directory, because it can be
used against you to compromise your security.

Hope it helps,

Mario



-Original Message-
From: Valerio Ferrucci [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 05, 2001 7:38 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Scheduling php task



Does anyone know if is it possible to run a php script periodically (for
example every night)?

My system is Apache, LinuxPPC, php4


Thanks

==
Valerio FerrucciTabasoft Sas
[EMAIL PROTECTED]  http://tabasoft.ancitel.it
 [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]

-- 
Beau Lebens - Web Master
Insurance My Way, Your Friendly Online Broker
(08) 9226 5888
http://www.insurancemyway.com.au/


-- 
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] Oracle functions and procedures via OCIParse and OCIExecute

2001-03-05 Thread Jarek Holgersson

Hi!

I wonder if you have had the same problems with invoking oracle functions
and procedures via OCIParse, OCIExecute functions?

When I am trying to invoke a function or execute a procedure I receive an
OCIStmtExecute error.

The same statements works perfrectly direct in sqlplus.

It't waird!


Jarek


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