[PHP] forms and mysql

2003-12-02 Thread BigMark
Hi i am very new to PHP so need some help !

i have a form which allows the user to put in 2 team names and then displays
them, at the moment it displays them side by side but i need to insert V
(versus) in the middle--how can i do that.
I am guessing it goes in the lines of the code below somewhere, This code
originally displayed someones input for --first name,last name and address
so i have adapted it. Is there anyway to have the 'address' field display a
set value as in a V , at the moment i have removed that part but the table
field is still there, i have just hidden the form input.


  $result = mysql_query(SELECT * FROM teams,$db);

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

  printf(a href=\%s?id=%s\%s %s/a \n, $PHP_SELF, $myrow[id],
$myrow[teama],$myrow[teamb]);

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



Re: [PHP] forms and mysql

2003-12-02 Thread Tom Rogers
Hi,

Tuesday, December 2, 2003, 9:54:33 PM, you wrote:
B Hi i am very new to PHP so need some help !

B i have a form which allows the user to put in 2 team names and then displays
B them, at the moment it displays them side by side but i need to insert V
B (versus) in the middle--how can i do that.
B I am guessing it goes in the lines of the code below somewhere, This code
B originally displayed someones input for --first name,last name and address
B so i have adapted it. Is there anyway to have the 'address' field display a
B set value as in a V , at the moment i have removed that part but the table
B field is still there, i have just hidden the form input.


B   $result = mysql_query(SELECT * FROM teams,$db);

