Re: [PHP-DB] Expiry Date ($date function)

2005-03-02 Thread Calvin Lough
The strtotime function should work the best.

$add_twentyone = strtotime(+21 days);

I dont know if that will work or not. I just found that method in the
php doc and it looked interesting. Hopefully it will work for you.

Calvin

On Wed, 2 Mar 2005 04:41:04 -0500, Ron Piggott
[EMAIL PROTECTED] wrote:
 I figured out that the syntax below creates the date in the way it may be
 stored in a mySQL table:
 
 $todays_date=DATE('Y-m-d');
 
 Is there any way to add 21 days to this as an expiry date?  For example if
 the date was March 20th 2005 21 days would be in April --- is there any way
 of dealing with this?
 
 Ron
 
 --
 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] mysql_num_rows

2005-03-08 Thread Calvin Lough
That means that you dont have any rows to work with. It could mean
that you are not connected to the database, or the query you performed
did not return any rows.

Calvin


On Tue, 8 Mar 2005 16:11:10 +0300, Tsegaye Woldegebriel
[EMAIL PROTECTED] wrote:
 Dear Sir or Madame,
 I found the following error,
 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
 resource in /home/xxx/public_html/sitename/dynamicfile.php on line 61
 What is the reason?
 I want anyone who knows to answer to reply me.
 Thank you in advance for sharing your precious time.
 
 --
 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] Queries close session

2005-03-14 Thread Calvin Lough
Because the session you are using probably uses a cookie to remember
the session, it is required that you call session_start before you
output anything to the screen(aka: send any headers). So if you place
the session start at the very top of your page before you include any
files or output anything, the session should work.  Beware of any
whitespace before the ?php  tags because that will also send headers.

Calvin

On Mon, 14 Mar 2005 14:55:53 -0700, Adept-Hosting.Net Administration
[EMAIL PROTECTED] wrote:
 I am using the following script to maintain a login session on some
 pages:
 
 ?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=index.phplogging in/a again
   or contact the
   a href=mailto:[EMAIL PROTECTED]system
 administrator/a');
 }
 ?
 
 The sessions are stable and work fine EXCEPT when I run another PHP
 script on the web page such as:
 
 ?php
 // Make a MySQL Connection
 require db_connect.inc;
 
 // Retrieve all the data from the example table
 $result = mysql_query(SELECT * FROM members WHERE Status='Inactive')
 or die(mysql_error());
 
 echo table border='1' cellpadding='0' cellspacing='1'
 align='center';
 echo tr thCertificate #/ththDan rank/ththFirst Name/th
 thLast Name/th /tr;
 // keeps getting the next row until there are no more to get
 while($row = mysql_fetch_array( $result )) {
 // Print out the contents of each row into a table
 echo trtd;
 echo $row['Cert_number'];
 echo /tdtd;
 echo $row['Dan_rank'];
 echo /tdtd;
 echo $row['First'];
 echo /tdtd;
 echo $row['Last'];
 echo /td/tr;
 }
 echo /table;
 
 ?
 
 I'm assuming that I am either not maintaining the session properly or
 not linking the scripts to the session.
 
 Any pointers on how to accomplish what I'm trying to do?
 
 Thanks,
 
 - Ken
 
 --
 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] File retrieval

2005-04-03 Thread Calvin Lough
The methods suggested above would all work but if you would like to do
in one step you could use file_get_contents(). This method does not
require you to open/close the file and will automatically read the
entire file into your array.

?php
$contents = file_get_contents(data.txt);
?

Calvin

On Apr 3, 2005 10:23 AM, Bastien Koert [EMAIL PROTECTED] wrote:
 of course, there are a number of file system option syou can use depending
 on how you;d like the data to be handled, from being put into an array to
 simply storing the entire file as a string
 
 start with file http://www.php.net/file
 or fread http://www.php.net/fread
 
 Bastien
 From: Ron Piggott [EMAIL PROTECTED]
 Reply-To: Ron Piggott [EMAIL PROTECTED]
 To: PHP DB php-db@lists.php.net
 Subject: [PHP-DB] File retrieval
 Date: Fri, 1 Apr 2005 22:43:17 -0500
 
 If I have a file named
 
 data.txt
 
 Is it possible to load the contents of it into a variable search as
 
 $contents
 
 
 idealy I would like to know if I am able to do something like
 
 $contents = data.txt;
 
 Ron
 
 --
 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