[PHP-DB] refresh the page on back

2004-10-14 Thread balwantsingh
first of all excuse me for putting the non related question in this forum.
but i am sure someone will help me.

i want that whenever users press the browser back button, the page should be
refreshed and than displayed.

thanks for your help in advance.


with best wishes
balwant

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



Re: [PHP-DB] refresh the page on back

2004-10-14 Thread M Saleh EG
use the cache disable headers in HTML as well as PHP for the server
side headers.
pick any of the two methods.


1-HTML caching control: 
meta http-equiv=pragma content=no-cache /
meta http-equiv=cache-control content=no-cache /
meta http-equiv=cache-control content=must-revalidate /
meta http-equiv=cache-control content=proxy-revalidate /
meta http-equiv=expires content=Sat, 06 Dec 2003 1:00:00 GMT /

2-PHP server headers for caching control:
// Date in the past
header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);

// always modified
header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);

// HTTP/1.1
header(Cache-Control: no-store, no-cache, must-revalidate);
header(Cache-Control: post-check=0, pre-check=0, false);

// HTTP/1.0
header(Pragma: no-cache);




On Thu, 14 Oct 2004 12:19:27 +0530, balwantsingh
[EMAIL PROTECTED] wrote:
 first of all excuse me for putting the non related question in this forum.
 but i am sure someone will help me.
 
 i want that whenever users press the browser back button, the page should be
 refreshed and than displayed.
 
 thanks for your help in advance.
 
 with best wishes
 balwant
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
M.Saleh.E.G
97150-4779817

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



RE: [PHP-DB] PHP versions - Development server live server...

2004-10-14 Thread Peter Borcherds
I don't recall installing any optimising or encrypting extensions??  Are
they perhaps installed with mySQL?  How do I reinstall them, that is
assuming I need them?

-Original Message-
From: M Saleh EG [mailto:[EMAIL PROTECTED]
Sent: 14 October 2004 03:24
To: Peter Borcherds
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] PHP versions - Development server  live server...


Seems that ur optimizing and encrypting extensions are not loaded properly.
That's what it means.
Okay, It might mean that you're old PHP's PHP.ini is still there and
the new one is using it while it doesnt have the extensions files.
check if those files are there...

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



RE: [PHP-DB] mysql error and resource ID:

2004-10-14 Thread Graham Cossey

See PHP manual  Chapter 6. Types  Strings

for an explanation of single  double quotes.

From the doc:

If the string is enclosed in double-quotes (), PHP understands more escape
sequences for special characters

But the most important feature of double-quoted strings is the fact that
variable names will be expanded.

In your case it would be ' within .

$query = INSERT INTO MainTable (RecordID,UserID,.)
values(null,null,'$f1a','$f2a',...);

Graham.

 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
 Sent: 14 October 2004 15:43
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] mysql error and resource ID:


 Quote as in string or quote as in 'string' ?
 Those two confuse me.

 Stuart
 --- [EMAIL PROTECTED] wrote:

  If any of the variables used to insert data are
  strings ($f1a, $f2a,
  etc...), you'll need to have quotes around them.
 
  dave
 
 
 
 
 
 
  Stuart Felenstein [EMAIL PROTECTED]
 
  10/14/2004 08:26 AM
 
 
 
 
 
  To:
  Graham Cossey [EMAIL PROTECTED],
  [EMAIL PROTECTED]
  cc:
 
 
 
 
 
  Subject:
  RE: [PHP-DB] mysql error and resource ID:
 
 
 
  Not much luck here on placing the
  mysql_error($link);
  I know the server and database is reachable. So I
  imagine the error is happening in the query.  I've
  moved the $link around with no luck.
 
  Stuart
 
  Revised code below:
  --- Graham Cossey [EMAIL PROTECTED] wrote:
 
  ?php
 
  function begin()
  {
  mysql_query(BEGIN);
  }
  function commit()
  {
  mysql_query(COMMIT);
  }
  function rollback()
  {
  mysql_query(ROLLBACK);
  }
  mysql_connect(myserver,myusername, mypassword)
  or die(mysql_error());
 
  mysql_select_db(mydatabase) or die(mysql_error());
 
  $query = INSERT INTO MainTable
  (RecordID,UserID,.)
  values
 
 (null,null,$f1a,$f2a,$f2c,$f2d,$f2e,$f2g,$f5b,$f3m,$f3n,$f3e,$f3f,
 $f3g,$f3h,$f3i,$f3j,
  $f3k,$f3l);
  begin(); // transaction begins
  $result = @mysql_query($query, $link);
 
  if(!$result)
  {
  rollback(); // transaction rolls back
  echo You rolled back .mysql_error($link);
  exit;
  }
  else
  {
  commit(); // transaction is committed
  echo your insertion was successful;
  }
  ?
 
  --
  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] mysql error and resource ID:

2004-10-14 Thread Stuart Felenstein
Anyone see something wrong here :

My error message is :

0: 1064: You have an error in your SQL syntax. Check
the manual that corresponds to your MySQL server
version for the right syntax to use near
'd',1,'d',1,1, 31, 33,10/15/2004))' at
line 5

Code:

$query = INSERT INTO MainTable (RecordID,UserID,other
fields..)
values
(null,null,'$f1a',$f2a,$f2c,$f2d,$f2e,$f2g,'$f5b','$f3m','$f3n,'$f3e',$f3f,'$f3g',$f3h,$f3i,
$f3j, $f3k,$f3l)); //not sure if the double ) is
//needed though it doesn't make a diff
begin(); // transaction begins
$result = mysql_query($query);

--- Stuart Felenstein [EMAIL PROTECTED] wrote:

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



RE: [PHP-DB] mysql error and resource ID:

2004-10-14 Thread Stuart Felenstein
Yes, actually my apologies to everyone. I figured out
the error.  
So  , yep, I'm down to a problem with the date.
The column is set to date.  I'll go ahead and add the
quotes.

Stuart
--- [EMAIL PROTECTED] wrote:

 Stuart,
 
 The date has forward slashes. These are not
 integers, right? So put single 
 quotes around the whole date, like '10/15/2004'.
 
 dave
 
 
 
 
 
 Stuart Felenstein [EMAIL PROTECTED]
 
 10/14/2004 10:02 AM
 
 
 
  
 
 To:
 Stuart Felenstein [EMAIL PROTECTED]
 cc:
 [EMAIL PROTECTED]
 
 
 
 
 Subject:
 RE: [PHP-DB] mysql error and resource ID:
 
 
 
 Anyone see something wrong here :
 
 My error message is :
 
 0: 1064: You have an error in your SQL syntax.
 Check
 the manual that corresponds to your MySQL server
 version for the right syntax to use near
 'd',1,'d',1,1, 31, 33,10/15/2004))' at
 line 5
 
 Code:
 
 $query = INSERT INTO MainTable
 (RecordID,UserID,other
 fields..)
 values

(null,null,'$f1a',$f2a,$f2c,$f2d,$f2e,$f2g,'$f5b','$f3m','$f3n,'$f3e',$f3f,'$f3g',$f3h,$f3i,
 $f3j, $f3k,$f3l)); //not sure if the double ) is
 //needed though it doesn't make a diff
 begin(); // transaction begins
 $result = mysql_query($query);
 
 --- Stuart Felenstein [EMAIL PROTECTED] wrote:
 
 -- 
 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] Converting Date for mysql

2004-10-14 Thread Stuart Felenstein
I have one of those widget calendars.
Mysql keeps throwing back the date regardless of the 
way I format it.  
I'm passing session variables over to the database and
have tried quotes ' around the date as well.  

Now I went ahead and changed this line:

$_SESSION['f3k'] = $_POST['DateAvailable'];

to 

$_SESSION['f3k'] = date('Y-m-d',
mktime(0,0,0,substr(3,5,$_POST['newdate']), 
substr(0,2,$_POST['newdate']),
substr(6,10,$_POST['newdate'])));

I now tried to pass 'newdate' into the database and
still rejected.

Any ideas ?

Stuart

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



RE: [PHP-DB] Converting Date for mysql

2004-10-14 Thread Bastien Koert
did you look to see what the data format was? many of these calendars fill 
in american dates (mm-dd-) and mysql prefers (-mm-dd)check to 
see what the format is before you assign it to the session id...

bastien
From: Stuart Felenstein [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Converting Date for mysql
Date: Thu, 14 Oct 2004 12:14:57 -0700 (PDT)
I have one of those widget calendars.
Mysql keeps throwing back the date regardless of the
way I format it.
I'm passing session variables over to the database and
have tried quotes ' around the date as well.
Now I went ahead and changed this line:
$_SESSION['f3k'] = $_POST['DateAvailable'];
to
$_SESSION['f3k'] = date('Y-m-d',
mktime(0,0,0,substr(3,5,$_POST['newdate']),
substr(0,2,$_POST['newdate']),
substr(6,10,$_POST['newdate'])));
I now tried to pass 'newdate' into the database and
still rejected.
Any ideas ?
Stuart
--
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] Generate Menu based on database structure

2004-10-14 Thread Leo G. Divinagracia III

graeme wrote:
Hi,
Rather than writing a recursive function I'd suggest that you create a 
menu class and store each record as an object of the class. 
why reinvent the wheel:
http://www.destroydrop.com/javascripts/tree/
--
Leo G. Divinagracia III
[EMAIL PROTECTED]
z
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] How to optimize select of random record in DB ?

2004-10-14 Thread -{ Rene Brehmer }-
I made this code to pick a random record from a changeable number of 
records in a given table.
I'm just curious if any of the more awake coders out there can see a way to 
optimize this for better performance, since there's several other DB 
queries on the same page.

  $records = mysql_query(SELECT COUNT(*) AS count FROM persons) or 
die('Unable to get record countbr'.mysql_error());
  $totalcount = mysql_result($records,0) - 1;
  $rndrecord = rand(0,$totalcount);
  $personquery = mysql_query(SELECT personID FROM persons LIMIT 
$rndrecord,1) or die('Unable to get random recordbr'.mysql_error());
  $personID = mysql_result($personquery,0);
--
Rene Brehmer
aka Metalbunny

If your life was a dream, would you wake up from a nightmare, dripping of 
sweat, hoping it was over? Or would you wake up happy and pleased, ready to 
take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php