Re: [PHP-DB] "Last monday" query question

2004-08-05 Thread Jason Wong
On Friday 06 August 2004 05:33, Adrian Madrid wrote:
> How do you select all articles from last monday on (and that I can use
> that query today and always too)? I've been trying to figure out how to
> do this query but so far all I can do is create a /very /long query and
> it doesn't seem to work all the time. Any ideas?

Use strtotime() and maybe PHP's other date/time functions then plug into your 
query.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Slous' Contention:
If you do a job too well, you'll get stuck with it.
*/

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



RE: [PHP-DB] Php if statement in a form (solved)

2004-08-05 Thread Justin.Baiocchi

Not to worry - manage to solve the problem using the line below

$date=date('H:i');
echo "";

Thanks for all the input


-Original Message-
From: Baiocchi, Justin (CSIRO IT, Armidale) 
Sent: Friday, 6 August 2004 12:50 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Php if statement in a form


Well, this works: so you were all on the right track

if($row['timeout']=="")
{
print "";
}else{
print $row["timeout"];
}

But now I get a parse error on the  line


-Original Message-
From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED] 
Sent: Friday, 6 August 2004 12:30 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Php if statement in a form


what about this?

if(empty($row["timeout"]))


- Original Message - 
From: "Doug Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 06, 2004 10:18 AM
Subject: Re: [PHP-DB] Php if statement in a form


> if (is_null($row["timeout"]).)
> 
> [EMAIL PROTECTED] wrote:
> > Still no joy. The parse error actually refers to the --  if
> > ($row["timeout"] IS NULL); --- line.
> > 
> >

-- 
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] Php if statement in a form

2004-08-05 Thread Ng Hwee Hwee
try this??

if($row['timeout']=="")
{
echo "";
}else{
print $row["timeout"];
}

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 06, 2004 10:50 AM
Subject: RE: [PHP-DB] Php if statement in a form


> Well, this works: so you were all on the right track
> 
> if($row['timeout']=="")
> {
> print "";
> }else{
> print $row["timeout"];
> }
> 
> But now I get a parse error on the  line
> 
> 
> -Original Message-
> From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED] 
> Sent: Friday, 6 August 2004 12:30 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Php if statement in a form
> 
> 
> what about this?
> 
> if(empty($row["timeout"]))
> 
> 
> - Original Message - 
> From: "Doug Thompson" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Friday, August 06, 2004 10:18 AM
> Subject: Re: [PHP-DB] Php if statement in a form
> 
> 
> > if (is_null($row["timeout"]).)
> > 
> > [EMAIL PROTECTED] wrote:
> > > Still no joy. The parse error actually refers to the --  if
> > > ($row["timeout"] IS NULL); --- line.
> > > 
> > >
> 
> -- 
> 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] Php if statement in a form

2004-08-05 Thread Justin.Baiocchi
Well, this works: so you were all on the right track

if($row['timeout']=="")
{
print "";
}else{
print $row["timeout"];
}

But now I get a parse error on the  line


-Original Message-
From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED] 
Sent: Friday, 6 August 2004 12:30 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Php if statement in a form


what about this?

if(empty($row["timeout"]))


- Original Message - 
From: "Doug Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 06, 2004 10:18 AM
Subject: Re: [PHP-DB] Php if statement in a form


> if (is_null($row["timeout"]).)
> 
> [EMAIL PROTECTED] wrote:
> > Still no joy. The parse error actually refers to the --  if
> > ($row["timeout"] IS NULL); --- line.
> > 
> >

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



Re: [PHP-DB] Php if statement in a form

2004-08-05 Thread Ng Hwee Hwee
what about this?

if(empty($row["timeout"]))


- Original Message - 
From: "Doug Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 06, 2004 10:18 AM
Subject: Re: [PHP-DB] Php if statement in a form