B while ($myrow = mysql_fetch_array($result)) {

B   printf(a href=\%s?id=%s\%s %s/a \n, $PHP_SELF, $myrow[id],
B $myrow[teama],$myrow[teamb]);


Just stick  a V between as in ..%s V %s ...

printf will ignore anything without a % before it and just copy it to the output

-- 
regards,
Tom

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



RE: [PHP] Forms and MySql date

2003-02-21 Thread v0idnull


To avoid user error (remember, 90% of internet users are stupid and
illogical and don't know anything), just have drop down menus for the dates
and months and allow the user to enter in the year

then just do:

$mysqldate = $_POST[month].-.$_POST[date].-.$_POST[year];

-Original Message-
From: Frank Keessen [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 21, 2003 1:21 AM
To: Philip Hallstrom
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Forms and MySql date


Hi,

You can let the users enter a date as 20-02-2003 into a textfield with the
name $userdate

Then you can use this function to convert it;

$date_array = split(-, $userdate);
$mysqldate = $date_array[2].-.$date_array[1].-.$date_array[0];

Store $mysqldate into the database!

Regards,

Frank



- Original Message -
From: Philip Hallstrom [EMAIL PROTECTED]
To: Mike Tuller [EMAIL PROTECTED]
Cc: php mailing list list [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 11:48 PM
Subject: [PHP] Re: Forms and MySql date


 You could use the TO_DATE function to convert that text string into a
 date, or reformat it in PHP to -mm-dd which mysql will take
 automatically (at least I think so)

 On Thu, 20 Feb 2003, Mike Tuller wrote:

  I have a form that I want to enter a date into a MySql database. I
  currently have the column in the database set as Date, and can't seem
  to get the date I enter into the text field to go into the database
  using the format yymmdd. I could change the column to varchar, and then
  it would enter, but this will be a database that I want to keep track
  of purchases, and if it is entered in as text, I wouldn't be able to do
  calculations such as showing how old something is.
 
  How can I have a text field where a person enters the date and have
  that information entered into the database?
 
  Mike
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


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



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


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




RE: [PHP] Forms and MySql date

2003-02-21 Thread v0idnull


I apologize

the correct order is -MM-DD so you would do:

$mysqldate = $_POST[year].-.$_POST[month].-.$_POST[date];

-Original Message-
From: v0idnull [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 21, 2003 4:37 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Forms and MySql date




To avoid user error (remember, 90% of internet users are stupid and
illogical and don't know anything), just have drop down menus for the dates
and months and allow the user to enter in the year

then just do:

$mysqldate = $_POST[month].-.$_POST[date].-.$_POST[year];

-Original Message-
From: Frank Keessen [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 21, 2003 1:21 AM
To: Philip Hallstrom
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Forms and MySql date


Hi,

You can let the users enter a date as 20-02-2003 into a textfield with the
name $userdate

Then you can use this function to convert it;

$date_array = split(-, $userdate);
$mysqldate = $date_array[2].-.$date_array[1].-.$date_array[0];

Store $mysqldate into the database!

Regards,

Frank



- Original Message -
From: Philip Hallstrom [EMAIL PROTECTED]
To: Mike Tuller [EMAIL PROTECTED]
Cc: php mailing list list [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 11:48 PM
Subject: [PHP] Re: Forms and MySql date


 You could use the TO_DATE function to convert that text string into a
 date, or reformat it in PHP to -mm-dd which mysql will take
 automatically (at least I think so)

 On Thu, 20 Feb 2003, Mike Tuller wrote:

  I have a form that I want to enter a date into a MySql database. I
  currently have the column in the database set as Date, and can't seem
  to get the date I enter into the text field to go into the database
  using the format yymmdd. I could change the column to varchar, and then
  it would enter, but this will be a database that I want to keep track
  of purchases, and if it is entered in as text, I wouldn't be able to do
  calculations such as showing how old something is.
 
  How can I have a text field where a person enters the date and have
  that information entered into the database?
 
  Mike
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


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



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


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



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




[PHP] Forms and MySql date

2003-02-20 Thread Mike Tuller
I have a form that I want to enter a date into a MySql database. I
currently have the column in the database set as Date, and can't seem
to get the date I enter into the text field to go into the database
using the format yymmdd. I could change the column to varchar, and then
it would enter, but this will be a database that I want to keep track
of purchases, and if it is entered in as text, I wouldn't be able to do
calculations such as showing how old something is.

How can I have a text field where a person enters the date and have
that information entered into the database?

Mike


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




Re: [PHP] Forms and MySql date

2003-02-20 Thread Rick Emery
mysql stores date as -mm-dd

that is how the date should be entered into the form

If entered in another format, you can reformat it.
- Original Message - 
From: Mike Tuller [EMAIL PROTECTED]
To: php mailing list list [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 4:43 PM
Subject: [PHP] Forms and MySql date


I have a form that I want to enter a date into a MySql database. I
currently have the column in the database set as Date, and can't seem
to get the date I enter into the text field to go into the database
using the format yymmdd. I could change the column to varchar, and then
it would enter, but this will be a database that I want to keep track
of purchases, and if it is entered in as text, I wouldn't be able to do
calculations such as showing how old something is.

How can I have a text field where a person enters the date and have
that information entered into the database?

Mike


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




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




Re: [PHP] Forms and MySql date

2003-02-20 Thread Frank Keessen
Hi,

You can let the users enter a date as 20-02-2003 into a textfield with the
name $userdate

Then you can use this function to convert it;

$date_array = split(-, $userdate);
$mysqldate = $date_array[2].-.$date_array[1].-.$date_array[0];

Store $mysqldate into the database!

Regards,

Frank



- Original Message -
From: Philip Hallstrom [EMAIL PROTECTED]
To: Mike Tuller [EMAIL PROTECTED]
Cc: php mailing list list [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 11:48 PM
Subject: [PHP] Re: Forms and MySql date


 You could use the TO_DATE function to convert that text string into a
 date, or reformat it in PHP to -mm-dd which mysql will take
 automatically (at least I think so)

 On Thu, 20 Feb 2003, Mike Tuller wrote:

  I have a form that I want to enter a date into a MySql database. I
  currently have the column in the database set as Date, and can't seem
  to get the date I enter into the text field to go into the database
  using the format yymmdd. I could change the column to varchar, and then
  it would enter, but this will be a database that I want to keep track
  of purchases, and if it is entered in as text, I wouldn't be able to do
  calculations such as showing how old something is.
 
  How can I have a text field where a person enters the date and have
  that information entered into the database?
 
  Mike
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


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



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