Re: [PHP-DB] Re - Direct a User after a completed Form

2002-04-01 Thread wesley grubbs:.

header is the appropriate one you're looking for:

header( Location: thanks.php );


what i do is use the page that processes all the data to also validate the
data. if the data does not pass through, it stays on this page with all the
errors listed in the body.
if it goes through.. then the 'header()' is loaded.

example.
page1
form action=send-form.php method=post
all the stuff in your form.
i.e.
email:br
  input type=text name=Email size=30
/form
..
page2 (send-form.php)

?php
$from = $Email;
$from = From: $from;
$headers = $from\n;

$emailto =[EMAIL PROTECTED];
$exclude = array( Submit_x, Submit_y, submit );

  $title =custom title - $Title;

  $message = \n;
  $message .= ---\n;
  $message .= This information was sent on .date('dS of F Y (H:i)').from
Netdiver.\n;
  $message .= ---\n;
  $message .= Email: $Email\n;

  function checkemail( $Email ) {
  $regexp =
/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
  if( !preg_match( $regexp, $Email ) )
  return false;
  return true;
  }

  $emailOK = checkemail( $Email );
  if ($emailOK == true ){
   // echo $message;
   header( Location: thanks.php );
   mail( $emailto, $title, $message, $headers );
   exit( );
  }
?
html
head
titleError!! Form not filled properly./title
/head
body
you need to enter a valid email address
/body
/html

..
page 3 (thanks.php)
html
head
titlethanks/title
/head
body
Thanks!
/body
/html
.

hope this helps
wes


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




[PHP-DB] Pop up are you sure...

2002-04-01 Thread Dave Carrera

Hi All

 

How do you do this?

 

On click of button to delete a record make a popup yes / no box appear.
On yes then do it else stop.

 

Is it possible to do with out using JS?

 

Thanks for any pointers or code in advance.

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




Re: [PHP-DB] Problem with PHP connectivity with mySQL (RedHat package)

2002-04-01 Thread CK Raju

If that works fine,
check out for the php-xxx rpms including the php-mysql- one.

CK Raju



** Message from InterScan E-Mail VirusWall NT **

** No virus found in attached file noname.htm

This is a virus free message scanned by Zyberway
* End of message ***




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


[PHP-DB] locking a record

2002-04-01 Thread Natividad Castro

Hi to all,
I have a MySQL DB, and I'm retrieving the data using PHP. There will be
about 10 users that will work in a form at the same time. My question is how
do I lock the a record? for example user 1 access record 1; I don't want
user 2 be able to have access to the same record.
Is it possible to do this in PHP? or I have to do it in MySQL?

Thanks in advanced
Nato


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




RE: [PHP-DB] int or tinyint

2002-04-01 Thread Jonathan Hilgeman

Hi Jennifer,
In most cases, it's best to use int. The difference between the two is
simply the range of numbers they can show. Tinyint is fine for cases where
you know you'll never need more than 127 (or 255 if you tell MySQL that it
is an UNSIGNED tinyint, which just means that it can't have negative numbers
so it now has that much more room for positive numbers; the UNSIGNED
literally means that it doesn't have a positive or negative sign, so
everything's defaulted to positive). If you use a regular tinyint on an
auto-incrementing field like member_id and you get 127 members, you won't
get any more. Each attempted INSERT query after the 127th member will have
an error saying something about duplicate keys for 127 (it's trying to
insert a new one, but it can only go up to 127, so it tries to insert a new
member with an id of 127, but there's already one there).

So in short, use int in most cases. It doesn't take up that much more space,
and has a much wider range of numbers it can hold (someone else said 2
billion-something, which I think is right). But from what I currently
understand (someone can correct me if I'm wrong), you are also limited to
the digits/length you specify for the field. For instance, an int(5) can
only hold 5 digits, so you could go up to 99,999 maximum and down to -99,999
(unless you had an UNSIGNED int, in which case, there would be no negative
numbers, but you're still limited to 5 digits). An int(6) could hold 6-digit
numbers up to 999,999, etc...

- Jonathan

-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Sunday, March 31, 2002 10:06 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] int or tinyint


Hi all,

Just a simple question (I think).

When should I use tinyint over int. and what is the difference between the
two?

Thanks
Jennifer



-- 
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] Pop up are you sure...

2002-04-01 Thread Jonathan Hilgeman

You're so negative, Jason. :)

Long answer, Dave, it wouldn't be wise to do this via Javascript. Javascript
can be turned off and also varies from browser to browser (like any
client-side language/scripting), so this raises an issue of reliability. You
may be able to do it if you're working on an intranet where you know that
all users have the same browser, have Javascript turned on, and don't have
access to turn it off, OR if this is for your own use and you don't want to
make it screw up. Otherwise, it might be a nice feature, but you shouldn't
rely on it.

If you WERE going to do it, I would have your main form have a hidden input
called Confirm and set it to a value of 1. Then, have a Button (not a
submit button) use Javascript to open a new browser/popup window (you can
format it to look like a regular Yes/No windows popup box). Have the Yes
I-want-to-delete-this-record button change its parent window's form and
change the Confirm input's value to 0 and submit the parent window's form
in order to delete the record. Have the No button just close the popup/new
window.

Now, on the page that actually deletes the record, first check the Confirm
variable. If it is set to 0, then you can figure that the Javascript set it
to 0, and you can go ahead and delete the record without asking. Otherwise,
show a regular HTML screen that asks if you really want to delete this
record (no Javascript this time), so you can be covered if Javascript gets
turned off. 

This is by no means a fool-proof method, and you should think carefully
through all this before implementing a Javascript solution, but I find that
there are better methods with PHP. For instance, you can have 3 checkboxes
side-by-side that can act as the
yes-I-really-really-want-to-delete-this-record safety. PHP can check to
see if all 3 checkboxes were checked, and then you can know that the user
was intentionally trying to delete that record, and you can go ahead and
delete it - no Javascript needed. :)