> if (is_null($row["timeout"]).)
> 
> [EMAIL PROTECTED] wrote:
> > Still no joy. The parse error actually refers to the --  if
> > ($row["timeout"] IS NULL); --- line.
> > 
> > 
> > -Original Message-
> > From: Eric Schwartz [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, 6 August 2004 11:32 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] Php if statement in a form
> > 
> > 
> > Sorry.  Forgot to remove the word echo from that line.
> > 
> > On Thu, 5 Aug 2004 21:29:01 -0400, Eric Schwartz
> > <[EMAIL PROTECTED]> wrote:
> > 
> >>On Fri, 6 Aug 2004 10:21:19 +1000, [EMAIL PROTECTED]
> >><[EMAIL PROTECTED]> wrote:
> >>
> >>>Thanks Eric,
> >>>
> >>>I have changed it somewhat but am just getting a parse error,
> >>>unexpected T_STRING on that line.
> >>>
> >>>My revised code is below:
> >>>
> >>>
> >>>print "Current Staff Working Alone";
> >>>print "";
> >>>print "\n";
> >>>print "\n";
> >>>print
> >>>
> > 
> > "NameLocationTime
> > 
> >>>inTime Out/tr>";
> >>>while ($row = mysql_fetch_array($result, MYSQL_BOTH))
> >>>{
> >>>print "";
> >>>print "";
> >>>print "";
> >>>print $row["name"];
> >>>print "";
> >>>print $row["location"];
> >>>print "";
> >>>print $row["timein"];
> >>>print "";
> >>>if ($row["timeout"] IS NULL);
> >>>{
> >>>print ;
> > 
> >>>} else {
> >>>print $row["timeout"];
> >>>}
> >>>print "\n";
> >>>}
> >>>print "\n";
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>-Original Message-
> >>>From: Eric Schwartz [mailto:[EMAIL PROTECTED]
> >>>Sent: Friday, 6 August 2004 9:31 AM
> >>>To: [EMAIL PROTECTED]
> >>>Subject: Re: [PHP-DB] Php if statement in a form
> >>>
> >>>On Fri, 6 Aug 2004 08:53:53 +1000, [EMAIL PROTECTED]
> >>><[EMAIL PROTECTED]> wrote:
> >>>
> Hello, I wonder if someone could point me in the right direction
> > 
> > here.
> > 
> I have a table that is displayed that is also a form, and allowed
> > 
> > a
> > 
> person to select a record to update using a radio button. With one
> > 
> > of
> > 
> the fields of the form/table however, I would like it to display
> > 
> > the
> > 
> value in the db (if there is one). If there is no value then I
> > 
> > want
> > 
> >>>the
> >>>
> field to display the current time and then submit it to the db as
> > 
> > a
> > 
> variable.
> 
> I can get it to display the current time and submit it to the db,
> > 
> > but
> > 
> >>>I
> >>>
> don't know how to do the IF bit of the form/table.
> 
> Anyway, the code is below.
> Thanks
> 
>  $dbcnx = @mysql_connect( "localhost", "user", "password");
> mysql_select_db("movements");
> $result = mysql_query("SELECT id, name, location, timein, timeout
> > 
> > FROM
> > 
> workalone WHERE date=CURRENT_DATE()") or die (mysql_error());
> // Display the results of the query in a table
> print "Current Staff Working Alone";
> //below is the table/form with the id, name, location, timein and
> timeout taken from the db
> print " > 
> > cellspacing=\"0\">\n";
> > 
> print
> 
> > 
> > "NameLocationTime
> > 
> inTime Out/tr>";
> while ($row = mysql_fetch_array($result, MYSQL_BOTH))
> {
> print "";
> print "";
> print "";
> print $row["name"];
> print "";
> print $row["location"];
> print "";
> print $row["timein"];
> print "";
> //below is the IF thing I am having problems with
> ?>"> print "\n";
> }
> print "\n";
> 
> ?>
> if ($submit2)
> {
> $dbcnx = @mysql_connect( "localhost", "user", "password");
> mysql_select_db("movements");
> $result = mysql_query("UPDATE workalone SET timeout='$timeout'
> > 
> > WHERE
> > 
> id='$id'") or die (mysql_error());
> echo "Thank you, your Time Out has been recorded.";
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> >>>
> >>>You seem to have your php tags not around your if statement and you
> >>>are checking to see if $timeout rather than $row["timeout"] has a
> >>>value.  I also think the proper way to check for NULL is to say IS
> >>>NULL or NOT NULL, not $foo = NULL.  Could be wrong about that one.
> >>>
> >>> >>>if ($row["timeout"] IS NULL) {
> >>> echo date('H:i');
> >>>} else {
> >>>print $row["timeout"];
> >>>}
> >>>?>
> >>>
> >>>--
> >>>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
> >>>
> >>>
> >>
> >>Try a

RE: [PHP-DB] Php if statement in a form

2004-08-05 Thread David Robley
On Fri, 6 Aug 2004 11:04, Justin Baiocchi wrote:

> Still no joy. The parse error actually refers to the --  if
> ($row["timeout"] IS NULL); --- line.

Please trim your replies.

IS NULL is for mysl - try if ($row["timeout"]=== NULL)
-- 
David Robley

Heads I win, tails you lose.

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



Re: [PHP-DB] Php if statement in a form

2004-08-05 Thread Doug Thompson
if (is_null($row["timeout"]).)
[EMAIL PROTECTED] wrote:
Still no joy. The parse error actually refers to the --  if
($row["timeout"] IS NULL); --- line.
-Original Message-
From: Eric Schwartz [mailto:[EMAIL PROTECTED] 
Sent: Friday, 6 August 2004 11:32 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Php if statement in a form

Sorry.  Forgot to remove the word echo from that line.
On Thu, 5 Aug 2004 21:29:01 -0400, Eric Schwartz
<[EMAIL PROTECTED]> wrote:
On Fri, 6 Aug 2004 10:21:19 +1000, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
Thanks Eric,
I have changed it somewhat but am just getting a parse error,
unexpected T_STRING on that line.
My revised code is below:
print "Current Staff Working Alone";
print "";
print "\n";
print "\n";
print
"NameLocationTime
inTime Out/tr>";
while ($row = mysql_fetch_array($result, MYSQL_BOTH))
{
   print "";
   print "";
   print "";
   print $row["name"];
   print "";
   print $row["location"];
   print "";
   print $row["timein"];
   print "";
   if ($row["timeout"] IS NULL);
   {
   print date('H:i')">;
   } else {
   print $row["timeout"];
   }
   print "\n";
   }
   print "\n";
click
here to record your timeout">

-Original Message-
From: Eric Schwartz [mailto:[EMAIL PROTECTED]
Sent: Friday, 6 August 2004 9:31 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Php if statement in a form
On Fri, 6 Aug 2004 08:53:53 +1000, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
Hello, I wonder if someone could point me in the right direction
here.
I have a table that is displayed that is also a form, and allowed
a
person to select a record to update using a radio button. With one
of
the fields of the form/table however, I would like it to display
the
value in the db (if there is one). If there is no value then I
want
the
field to display the current time and then submit it to the db as
a
variable.
I can get it to display the current time and submit it to the db,
but
I
don't know how to do the IF bit of the form/table.
Anyway, the code is below.
Thanks
FROM
workalone WHERE date=CURRENT_DATE()") or die (mysql_error());
// Display the results of the query in a table
print "Current Staff Working Alone";
//below is the table/form with the id, name, location, timein and
timeout taken from the db
print "cellspacing=\"0\">\n";
print
"NameLocationTime
inTime Out/tr>";
while ($row = mysql_fetch_array($result, MYSQL_BOTH))
{
   print "";
   print "";
   print "";
   print $row["name"];
   print "";
   print $row["location"];
   print "";
   print $row["timein"];
   print "";
//below is the IF thing I am having problems with
   ?>
echo date('H:i');?>} else {">\n";
}
print "\n";
?>click
here to record your timeout">   
if ($submit2)
{
$dbcnx = @mysql_connect( "localhost", "user", "password");
mysql_select_db("movements");
$result = mysql_query("UPDATE workalone SET timeout='$timeout'
WHERE
id='$id'") or die (mysql_error());
echo "Thank you, your Time Out has been recorded.";
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

You seem to have your php tags not around your if statement and you
are checking to see if $timeout rather than $row["timeout"] has a
value.  I also think the proper way to check for NULL is to say IS
NULL or NOT NULL, not $foo = NULL.  Could be wrong about that one.

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

Try adding a quote on the line and escaping the other quotes, like
this:
print "date('H:i')."\">";

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


Re: [PHP-DB] bags o beans - filtering rows/array by value of an aggregated attribute

2004-08-05 Thread John Holmes
Grant Listhandle wrote:
In the database "beans" i have a table "bags_o_beans" where each row
represents a single bag, and columns named "bean_type" and "number_o_beans"
My teenage son is having several thousand hungry friends over in half an
hour, and I'm stuck making the bean dip...  I'm going to need 1 million
beans of a single type to make the dip.
My goal, before I start cooking, is to filter from the following query:
SELECT bean_type, sum(number_o_beans) FROM bags_o_beans GROUP BY bean_type
...into an html table such that only 'bean types' with
'sum(number_of_beans)' greater than 1 million are displayed.  I have tried
inserting the following snippet into the table-generating php code, with no
luck:
while ($row = @ mysql_fetch_row($result))
{
foreach($row as $data)
if ({sum(number_o_beans)} > (100))
print "\n\t {$data} ";
print "\n";
}
Thanks ahead of time for your thoughts and recipes :)
Grant
Are we doing your homework for you?
Why not just do this in your query?
SELECT bean_type, sum(number_o_beans)AS sum_beans FROM bags_o_beans 
GROUP BY bean_type HAVING sum_beans > 100

--
John Holmes
php|architect - The magazine for PHP professionals - http://www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] MSSQL INSERT query problem

2004-08-05 Thread John Holmes
Chris wrote:
Here is the code I use:
[snip]
$sql =& $db->prepare("INSERT INTO ExitSurveyAnswers (session_id,
Question_id, answer) VALUES ?,?,?");
[snip]
When I execute it I keep recieving and error message stating:
DB Error: syntax error
Not a MSSQL expert, but shouldn't the ?,?,? in your query have 
parenthesis around it??

 $sql =& $db->prepare("INSERT INTO ExitSurveyAnswers (session_id,
 Question_id, answer) VALUES (?,?,?)");
--
John Holmes
php|architect - The magazine for PHP professionals - http://www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Php if statement in a form

2004-08-05 Thread Justin.Baiocchi
Still no joy. The parse error actually refers to the --  if
($row["timeout"] IS NULL); --- line.


-Original Message-
From: Eric Schwartz [mailto:[EMAIL PROTECTED] 
Sent: Friday, 6 August 2004 11:32 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Php if statement in a form


Sorry.  Forgot to remove the word echo from that line.

On Thu, 5 Aug 2004 21:29:01 -0400, Eric Schwartz
<[EMAIL PROTECTED]> wrote:
> On Fri, 6 Aug 2004 10:21:19 +1000, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> > Thanks Eric,
> >
> > I have changed it somewhat but am just getting a parse error,
> > unexpected T_STRING on that line.
> >
> > My revised code is below:
> >
> >
> > print "Current Staff Working Alone";
> > print "";
> > print "\n";
> > print "\n";
> > print
> >
"NameLocationTime
> > inTime Out/tr>";
> > while ($row = mysql_fetch_array($result, MYSQL_BOTH))
> > {
> > print "";
> > print "";
> > print "";
> > print $row["name"];
> > print "";
> > print $row["location"];
> > print "";
> > print $row["timein"];
> > print "";
> > if ($row["timeout"] IS NULL);
> > {
> > print ;
> > } else {
> > print $row["timeout"];
> > }
> > print "\n";
> > }
> > print "\n";
> >
> > 
> >
> >
> >
> >
> > -Original Message-
> > From: Eric Schwartz [mailto:[EMAIL PROTECTED]
> > Sent: Friday, 6 August 2004 9:31 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] Php if statement in a form
> >
> > On Fri, 6 Aug 2004 08:53:53 +1000, [EMAIL PROTECTED]
> > <[EMAIL PROTECTED]> wrote:
> > > Hello, I wonder if someone could point me in the right direction
here.
> > >
> > > I have a table that is displayed that is also a form, and allowed
a
> > > person to select a record to update using a radio button. With one
of
> > > the fields of the form/table however, I would like it to display
the
> > > value in the db (if there is one). If there is no value then I
want
> > the
> > > field to display the current time and then submit it to the db as
a
> > > variable.
> > >
> > > I can get it to display the current time and submit it to the db,
but
> > I
> > > don't know how to do the IF bit of the form/table.
> > >
> > > Anyway, the code is below.
> > > Thanks
> > >
> > >  > > $dbcnx = @mysql_connect( "localhost", "user", "password");
> > > mysql_select_db("movements");
> > > $result = mysql_query("SELECT id, name, location, timein, timeout
FROM
> > > workalone WHERE date=CURRENT_DATE()") or die (mysql_error());
> > > // Display the results of the query in a table
> > > print "Current Staff Working Alone";
> > > //below is the table/form with the id, name, location, timein and
> > > timeout taken from the db
> > > print "\n";
> > > print
> > >
"NameLocationTime
> > > inTime Out/tr>";
> > > while ($row = mysql_fetch_array($result, MYSQL_BOTH))
> > > {
> > > print "";
> > > print "";
> > > print "";
> > > print $row["name"];
> > > print "";
> > > print $row["location"];
> > > print "";
> > > print $row["timein"];
> > > print "";
> > > //below is the IF thing I am having problems with
> > > ?>"> > > print "\n";
> > > }
> > > print "\n";
> > >
> > > ?>> >
> > > if ($submit2)
> > > {
> > > $dbcnx = @mysql_connect( "localhost", "user", "password");
> > > mysql_select_db("movements");
> > > $result = mysql_query("UPDATE workalone SET timeout='$timeout'
WHERE
> > > id='$id'") or die (mysql_error());
> > > echo "Thank you, your Time Out has been recorded.";
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> > You seem to have your php tags not around your if statement and you
> > are checking to see if $timeout rather than $row["timeout"] has a
> > value.  I also think the proper way to check for NULL is to say IS
> > NULL or NOT NULL, not $foo = NULL.  Could be wrong about that one.
> >
> >  > if ($row["timeout"] IS NULL) {
> >  echo date('H:i');
> > } else {
> > print $row["timeout"];
> > }
> > ?>
> >
> > --
> > 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
> >
> >
> 
> Try adding a quote on the line and escaping the other quotes, like
this:
> 
> print "";
>

-- 
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] Php if statement in a form

2004-08-05 Thread Eric Schwartz
Sorry.  Forgot to remove the word echo from that line.

On Thu, 5 Aug 2004 21:29:01 -0400, Eric Schwartz
<[EMAIL PROTECTED]> wrote:
> On Fri, 6 Aug 2004 10:21:19 +1000, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> > Thanks Eric,
> >
> > I have changed it somewhat but am just getting a parse error,
> > unexpected T_STRING on that line.
> >
> > My revised code is below:
> >
> >
> > print "Current Staff Working Alone";
> > print "";
> > print "\n";
> > print "\n";
> > print
> > "NameLocationTime
> > inTime Out/tr>";
> > while ($row = mysql_fetch_array($result, MYSQL_BOTH))
> > {
> > print "";
> > print "";
> > print "";
> > print $row["name"];
> > print "";
> > print $row["location"];
> > print "";
> > print $row["timein"];
> > print "";
> > if ($row["timeout"] IS NULL);
> > {
> > print ;
> > } else {
> > print $row["timeout"];
> > }
> > print "\n";
> > }
> > print "\n";
> >
> > 
> >
> >
> >
> >
> > -Original Message-
> > From: Eric Schwartz [mailto:[EMAIL PROTECTED]
> > Sent: Friday, 6 August 2004 9:31 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] Php if statement in a form
> >
> > On Fri, 6 Aug 2004 08:53:53 +1000, [EMAIL PROTECTED]
> > <[EMAIL PROTECTED]> wrote:
> > > Hello, I wonder if someone could point me in the right direction here.
> > >
> > > I have a table that is displayed that is also a form, and allowed a
> > > person to select a record to update using a radio button. With one of
> > > the fields of the form/table however, I would like it to display the
> > > value in the db (if there is one). If there is no value then I want
> > the
> > > field to display the current time and then submit it to the db as a
> > > variable.
> > >
> > > I can get it to display the current time and submit it to the db, but
> > I
> > > don't know how to do the IF bit of the form/table.
> > >
> > > Anyway, the code is below.
> > > Thanks
> > >
> > >  > > $dbcnx = @mysql_connect( "localhost", "user", "password");
> > > mysql_select_db("movements");
> > > $result = mysql_query("SELECT id, name, location, timein, timeout FROM
> > > workalone WHERE date=CURRENT_DATE()") or die (mysql_error());
> > > // Display the results of the query in a table
> > > print "Current Staff Working Alone";
> > > //below is the table/form with the id, name, location, timein and
> > > timeout taken from the db
> > > print "\n";
> > > print
> > > "NameLocationTime
> > > inTime Out/tr>";
> > > while ($row = mysql_fetch_array($result, MYSQL_BOTH))
> > > {
> > > print "";
> > > print "";
> > > print "";
> > > print $row["name"];
> > > print "";
> > > print $row["location"];
> > > print "";
> > > print $row["timein"];
> > > print "";
> > > //below is the IF thing I am having problems with
> > > ?>"> > > print "\n";
> > > }
> > > print "\n";
> > >
> > > ?>> >
> > > if ($submit2)
> > > {
> > > $dbcnx = @mysql_connect( "localhost", "user", "password");
> > > mysql_select_db("movements");
> > > $result = mysql_query("UPDATE workalone SET timeout='$timeout' WHERE
> > > id='$id'") or die (mysql_error());
> > > echo "Thank you, your Time Out has been recorded.";
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> > You seem to have your php tags not around your if statement and you
> > are checking to see if $timeout rather than $row["timeout"] has a
> > value.  I also think the proper way to check for NULL is to say IS
> > NULL or NOT NULL, not $foo = NULL.  Could be wrong about that one.
> >
> >  > if ($row["timeout"] IS NULL) {
> >  echo date('H:i');
> > } else {
> > print $row["timeout"];
> > }
> > ?>
> >
> > --
> > 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
> >
> >
> 
> Try adding a quote on the line and escaping the other quotes, like this:
> 
> print "";
>

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



Re: [PHP-DB] Php if statement in a form

2004-08-05 Thread Eric Schwartz
On Fri, 6 Aug 2004 10:21:19 +1000, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Thanks Eric,
> 
> I have changed it somewhat but am just getting a parse error,
> unexpected T_STRING on that line.
> 
> My revised code is below:
> 
> 
> print "Current Staff Working Alone";
> print "";
> print "\n";
> print "\n";
> print
> "NameLocationTime
> inTime Out/tr>";
> while ($row = mysql_fetch_array($result, MYSQL_BOTH))
> {
> print "";
> print "";
> print "";
> print $row["name"];
> print "";
> print $row["location"];
> print "";
> print $row["timein"];
> print "";
> if ($row["timeout"] IS NULL);
> {
> print ;
> } else {
> print $row["timeout"];
> }
> print "\n";
> }
> print "\n";
> 
> 
> 
> 
> 
> 
> -Original Message-
> From: Eric Schwartz [mailto:[EMAIL PROTECTED]
> Sent: Friday, 6 August 2004 9:31 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Php if statement in a form
> 
> On Fri, 6 Aug 2004 08:53:53 +1000, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> > Hello, I wonder if someone could point me in the right direction here.
> >
> > I have a table that is displayed that is also a form, and allowed a
> > person to select a record to update using a radio button. With one of
> > the fields of the form/table however, I would like it to display the
> > value in the db (if there is one). If there is no value then I want
> the
> > field to display the current time and then submit it to the db as a
> > variable.
> >
> > I can get it to display the current time and submit it to the db, but
> I
> > don't know how to do the IF bit of the form/table.
> >
> > Anyway, the code is below.
> > Thanks
> >
> >  > $dbcnx = @mysql_connect( "localhost", "user", "password");
> > mysql_select_db("movements");
> > $result = mysql_query("SELECT id, name, location, timein, timeout FROM
> > workalone WHERE date=CURRENT_DATE()") or die (mysql_error());
> > // Display the results of the query in a table
> > print "Current Staff Working Alone";
> > //below is the table/form with the id, name, location, timein and
> > timeout taken from the db
> > print "\n";
> > print
> > "NameLocationTime
> > inTime Out/tr>";
> > while ($row = mysql_fetch_array($result, MYSQL_BOTH))
> > {
> > print "";
> > print "";
> > print "";
> > print $row["name"];
> > print "";
> > print $row["location"];
> > print "";
> > print $row["timein"];
> > print "";
> > //below is the IF thing I am having problems with
> > ?>"> > print "\n";
> > }
> > print "\n";
> >
> > ?>>
> > if ($submit2)
> > {
> > $dbcnx = @mysql_connect( "localhost", "user", "password");
> > mysql_select_db("movements");
> > $result = mysql_query("UPDATE workalone SET timeout='$timeout' WHERE
> > id='$id'") or die (mysql_error());
> > echo "Thank you, your Time Out has been recorded.";
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> You seem to have your php tags not around your if statement and you
> are checking to see if $timeout rather than $row["timeout"] has a
> value.  I also think the proper way to check for NULL is to say IS
> NULL or NOT NULL, not $foo = NULL.  Could be wrong about that one.
> 
>  if ($row["timeout"] IS NULL) {
>  echo date('H:i');
> } else {
> print $row["timeout"];
> }
> ?>
> 
> --
> 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
> 
> 

Try adding a quote on the line and escaping the other quotes, like this:

print "";

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



RE: [PHP-DB] Php if statement in a form

2004-08-05 Thread Justin.Baiocchi
Thanks Eric,

I have changed it somewhat but am just getting a parse error,
unexpected T_STRING on that line.

My revised code is below:


print "Current Staff Working Alone";
print "";
print "\n";
print "\n";
print
"NameLocationTime
inTime Out/tr>";
while ($row = mysql_fetch_array($result, MYSQL_BOTH))
{
print "";
print "";
print "";
print $row["name"];
print "";
print $row["location"];
print "";
print $row["timein"];
print "";
if ($row["timeout"] IS NULL);
{
print ;
} else {
print $row["timeout"];
}
print "\n";
}
print "\n";





-Original Message-
From: Eric Schwartz [mailto:[EMAIL PROTECTED] 
Sent: Friday, 6 August 2004 9:31 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Php if statement in a form


On Fri, 6 Aug 2004 08:53:53 +1000, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hello, I wonder if someone could point me in the right direction here.
> 
> I have a table that is displayed that is also a form, and allowed a
> person to select a record to update using a radio button. With one of
> the fields of the form/table however, I would like it to display the
> value in the db (if there is one). If there is no value then I want
the
> field to display the current time and then submit it to the db as a
> variable.
> 
> I can get it to display the current time and submit it to the db, but
I
> don't know how to do the IF bit of the form/table.
> 
> Anyway, the code is below.
> Thanks
> 
>  $dbcnx = @mysql_connect( "localhost", "user", "password");
> mysql_select_db("movements");
> $result = mysql_query("SELECT id, name, location, timein, timeout FROM
> workalone WHERE date=CURRENT_DATE()") or die (mysql_error());
> // Display the results of the query in a table
> print "Current Staff Working Alone";
> //below is the table/form with the id, name, location, timein and
> timeout taken from the db
> print "\n";
> print
> "NameLocationTime
> inTime Out/tr>";
> while ($row = mysql_fetch_array($result, MYSQL_BOTH))
> {
> print "";
> print "";
> print "";
> print $row["name"];
> print "";
> print $row["location"];
> print "";
> print $row["timein"];
> print "";
> //below is the IF thing I am having problems with
> ?>"> print "\n";
> }
> print "\n";
> 
> ?>
> if ($submit2)
> {
> $dbcnx = @mysql_connect( "localhost", "user", "password");
> mysql_select_db("movements");
> $result = mysql_query("UPDATE workalone SET timeout='$timeout' WHERE
> id='$id'") or die (mysql_error());
> echo "Thank you, your Time Out has been recorded.";
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

You seem to have your php tags not around your if statement and you
are checking to see if $timeout rather than $row["timeout"] has a
value.  I also think the proper way to check for NULL is to say IS
NULL or NOT NULL, not $foo = NULL.  Could be wrong about that one.




-- 
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] Php if statement in a form

2004-08-05 Thread Eric Schwartz
On Fri, 6 Aug 2004 08:53:53 +1000, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hello, I wonder if someone could point me in the right direction here.
> 
> I have a table that is displayed that is also a form, and allowed a
> person to select a record to update using a radio button. With one of
> the fields of the form/table however, I would like it to display the
> value in the db (if there is one). If there is no value then I want the
> field to display the current time and then submit it to the db as a
> variable.
> 
> I can get it to display the current time and submit it to the db, but I
> don't know how to do the IF bit of the form/table.
> 
> Anyway, the code is below.
> Thanks
> 
>  $dbcnx = @mysql_connect( "localhost", "user", "password");
> mysql_select_db("movements");
> $result = mysql_query("SELECT id, name, location, timein, timeout FROM
> workalone WHERE date=CURRENT_DATE()") or die (mysql_error());
> // Display the results of the query in a table
> print "Current Staff Working Alone";
> //below is the table/form with the id, name, location, timein and
> timeout taken from the db
> print "\n";
> print
> "NameLocationTime
> inTime Out/tr>";
> while ($row = mysql_fetch_array($result, MYSQL_BOTH))
> {
> print "";
> print "";
> print "";
> print $row["name"];
> print "";
> print $row["location"];
> print "";
> print $row["timein"];
> print "";
> //below is the IF thing I am having problems with
> ?>"> print "\n";
> }
> print "\n";
> 
> ?>
> if ($submit2)
> {
> $dbcnx = @mysql_connect( "localhost", "user", "password");
> mysql_select_db("movements");
> $result = mysql_query("UPDATE workalone SET timeout='$timeout' WHERE
> id='$id'") or die (mysql_error());
> echo "Thank you, your Time Out has been recorded.";
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

You seem to have your php tags not around your if statement and you
are checking to see if $timeout rather than $row["timeout"] has a
value.  I also think the proper way to check for NULL is to say IS
NULL or NOT NULL, not $foo = NULL.  Could be wrong about that one.




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



Re: [PHP-DB] php-db@lists.php.net is currently protecting themselves from receiving junk mail using Spamcease Just this once, click the link below so I can receive your emails.

2004-08-05 Thread Ben Riddell
I'm going to revise this, because I just got the confirmation 
email.  People should not click on the link.

The link that it wants me to click on is 
http://www.tgpwizards.com/spamcease2/verify.php?id=[xxx]

A quick check of the domain - http://www.tgpwizards.com - leads me to 
believe something else is happening that ain't so legit.

This should be forwarded to the list admin...
-Ben
At 02:39 PM 8/5/2004, Ben Riddell wrote:
Spamcease is whitelist software for controlling Spam.  It maintains a list 
of people from whom the recipient wishes to receive email.  If you're not 
on the list, your email won't get through.

It's called a "challenge/response" system.
For each email sent to someone running spamcease, the server automatically 
issues a "challenge" email back to the sender to prove that s/he is a 
person and not a spambot.  The original sender clicks on the link in 
"response" (something a spambot can't do), and your email address is added 
to the list of people whose email gets through.

They are a pain in the tuchus for listservs and the like, unless the 
person running the program sets the parameters correctly to allow email 
addressed to the list to get through, otherwise, each person on the list 
has to go through the challenge and response procedure.

HTH,
-Ben
At 02:13 PM 8/5/2004, Mark wrote:
It is bogus. If you notice, your emails still go to the list. Someone
did this to php-general a bit ago. You can ignore it. There was
speculation that it was an email harvester, checking to verify that
return addresses are valid.
--- Colin Kettenacker <[EMAIL PROTECTED]> wrote:
> I got this for the PHP-General list. I think it's bogus but it
> would be nice
> to get a confirmation from the list admin.
>
> ck
> --
> Cheap Domain Registration | Web Hosting | Email Packages | + more
> Fantastic prices -- Even better service.
> http://www.hosttohost.net
>
>
> Pablo M. Rivas [EMAIL PROTECTED] on 8/4/04 9:57 AM wrote:
>
> > Hello Josh,
> >
> > JAM> What is this?
> >
> > JAM> I received this E-Mail, and the link goes to something other
> than PHP.net
> >
> > JAM> [EMAIL PROTECTED] is currently protecting themselves from
> receiving
> > junk
> > JAM> mail using Spamcease Just this once, click the link below so
> I can
> > receive
> > JAM> your emails.
> > JAM> You won't have to do this again.
> >
> >
> > CLICK THE LINK SO HE CAN RECEIVE YOUR MAIL, and you won't have to
> > do this again ;)
---
 Ben Riddell --
--- Freelance Web Developer ---
- ben at thewhitebear dot com -
 www.thewhitebear.com -
 510/332.2979 -
---
---
 Ben Riddell --
--- Freelance Web Developer ---
- ben at thewhitebear dot com -
 www.thewhitebear.com -
 510/332.2979 -
---


Re: [PHP-DB] bags o beans - filtering rows/array by value of an aggregated attribute

2004-08-05 Thread Justin Patrin
On Thu, 5 Aug 2004 17:26:05 -0500, Grant Listhandle <[EMAIL PROTECTED]> wrote:
> In the database "beans" i have a table "bags_o_beans" where each row
> represents a single bag, and columns named "bean_type" and "number_o_beans"
> 
> My teenage son is having several thousand hungry friends over in half an
> hour, and I'm stuck making the bean dip...  I'm going to need 1 million
> beans of a single type to make the dip.
> 
> My goal, before I start cooking, is to filter from the following query:
> 
> SELECT bean_type, sum(number_o_beans) FROM bags_o_beans GROUP BY bean_type

Use a column alias:

SELECT bean_type, sum(number_o_beans) AS total_number_of_beans FROM
bags_o_beans GROUP BY bean_type

> 
> into an html table such that only 'bean types' with
> 'sum(number_of_beans)' greater than 1 million are displayed.  I have tried
> inserting the following snippet into the table-generating php code, with no
> luck:
> 
> while ($row = @ mysql_fetch_row($result))
> {
> foreach($row as $data)
> if ({sum(number_o_beans)} > (100))

if($row['total_number_of_beans']) > 100)

> print "\n\t {$data} ";
> print "\n";
> }
> 
> Thanks ahead of time for your thoughts and recipes :)
> Grant
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> !DSPAM:4112b26a148642019194572!
> 
> 


-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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



[PHP-DB] Php if statement in a form

2004-08-05 Thread Justin.Baiocchi
Hello, I wonder if someone could point me in the right direction here.

I have a table that is displayed that is also a form, and allowed a
person to select a record to update using a radio button. With one of
the fields of the form/table however, I would like it to display the
value in the db (if there is one). If there is no value then I want the
field to display the current time and then submit it to the db as a
variable.

I can get it to display the current time and submit it to the db, but I
don't know how to do the IF bit of the form/table.

Anyway, the code is below.
Thanks



Current Staff Working Alone";
//below is the table/form with the id, name, location, timein and
timeout taken from the db
print "\n";
print
"NameLocationTime
inTime Out/tr>";
while ($row = mysql_fetch_array($result, MYSQL_BOTH))
{
print "";
print "";
print "";
print $row["name"];
print "";
print $row["location"];
print "";
print $row["timein"];
print "";
//below is the IF thing I am having problems with
?>">\n";
}
print "\n";

?>   Thank you, your Time Out has been recorded.";

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



[PHP-DB] bags o beans - filtering rows/array by value of an aggregated attribute

2004-08-05 Thread Grant Listhandle
In the database "beans" i have a table "bags_o_beans" where each row
represents a single bag, and columns named "bean_type" and "number_o_beans"

My teenage son is having several thousand hungry friends over in half an
hour, and I'm stuck making the bean dip...  I'm going to need 1 million
beans of a single type to make the dip.

My goal, before I start cooking, is to filter from the following query:

SELECT bean_type, sum(number_o_beans) FROM bags_o_beans GROUP BY bean_type

...into an html table such that only 'bean types' with
'sum(number_of_beans)' greater than 1 million are displayed.  I have tried
inserting the following snippet into the table-generating php code, with no
luck:


while ($row = @ mysql_fetch_row($result))
{
foreach($row as $data)
if ({sum(number_o_beans)} > (100))
print "\n\t {$data} ";
print "\n";
}


Thanks ahead of time for your thoughts and recipes :)
Grant

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



[PHP-DB] MSSQL INSERT query problem

2004-08-05 Thread Chris
Here is the code I use:

$dsn = "mssql://username:[EMAIL PROTECTED]/database";

$options = array(
'debug'   => 2,
'portability' => DB_PORTABILITY_ALL,
);

$db =& DB::connect($dsn, $options);
if (DB::isError($db)) {
 $db->getDebugInfo();
 die($db->getMessage());
}

$sql =& $db->prepare("INSERT INTO ExitSurveyAnswers (session_id,
Question_id, answer) VALUES ?,?,?");

// Always check that result is not an error
if (DB::isError($sql)) {
 $sql->getDebugInfo();
 die($sql->getMessage());
}

$alldata = array($id,$question,$answer);

$res =& $db->execute($sql, $alldata);
 print_r ($res);
if (DB::isError($res)) {
 $res->getDebugInfo();
 die($res->getMessage());
}

$db->disconnect();

When I execute it I keep recieving and error message stating:
DB Error: syntax error

I use PEAR DB and PEAR HTTP SESSION.

Any ideas will be helpful.

Thanks,
Chris

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



[PHP-DB] "Last monday" query question

2004-08-05 Thread Adrian Madrid




How do you
select all articles from last monday on (and that I can use that query
today and always too)? I've been trying to figure out how to do this
query but so far all I can do is create a very long query and
it doesn't seem to work all the time. Any ideas?

Thanks in advance,


-- 
Adrian Madrid
http://www.hyperxmedia.com
HyperX Media
45 West 9000 South, Unit 2
Sandy, UT 84020
Office: 801.566.0670


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

Re: [PHP-DB] php-db@lists.php.net is currently protecting themselves from receiving junk mail using Spamcease Just this once, click the link below so I can receive your emails.

2004-08-05 Thread Ben Riddell
Spamcease is whitelist software for controlling Spam.  It maintains a list 
of people from whom the recipient wishes to receive email.  If you're not 
on the list, your email won't get through.

It's called a "challenge/response" system.
For each email sent to someone running spamcease, the server automatically 
issues a "challenge" email back to the sender to prove that s/he is a 
person and not a spambot.  The original sender clicks on the link in 
"response" (something a spambot can't do), and your email address is added 
to the list of people whose email gets through.

They are a pain in the tuchus for listservs and the like, unless the person 
running the program sets the parameters correctly to allow email addressed 
to the list to get through, otherwise, each person on the list has to go 
through the challenge and response procedure.

HTH,
-Ben
At 02:13 PM 8/5/2004, Mark wrote:
It is bogus. If you notice, your emails still go to the list. Someone
did this to php-general a bit ago. You can ignore it. There was
speculation that it was an email harvester, checking to verify that
return addresses are valid.
--- Colin Kettenacker <[EMAIL PROTECTED]> wrote:
> I got this for the PHP-General list. I think it's bogus but it
> would be nice
> to get a confirmation from the list admin.
>
> ck
> --
> Cheap Domain Registration | Web Hosting | Email Packages | + more
> Fantastic prices -- Even better service.
> http://www.hosttohost.net
>
>
> Pablo M. Rivas [EMAIL PROTECTED] on 8/4/04 9:57 AM wrote:
>
> > Hello Josh,
> >
> > JAM> What is this?
> >
> > JAM> I received this E-Mail, and the link goes to something other
> than PHP.net
> >
> > JAM> [EMAIL PROTECTED] is currently protecting themselves from
> receiving
> > junk
> > JAM> mail using Spamcease Just this once, click the link below so
> I can
> > receive
> > JAM> your emails.
> > JAM> You won't have to do this again.
> >
> >
> > CLICK THE LINK SO HE CAN RECEIVE YOUR MAIL, and you won't have to
> > do this again ;)
---
 Ben Riddell --
--- Freelance Web Developer ---
- ben at thewhitebear dot com -
 www.thewhitebear.com -
 510/332.2979 -
---


Re: [PHP-DB] php-db@lists.php.net is currently protecting themselves from receiving junk mail using Spamcease Just this once, click the link below so I can receive your emails.

2004-08-05 Thread Mark
It is bogus. If you notice, your emails still go to the list. Someone
did this to php-general a bit ago. You can ignore it. There was
speculation that it was an email harvester, checking to verify that
return addresses are valid.


--- Colin Kettenacker <[EMAIL PROTECTED]> wrote:

> I got this for the PHP-General list. I think it's bogus but it
> would be nice
> to get a confirmation from the list admin.
> 
> ck
> -- 
> Cheap Domain Registration | Web Hosting | Email Packages | + more
> Fantastic prices -- Even better service.
> http://www.hosttohost.net
> 
> 
> Pablo M. Rivas [EMAIL PROTECTED] on 8/4/04 9:57 AM wrote:
> 
> > Hello Josh,
> > 
> > JAM> What is this?
> > 
> > JAM> I received this E-Mail, and the link goes to something other
> than PHP.net
> > 
> > JAM> [EMAIL PROTECTED] is currently protecting themselves from
> receiving
> > junk
> > JAM> mail using Spamcease Just this once, click the link below so
> I can
> > receive
> > JAM> your emails.
> > JAM> You won't have to do this again.
> > 
> > 
> > CLICK THE LINK SO HE CAN RECEIVE YOUR MAIL, and you won't have to
> > do this again ;)
> > 
> > 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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



Re: [PHP-DB] Apache / PHP Page built from a MySQL Database Diplay Problems

2004-08-05 Thread Pablo M. Rivas
Hello Mitch,

1) Have you tried doing "SHOW SOURCE" in your browser?
2) Take a look at: http://www.php.net/manual/en/function.error-reporting.php

Good luck!

M> Here is the basic scenario:

M> - Configuration data is gathered from Oracle servers then ftp'd to my
M> apache / mysql server.

M> - The apache / mysql server receives the datafile from the Oracle
M> clients and loads the data into a MySQL database.

M> - The webpages are coded using PHP, SQL, and some JavaScript.

M> Now here is where it gets weird

M> - When the data is displayed (pages are based upon the configuration
M> of each Oracle +, some times the
M> data displays other times the page is simply blank?  It is only for a
M> few out of the many that we have in the MySQL database.  It is always
M> the same ones with the problem.  Re-loading the data for those problem
M> + does not fix it.

M> Anyone see this before?   Could it be a special character that the web
M> browser cannot handle?   I am at a loss on this one.

M> Any advice on the problem and how to trouble shoot would be
M> appreciated!   Mitch




-- 
Best regards,
 Pablo

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



[PHP-DB] Apache / PHP Page built from a MySQL Database Diplay Problems

2004-08-05 Thread Mitch
Here is the basic scenario:

- Configuration data is gathered from Oracle servers then ftp'd to my
apache / mysql server.

- The apache / mysql server receives the datafile from the Oracle
clients and loads the data into a MySQL database.

- The webpages are coded using PHP, SQL, and some JavaScript.

Now here is where it gets weird

- When the data is displayed (pages are based upon the configuration
of each Oracle +, some times the
data displays other times the page is simply blank?  It is only for a
few out of the many that we have in the MySQL database.  It is always
the same ones with the problem.  Re-loading the data for those problem
+ does not fix it.

Anyone see this before?   Could it be a special character that the web
browser cannot handle?   I am at a loss on this one.

Any advice on the problem and how to trouble shoot would be
appreciated!   Mitch

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



RE: [PHP-DB] SQL Insert problem

2004-08-05 Thread Miles Thompson
1. echo your $sql to make certain it's as sound as you think.
2. i don't see execution of the query: mysql_query( $sql) - you'll have to 
put the die() & error after this function.
Hth - mthompson

At 12:05 PM 8/5/2004, Vincent Jordan wrote:
I have inserted '$address2', correctly in the row however it is still not
putting the data in the table.
I am not getting an error but I do believe I have correct syntax set to
display problems.
> -Original Message-
> From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 05, 2004 10:26 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] SQL Insert problem
>
> You're missing address2 in your list of values. This means that you have
> an
> unmatching number of column names and values in your query and that'll
> make
> the query bomb.
>
> Rich
>
>
> > -Original Message-
> > From: Vincent Jordan [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, August 05, 2004 10:25 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] SQL Insert problem
> >
> >
> > Im having a problem inserting data. Ive looked over this
> > again and again and
> > can not find what ive missed. Everything else works besides
> > the db insert.
> >
> >
> >
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> >
> >  >
> > ini_set ('display_errors', 1);
> >
> > error_reporting (E_ALL & ~E_NOTICE);
> >
> > // Define
> >
> > $firstname = $_POST['firstname'];
> >
> >
> >
> > $lastname = $_POST['lastname'];
> >
> >
> >
> > $address = $_POST['address'];
> >
> >
> >
> > $address2 = $_POST['address2'];
> >
> >
> >
> > $city = $_POST['city'];
> >
> >
> >
> > $state = $_POST['state'];
> >
> >
> >
> > $zip = $_POST['zip'];
> >
> >
> >
> > $phone = $_POST['phone'];
> >
> >
> >
> > $email = $_POST['email'];
> >
> >
> >
> > $serial = $_POST['serial'];
> >
> >
> >
> > $product = $_POST['product'];
> >
> >
> >
> > $reason = $_POST['reason'];
> >
> >
> >
> > $gold = $_POST['gold_button_y'];
> >
> >
> >
> > $goldaccount = $_POST['goldaccount'];
> >
> >
> >
> > $rmanumber = $lastname{0}.date("ndyGi");
> >
> >
> >
> > $connect = mysql_connect("SERVER ", "USER", "PASSWORD") or die
> > (mysql_error());
> >
> > $select = mysql_select_db ("spdata") or die (mysql_error());
> >
> > $sql = "INSERT INTO rmarequest (firstname, lastname, address,
> > address2,
> > city, state, zip, phone, email, serial, product, reason,
> > rmanumber)VALUES
> > ('$firstname', '$lastname', '$address', '$city', '$state',
> > '$zip', '$phone',
> > '$email', '$serial', '$product', '$reason', '$rmanumber') or die
> > (mysql_error())";
> >
> > if (isset($_POST['submit'])) {
> >
> > $sql;
> >
> > }
> >
> > // Send  and put in email message
> >
> > $htmlheader = "Content-Type: text/html; charset=us-ascii\n";
> >
> > $htmlheader .= "Content-Transfer-Encoding: 7bit";
> >
> > $header = $from; // set the from field in the header
> >
> > $header .= "\n"; // add a line feed
> >
> > $header .= "MIME-version: 1.0\n"; //add the mime-version header
> >
> > $header .= $htmlheader."\n";
> >
> > $from = "From: RMA Request <[EMAIL PROTECTED]>";
> >
> > $message = "$firstname $lastname
> >
> > $address
> >
> > $address2
> >
> > $city
> >
> > $state
> >
> > $zip
> >
> > $phone
> >
> > $email
> >
> > $product
> >
> > $serial
> >
> > $gold
> >
> > $goldaccount
> >
> > $reason
> >
> > $rmanumber";
> >
> >
> >
> >
> >
> > // Send email to support
> >
> > mail("[EMAIL PROTECTED]", "RMA Request", $message, $header);
> >
> > ?>
> >
> > http://www.w3.org/1999/xhtml";>
> >
> > 
> >
> > Untitled Document
> >
> > 
> >
> > 
> >
> > RMA Request Sent
> >
> > Your RMA Number is
> >
> > Please include a note within your package with your
> > shipping address,
> > phone number and discription of the problem.When
> > shipping Smart Parts
> > reccomends insuring your package for the full replacment cost.
> >
> > We also advise purchasing tracking services if using the postal
> > service.
> >
> > Ship your return to: 
> >
> > Smart Parts, Inc
> >
> > ATTN 
> >
> > Loyanhanna Business Complex
> >
> > 100 Station St.
> >
> > Loyalhanna Pa. 15661
> >
> > 
> >
> >   Please allow up to one week for package delivery.
> >
> > For status information please call 800-992-2147 and ask
> > for the returns
> > department.
> >
> > Click Here to print
> > this page > />
> >
> > Click here to return to RMA Request form
> >
> > 
> >
> > 
> >
> >
> >
> >
>
> --
> 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] RE: SQL Insert problem

2004-08-05 Thread Jensen, Kimberlee
All you have done here is just assigned the query string to a variable. This alone 
does absolutely nothing as far as the db is concerned. You need to execute the query 
against the db for it to have an effect. The mysql_query() function is used for all 
queries, not just selects.


$sql = "INSERT INTO rmarequest (firstname, lastname, address, address2,
city, state, zip, phone, email, serial, product, reason, rmanumber)VALUES
('$firstname', '$lastname', '$address', '$city', '$state', '$zip', '$phone',
'$email', '$serial', '$product', '$reason', '$rmanumber')";

$result = mysql_query ($sql, $connect) or die (mysql_error($connect))";


-Original Message-
From:   Vincent Jordan [mailto:[EMAIL PROTECTED]
Sent:   Thu 8/5/2004 7:24 AM
To: [EMAIL PROTECTED]
Cc: 
Subject:SQL Insert problem
Im having a problem inserting data. Ive looked over this again and again and
can not find what ive missed. Everything else works besides the db insert.

 

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

";

$message = "$firstname $lastname

$address

$address2

$city

$state

$zip

$phone

$email

$product

$serial

$gold

$goldaccount

$reason

$rmanumber";

 

 

// Send email to support

mail("[EMAIL PROTECTED]", "RMA Request", $message, $header);

?>

http://www.w3.org/1999/xhtml";>



Untitled Document





RMA Request Sent

Your RMA Number is

Please include a note within your package with your shipping address,
phone number and discription of the problem.When shipping Smart Parts
reccomends insuring your package for the full replacment cost. 

We also advise purchasing tracking services if using the postal
service.

Ship your return to: 

Smart Parts, Inc

ATTN 

Loyanhanna Business Complex

100 Station St.

Loyalhanna Pa. 15661



  Please allow up to one week for package delivery.

For status information please call 800-992-2147 and ask for the returns
department.

Click Here to print this page

Click here to return to RMA Request form





 






RE: [PHP-DB] SQL Insert problem

2004-08-05 Thread Hutchins, Richard
Try echoing out your query to the browser window before you send it to the
database. A simple echo $sql should suffice. Then you can see what's
actually being sent in the query string to the database. Thar may show you
exactly what's going wrong. If your query string looks right, then the error
lies elsewhere.

Was your error reporting logic reporting that you had a mismatched number of
columns and arguments before? If not, then your error reporting logic is
probably not doing what you expect it to.

Rich


> -Original Message-
> From: Vincent Jordan [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 05, 2004 11:06 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] SQL Insert problem
> 
> 
> I have inserted '$address2', correctly in the row however it 
> is still not
> putting the data in the table.
> 
> I am not getting an error but I do believe I have correct 
> syntax set to
> display problems. 
> 
> > -Original Message-
> > From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, August 05, 2004 10:26 AM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [PHP-DB] SQL Insert problem
> > 
> > You're missing address2 in your list of values. This means 
> that you have
> > an
> > unmatching number of column names and values in your query 
> and that'll
> > make
> > the query bomb.
> > 
> > Rich
> > 
> > 
> > > -Original Message-
> > > From: Vincent Jordan [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, August 05, 2004 10:25 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP-DB] SQL Insert problem
> > >
> > >
> > > Im having a problem inserting data. Ive looked over this
> > > again and again and
> > > can not find what ive missed. Everything else works besides
> > > the db insert.
> > >
> > >
> > >
> > >  > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > >
> > >  > >
> > > ini_set ('display_errors', 1);
> > >
> > > error_reporting (E_ALL & ~E_NOTICE);
> > >
> > > // Define
> > >
> > > $firstname = $_POST['firstname'];
> > >
> > >
> > >
> > > $lastname = $_POST['lastname'];
> > >
> > >
> > >
> > > $address = $_POST['address'];
> > >
> > >
> > >
> > > $address2 = $_POST['address2'];
> > >
> > >
> > >
> > > $city = $_POST['city'];
> > >
> > >
> > >
> > > $state = $_POST['state'];
> > >
> > >
> > >
> > > $zip = $_POST['zip'];
> > >
> > >
> > >
> > > $phone = $_POST['phone'];
> > >
> > >
> > >
> > > $email = $_POST['email'];
> > >
> > >
> > >
> > > $serial = $_POST['serial'];
> > >
> > >
> > >
> > > $product = $_POST['product'];
> > >
> > >
> > >
> > > $reason = $_POST['reason'];
> > >
> > >
> > >
> > > $gold = $_POST['gold_button_y'];
> > >
> > >
> > >
> > > $goldaccount = $_POST['goldaccount'];
> > >
> > >
> > >
> > > $rmanumber = $lastname{0}.date("ndyGi");
> > >
> > >
> > >
> > > $connect = mysql_connect("SERVER ", "USER", "PASSWORD") or die
> > > (mysql_error());
> > >
> > > $select = mysql_select_db ("spdata") or die (mysql_error());
> > >
> > > $sql = "INSERT INTO rmarequest (firstname, lastname, address,
> > > address2,
> > > city, state, zip, phone, email, serial, product, reason,
> > > rmanumber)VALUES
> > > ('$firstname', '$lastname', '$address', '$city', '$state',
> > > '$zip', '$phone',
> > > '$email', '$serial', '$product', '$reason', '$rmanumber') or die
> > > (mysql_error())";
> > >
> > > if (isset($_POST['submit'])) {
> > >
> > > $sql;
> > >
> > > }
> > >
> > > // Send  and put in email message
> > >
> > > $htmlheader = "Content-Type: text/html; charset=us-ascii\n";
> > >
> > > $htmlheader .= "Content-Transfer-Encoding: 7bit";
> > >
> > > $header = $from; // set the from field in the header
> > >
> > > $header .= "\n"; // add a line feed
> > >
> > > $header .= "MIME-version: 1.0\n"; //add the mime-version header
> > >
> > > $header .= $htmlheader."\n";
> > >
> > > $from = "From: RMA Request <[EMAIL PROTECTED]>";
> > >
> > > $message = "$firstname $lastname
> > >
> > > $address
> > >
> > > $address2
> > >
> > > $city
> > >
> > > $state
> > >
> > > $zip
> > >
> > > $phone
> > >
> > > $email
> > >
> > > $product
> > >
> > > $serial
> > >
> > > $gold
> > >
> > > $goldaccount
> > >
> > > $reason
> > >
> > > $rmanumber";
> > >
> > >
> > >
> > >
> > >
> > > // Send email to support
> > >
> > > mail("[EMAIL PROTECTED]", "RMA Request", $message, $header);
> > >
> > > ?>
> > >
> > > http://www.w3.org/1999/xhtml";>
> > >
> > > 
> > >
> > > Untitled Document
> > >
> > > 
> > >
> > > 
> > >
> > > RMA Request Sent
> > >
> > > Your RMA Number is   
>  
> > >
> > > Please include a note within your package with your
> > > shipping address,
> > > phone number and discription of the problem.When
> > > shipping Smart Parts
> > > reccomends insuring your package for the full replacment cost.
> > >
> > > We also advise purchasing tracking services if using 
> the postal
> > > service.
> > >
> > > Ship your return to: 
> > >
> > > Smart Parts, Inc
> > >
> > > ATTN 
> > >
> > > Loyanhanna Business Complex
> > >
> > > 100 Station St.
> > >
> > 

Re: [PHP-DB] SQL Insert problem

2004-08-05 Thread John W. Holmes
From: "Vincent Jordan" <[EMAIL PROTECTED]>

> > > $sql = "INSERT INTO rmarequest (firstname, lastname, address,
> > > address2,
> > > city, state, zip, phone, email, serial, product, reason,
> > > rmanumber)VALUES
> > > ('$firstname', '$lastname', '$address', '$city', '$state',
> > > '$zip', '$phone',
> > > '$email', '$serial', '$product', '$reason', '$rmanumber') or die
> > > (mysql_error())";

Uhhh. where's mysql_query()???

$sql = "INSERT ...";

$result = mysql_query($sql) or die(mysql_error());

---John Holmes...

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



Re: [PHP-DB] SQL Insert problem

2004-08-05 Thread Torsten Roehr
"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> From: "Vincent Jordan" <[EMAIL PROTECTED]>
>
> > Im having a problem inserting data. Ive looked over this again and again
> and
> > can not find what ive missed. Everything else works besides the db
insert.
>
> It would have helped if you told us the error you got was "column count
does
> not match value count" or something similar...
>
> > $sql = "INSERT INTO rmarequest (firstname, lastname, address, address2,
> > city, state, zip, phone, email, serial, product, reason,
rmanumber)VALUES
> > ('$firstname', '$lastname', '$address', '$city', '$state', '$zip',
> '$phone',
> > '$email', '$serial', '$product', '$reason', '$rmanumber') or die
> > (mysql_error())";
>
> You list 13 columns to insert into but only give 12 values.
>

Vincent, you can use the alternative INSERT syntax to avoid this problem in
the future:

INSERT INTO table SET
column1 = '$value1',
column2 = '$value2',
column3 = '$value3',
...

Regards, Torsten Roehr

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



RE: [PHP-DB] SQL Insert problem

2004-08-05 Thread Vincent Jordan
I have inserted '$address2', correctly in the row however it is still not
putting the data in the table.

I am not getting an error but I do believe I have correct syntax set to
display problems. 

> -Original Message-
> From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 05, 2004 10:26 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] SQL Insert problem
> 
> You're missing address2 in your list of values. This means that you have
> an
> unmatching number of column names and values in your query and that'll
> make
> the query bomb.
> 
> Rich
> 
> 
> > -Original Message-
> > From: Vincent Jordan [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, August 05, 2004 10:25 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] SQL Insert problem
> >
> >
> > Im having a problem inserting data. Ive looked over this
> > again and again and
> > can not find what ive missed. Everything else works besides
> > the db insert.
> >
> >
> >
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> >
> >  >
> > ini_set ('display_errors', 1);
> >
> > error_reporting (E_ALL & ~E_NOTICE);
> >
> > // Define
> >
> > $firstname = $_POST['firstname'];
> >
> >
> >
> > $lastname = $_POST['lastname'];
> >
> >
> >
> > $address = $_POST['address'];
> >
> >
> >
> > $address2 = $_POST['address2'];
> >
> >
> >
> > $city = $_POST['city'];
> >
> >
> >
> > $state = $_POST['state'];
> >
> >
> >
> > $zip = $_POST['zip'];
> >
> >
> >
> > $phone = $_POST['phone'];
> >
> >
> >
> > $email = $_POST['email'];
> >
> >
> >
> > $serial = $_POST['serial'];
> >
> >
> >
> > $product = $_POST['product'];
> >
> >
> >
> > $reason = $_POST['reason'];
> >
> >
> >
> > $gold = $_POST['gold_button_y'];
> >
> >
> >
> > $goldaccount = $_POST['goldaccount'];
> >
> >
> >
> > $rmanumber = $lastname{0}.date("ndyGi");
> >
> >
> >
> > $connect = mysql_connect("SERVER ", "USER", "PASSWORD") or die
> > (mysql_error());
> >
> > $select = mysql_select_db ("spdata") or die (mysql_error());
> >
> > $sql = "INSERT INTO rmarequest (firstname, lastname, address,
> > address2,
> > city, state, zip, phone, email, serial, product, reason,
> > rmanumber)VALUES
> > ('$firstname', '$lastname', '$address', '$city', '$state',
> > '$zip', '$phone',
> > '$email', '$serial', '$product', '$reason', '$rmanumber') or die
> > (mysql_error())";
> >
> > if (isset($_POST['submit'])) {
> >
> > $sql;
> >
> > }
> >
> > // Send  and put in email message
> >
> > $htmlheader = "Content-Type: text/html; charset=us-ascii\n";
> >
> > $htmlheader .= "Content-Transfer-Encoding: 7bit";
> >
> > $header = $from; // set the from field in the header
> >
> > $header .= "\n"; // add a line feed
> >
> > $header .= "MIME-version: 1.0\n"; //add the mime-version header
> >
> > $header .= $htmlheader."\n";
> >
> > $from = "From: RMA Request <[EMAIL PROTECTED]>";
> >
> > $message = "$firstname $lastname
> >
> > $address
> >
> > $address2
> >
> > $city
> >
> > $state
> >
> > $zip
> >
> > $phone
> >
> > $email
> >
> > $product
> >
> > $serial
> >
> > $gold
> >
> > $goldaccount
> >
> > $reason
> >
> > $rmanumber";
> >
> >
> >
> >
> >
> > // Send email to support
> >
> > mail("[EMAIL PROTECTED]", "RMA Request", $message, $header);
> >
> > ?>
> >
> > http://www.w3.org/1999/xhtml";>
> >
> > 
> >
> > Untitled Document
> >
> > 
> >
> > 
> >
> > RMA Request Sent
> >
> > Your RMA Number is
> >
> > Please include a note within your package with your
> > shipping address,
> > phone number and discription of the problem.When
> > shipping Smart Parts
> > reccomends insuring your package for the full replacment cost.
> >
> > We also advise purchasing tracking services if using the postal
> > service.
> >
> > Ship your return to: 
> >
> > Smart Parts, Inc
> >
> > ATTN 
> >
> > Loyanhanna Business Complex
> >
> > 100 Station St.
> >
> > Loyalhanna Pa. 15661
> >
> > 
> >
> >   Please allow up to one week for package delivery.
> >
> > For status information please call 800-992-2147 and ask
> > for the returns
> > department.
> >
> > Click Here to print
> > this page > />
> >
> > Click here to return to RMA Request form
> >
> > 
> >
> > 
> >
> >
> >
> >
> 
> --
> 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] SQL Insert problem

2004-08-05 Thread Vincent Jordan
Im having a problem inserting data. Ive looked over this again and again and
can not find what ive missed. Everything else works besides the db insert.

 

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

";

$message = "$firstname $lastname

$address

$address2

$city

$state

$zip

$phone

$email

$product

$serial

$gold

$goldaccount

$reason

$rmanumber";

 

 

// Send email to support

mail("[EMAIL PROTECTED]", "RMA Request", $message, $header);

?>

http://www.w3.org/1999/xhtml";>



Untitled Document





RMA Request Sent

Your RMA Number is

Please include a note within your package with your shipping address,
phone number and discription of the problem.When shipping Smart Parts
reccomends insuring your package for the full replacment cost. 

We also advise purchasing tracking services if using the postal
service.

Ship your return to: 

Smart Parts, Inc

ATTN 

Loyanhanna Business Complex

100 Station St.

Loyalhanna Pa. 15661



  Please allow up to one week for package delivery.

For status information please call 800-992-2147 and ask for the returns
department.

Click Here to print this page

Click here to return to RMA Request form





 



RE: [PHP-DB] SQL Insert problem

2004-08-05 Thread Hutchins, Richard
You're missing address2 in your list of values. This means that you have an
unmatching number of column names and values in your query and that'll make
the query bomb.

Rich


> -Original Message-
> From: Vincent Jordan [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 05, 2004 10:25 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] SQL Insert problem
> 
> 
> Im having a problem inserting data. Ive looked over this 
> again and again and
> can not find what ive missed. Everything else works besides 
> the db insert.
> 
>  
> 
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> 
>  
> ini_set ('display_errors', 1);
> 
> error_reporting (E_ALL & ~E_NOTICE);
> 
> // Define 
> 
> $firstname = $_POST['firstname'];
> 
>  
> 
> $lastname = $_POST['lastname'];
> 
>  
> 
> $address = $_POST['address'];
> 
>  
> 
> $address2 = $_POST['address2'];
> 
>  
> 
> $city = $_POST['city'];
> 
>  
> 
> $state = $_POST['state'];
> 
>  
> 
> $zip = $_POST['zip'];
> 
>  
> 
> $phone = $_POST['phone'];
> 
>  
> 
> $email = $_POST['email'];
> 
>  
> 
> $serial = $_POST['serial'];
> 
>  
> 
> $product = $_POST['product'];
> 
>  
> 
> $reason = $_POST['reason'];
> 
>  
> 
> $gold = $_POST['gold_button_y'];
> 
>  
> 
> $goldaccount = $_POST['goldaccount'];
> 
>  
> 
> $rmanumber = $lastname{0}.date("ndyGi");
> 
>  
> 
> $connect = mysql_connect("SERVER ", "USER", "PASSWORD") or die
> (mysql_error());
> 
> $select = mysql_select_db ("spdata") or die (mysql_error());
> 
> $sql = "INSERT INTO rmarequest (firstname, lastname, address, 
> address2,
> city, state, zip, phone, email, serial, product, reason, 
> rmanumber)VALUES
> ('$firstname', '$lastname', '$address', '$city', '$state', 
> '$zip', '$phone',
> '$email', '$serial', '$product', '$reason', '$rmanumber') or die
> (mysql_error())";
> 
> if (isset($_POST['submit'])) {
> 
> $sql;
> 
> }
> 
> // Send  and put in email message
> 
> $htmlheader = "Content-Type: text/html; charset=us-ascii\n";
> 
> $htmlheader .= "Content-Transfer-Encoding: 7bit";
> 
> $header = $from; // set the from field in the header
> 
> $header .= "\n"; // add a line feed
> 
> $header .= "MIME-version: 1.0\n"; //add the mime-version header
> 
> $header .= $htmlheader."\n";
> 
> $from = "From: RMA Request <[EMAIL PROTECTED]>";
> 
> $message = "$firstname $lastname
> 
> $address
> 
> $address2
> 
> $city
> 
> $state
> 
> $zip
> 
> $phone
> 
> $email
> 
> $product
> 
> $serial
> 
> $gold
> 
> $goldaccount
> 
> $reason
> 
> $rmanumber";
> 
>  
> 
>  
> 
> // Send email to support
> 
> mail("[EMAIL PROTECTED]", "RMA Request", $message, $header);
> 
> ?>
> 
> http://www.w3.org/1999/xhtml";>
> 
> 
> 
> Untitled Document
> 
> 
> 
> 
> 
> RMA Request Sent
> 
> Your RMA Number is
> 
> Please include a note within your package with your 
> shipping address,
> phone number and discription of the problem.When 
> shipping Smart Parts
> reccomends insuring your package for the full replacment cost. 
> 
> We also advise purchasing tracking services if using the postal
> service.
> 
> Ship your return to: 
> 
> Smart Parts, Inc
> 
> ATTN 
> 
> Loyanhanna Business Complex
> 
> 100 Station St.
> 
> Loyalhanna Pa. 15661
> 
> 
> 
>   Please allow up to one week for package delivery.
> 
> For status information please call 800-992-2147 and ask 
> for the returns
> department.
> 
> Click Here to print 
> this page />
> 
> Click here to return to RMA Request form
> 
> 
> 
> 
> 
>  
> 
> 

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