As far as the Javascripting goes, though, I would check out some JS forums
for help on how to set up the actual scripting part of the popup box. But,
as Jason probably was thinking, Javascript is never a very good thing to use
with things that are delicate, fragile, or valuable in any way. It's like
hiring an ex-thief to help you move - you can never be SURE that
everything's going to be there in the end.

- Jonathan

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 12:45 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Pop up are you sure...


On Monday 01 April 2002 16:44, Dave Carrera wrote:
 Hi All



 How do you do this?

Use javascript.

 On click of button to delete a record make a popup yes / no box appear.
 On yes then do it else stop.



 Is it possible to do with out using JS?

Short answer, no.


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

/*
Timing must be perfect now.  Two-timing must be better than perfect.
*/

-- 
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] Pop up are you sure...

2002-04-01 Thread Jason Wong

On Tuesday 02 April 2002 01:30, Jonathan Hilgeman wrote:
 You're so negative, Jason. :)

No, my answer was just short and to the point ;-)

 Long answer, Dave, it wouldn't be wise to do this via Javascript.

My long answer was going to be: it's possible to do it in PHP, but then it 
would not look like a pop-up window, and it requires a trip back to the 
server.


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

/*
Love is being stupid together.
-- Paul Valery
*/

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




RE: [PHP-DB] Pop up are you sure...

2002-04-01 Thread Jonathan Hilgeman

shrug I was close. :)

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 10:53 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Pop up are you sure...


On Tuesday 02 April 2002 01:30, Jonathan Hilgeman wrote:
 You're so negative, Jason. :)

No, my answer was just short and to the point ;-)

 Long answer, Dave, it wouldn't be wise to do this via Javascript.

My long answer was going to be: it's possible to do it in PHP, but then it 
would not look like a pop-up window, and it requires a trip back to the 
server.


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

/*
Love is being stupid together.
-- Paul Valery
*/

-- 
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] Pop up are you sure...

2002-04-01 Thread Dan Brunner

Hello!!

What I was able to do was this

On every form page I have, I have a checkbox that is labeled Ok To 
Save, that the user would check or not..

I would then pass that variable to the next page and check to see if the 
value was true or not...

If it is true then it would continue to insert the data into the 
database...

If not then it would display the pop up messages

The code looks something like this on the parse page.(in my case it 
is the insert3.php file)

?php

if (empty($save)){
?
script language=JavaScript
!--
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}
//--
/script
/head
body bgcolor=#FF text=#00 onLoad=MM_popupMsg('Hello!! 
You Forgot to check---OK TO SAVE??---. This check is for when you 
accidently hit return or enter...This will keep a Database 
Happy!!!\n\nThank youADMIN')

?
echo (Click you back button please!!! We Have a Problem!!\n);
echo (/body\n);
echo (/html\n);
exit();
}


require (functions/java.inc);
echo (/HEAD\n);
echo (BODY BGCOLOR=#FF LINK=#FF VLINK=FF ALINK=00FF00 
Text=#00);

?

It will popup a messages about not checking that checkboxAnd tell 
you have an error...

I too messed around trying to just using PHP, but I gave up using just 
PHP, Javascript plays nice with PHP anyway!!



Dan











On Monday, April 1, 2002, at 12:57 PM, [EMAIL PROTECTED] wrote:

 shrug I was close. :)

 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]]
 Sent: Monday, April 01, 2002 10:53 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Pop up are you sure...


 On Tuesday 02 April 2002 01:30, Jonathan Hilgeman wrote:
 You're so negative, Jason. :)

 No, my answer was just short and to the point ;-)

 Long answer, Dave, it wouldn't be wise to do this via Javascript.

 My long answer was going to be: it's possible to do it in PHP, but then 
 it
 would not look like a pop-up window, and it requires a trip back to the
 server.


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

 /*
 Love is being stupid together.
   -- Paul Valery
 */

 --
 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-DB] Using MyODBC V 2.50.39.00

2002-04-01 Thread Peter J. Krawetzky

I found a note on the MySQL website that MyODBC has a limitation in the
number of columns that it returns.  Is this true?

I am successfully connecting to a MySQL database but I keep getting the
error:
Warning: Field index is larger than the number of fields in (program-name)
on line 78.

I am running MySQL and Apache on a Win98 machine.  I don't want to using
mysql_ commands to the database because I don't want to make this specific
to MySQL.  I want generic code using ODBC.  Is there a way around this?  Why
would anybody put this type of limitation in?


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




[PHP-DB] Grouping menu items

2002-04-01 Thread Kim Kohen

Hello All,

I have a MySql database which has a 'sections' column which includes values
such as Real Estate, Sport, Letters etc.  The 'News' section is divided into
4 parts to indicate a priority for any given story; News, News2, News3 and
News4.

We are using:
 $getlist1 = mysql_query(SELECT distinct Section FROM stories); to
populate a popup menu which returns each of the 'News', News2, News3 and
News4 items as separate rows in the popup.

Ideally I'd like to have all the 'News' variants appear under a single
'News' menu item rather than separately.

Can anyone suggest a way to group these entries together or to truncate the
digit off the end without effecting any other menu item?

cheers

kim


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




[PHP-DB] Re: Grouping menu items

2002-04-01 Thread Kim Kohen

Hello All

Forget my previous post - I will simply run an update on the table to alter
all the various News variations back to 'News'

cheers

kim


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




[PHP-DB] autoincrement

2002-04-01 Thread Daniel Broome

I am trying to add auto increment to a table I have already created in
phpMyAdmin but I keeps coming up with an error.
what can I do to fix this?



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




[PHP-DB] Re: autoincrement

2002-04-01 Thread Glenn Holden

What's the error?
Do you already have an auto-inc field?
Have you tried it with another interface?  Ie: directly in the MySQL command
line util.
Glenn

Notes from MySQL.com:
There can be only one AUTO_INCREMENT column per table, and it must be
indexed.
When you add an AUTO_INCREMENT column, column values are filled in with
sequence numbers for you automatically. You can set the first sequence
number by executing SET INSERT_ID=# before ALTER TABLE or using the
AUTO_INCREMENT = # table option. See section 5.5.6 SET Syntax.

With MyISAM tables, if you don't change the AUTO_INCREMENT column, the
sequence number will not be affected. If you drop an AUTO_INCREMENT column
and then add another AUTO_INCREMENT column, the numbers will start from 1
again.



Daniel Broome [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I am trying to add auto increment to a table I have already created in
 phpMyAdmin but I keeps coming up with an error.
 what can I do to fix this?





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




[PHP-DB] Re: Pop up are you sure...

2002-04-01 Thread Adam Royle

Dave,

Javascript is client side.
PHP is server side.

Obviously the limitations imposed by each of the languages is evident.
PHP can't do anything once the output is sent to the browser.
JavaScript can't do anything before it gets sent to the browser.

But, each is important as the other.

Learn to use both (its not that hard) and it will make life a lot easier
(and more interesting).

Adam



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




Re: [PHP-DB] Pop up are you sure...

2002-04-01 Thread Dave Carrera

Hi all,

 

Thank you all for you advice.

 

I am aware of the two ways of achieving the required result ie: JS and
extra button built into my script.

 

But wouldn't it be nice to have a class or function we could all use
built in to php that would let us do this.

 

C,C++,Delphi and JS allow you to do this.

 

I have come across various probs with JS on client systems so I shy away
from it.

 

Again thank you all for your advice.

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




Re: [PHP-DB] Pop up are you sure...

2002-04-01 Thread php3

Addressed to: Dave Carrera [EMAIL PROTECTED]
  [EMAIL PROTECTED]

** Reply to note from Dave Carrera [EMAIL PROTECTED] Tue, 2 Apr 2002 07:23:43 
+0100

 But wouldn't it be nice to have a class or function we could all use
 built in to php that would let us do this.



 C,C++,Delphi and JS allow you to do this.


Over the web?  The limitation is in HTML not PHP.




 I have come across various probs with JS on client systems so I shy away
 from it.


Good move!



Rick



Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com

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