Update MySQL row using URL link?

2004-08-16 Thread Bob Afifi
I currently update MySQL rows using phpMyAdmin.
For example, dropping the following into the
phpMyAdmin GUI:

UPDATE mysql_db SET publish = 1 WHERE Date =
'Sunday, August 15, 2004 21:04:32'

Since I get the update info in an e-mail send
whenever the form is submitted, I'd like to turn
querys like the above encoded into a URL -
bypassing phpMyAdmin - which when clicked, will
update the row.

I found this article last night: Make SQL
Queries over HTTP with XML with VS.NET 
(http://www.aspfree.com/c/a/ASP/Make-SQL-Queries-over-HTTP-with-XML-with-VSNET/
)

SELECT CustomerId, CompanyName FROM Customer

http://localhost/sql?sql=select%20CustomerId,%20CompanyName%20from%20Customers%20FOR%20XML%20AUTO

=

The above looks very much like what I have in
mind, but for MySQL.  Anybody know how to do
this?

Many thanks in advance,

-Bob

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Email link from Perl script to update MySQL?

2004-03-08 Thread Bob Afifi
I'd like to modify the email send I presently get
from the Perl script when a new record is
submitted from the form to contain an email link
which if I click on it, will update MySQL.
Anybody know how that might best be done and if
so, can you please advise?

Many thanks in advance,

-Bob 


__
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Modifying Perl script to write to MySQL?

2004-02-13 Thread Bob Afifi
The Perl script I use is currently writing the
form results ($guestbookreal) to an html page
(http://usedflutes.com/new_listings_publish.html):

For example,

INSERT INTO `mysql_db` (`Title`, `Email`, `City`,
`State`, `Country`, `URL`, `Date`, `Description`,
`rid`, `dt_create`, `publish` ) VALUES ('Test',
'[EMAIL PROTECTED]', 'Sebastopol', 'Ca', 'USA ',
'http://bobafifi.com', 'Friday, February 13, 2004
', 'Test', '', 'NOW()', 0)

Can somebody please tell me how I need to change
the following code so that it will write the
results directly to MySQL instead??

$guestbookreal =
/home/flute/usedflutes-www/new_listings_publish.html;

Many thanks in advance,

-Bob




__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Modifying Perl script to write to MySQL?

2004-02-13 Thread Bob Afifi
Wow! Thanks Rhino.

Yes, I already have http://www.usedflutes.com 
running on MySQL (the INSERT statements I just
post manually using phpMyAdmin and they load fine
that way).  However, I'd like to bypass the copy
 paste step for entering ads and if possible,
have them go/execute directly into mysql instead
by modifying the current html send of the script.



Thanks again

-Bob

--- Rhino [EMAIL PROTECTED] wrote:
 Bob,
 
 I assume that you want to put the data from
 your Insert statement into a
 MySQL table, as opposed to inserting the text
 of your Insert statement into
 a table.
 
 If I am right, then you'll need to do a few
 things:
 a) Create a database using the Create Database
 statement.
 b) Define a table that has the appropriate
 columns and datatypes. You
 already know what your columns need to be -
 Title, Email, City, etc. - but
 you need to choose an appropriate datatype and
 size for each of these
 columns. Use the Create Table statement to
 create the empty table.
 c) Write the Perl code to insert your data into
 the table. I'm not at all
 clear on how you propose to get the data. I'm
 guessing that you will present
 your users with an HTML input form and let them
 fill in each of the values
 for the row that you will create. If that is
 the case, your Perl code will
 have to display a form with input fields and
 those fields will have to be
 big enough for the largest value that you will
 put in the column. For
 example, if the CITY can never be more than 20
 characters long, you'll need
 your input field to be 20 characters long as
 well. Your Perl code should
 also validate the user's input. For example, if
 someone leaves the CITY
 blank or puts a phone number in that field,
 your code should detect that and
 display an error message to the user telling
 them what's wrong and asking
 them to try again. When the data is all valid,
 you need to insert the data
 into the table.
 
 I haven't done very much Perl and what I did do
 was 5 years ago. However,
 this short example should get you going in the
 right direction. It assumes
 that a table already exists and has this
 definition:
 create table mytab
 (id smallint not null,
  name char(10) not null,
  primary key(id))
 


 
 #!/usr/local/bin/perl
 
 ###
 # This example demonstrates:
 # - making a connection
 # - setting the DBI debug level
 # - inserting a row of data
 # - disconnecting
 ###
 
  use DBI;
  use DBD::DB2::Constants;
 
  $DBI::dbi_debug=3; # increase the debug output
 
 # Attempt to connect to the database.
  $dbh =
 DBI-connect(dbi:DB2:sample,logonID,passwd,
{RaiseError=0,AutoCommit=0});
 
 # Commit so that rows can be added.
  $dbh-commit();
 
 # Populate the table.
  $insert = insert into mytab values
 (1000, 'Fred'),
 (2000, 'Barney');
  $sqlerrd3 = $dbh-do($insert);
  print Inserted , $sqlerrd3,  rows\n;
 
 # Display the table contents.
  display;
 
 # Commit.
 $dbh-commit();
 
 # Reset the connection i.e. disconnect.
 $dbh-disconnect();
 
  exit;
 
 sub display {
 # Specify the info we want.
 $stmt1 = select id, name
from mytab
order by id;
 
 # Prepare the statement.
  $sth = $dbh-prepare($stmt1);
 
 # Execute the statement.
  $sth-execute();
 
 # Loop through the result set, parsing each
 value into its own field.
  while ( ( $id, $name ) = $sth-fetchrow() ) {
   print   ID: $id\tName: $name\n;
   }
 
 # Close the result set to free up resources.
  $sth-finish();
 }
 


 
 
 Rhino
 
 
 - Original Message - 
 From: Bob Afifi [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, February 13, 2004 8:00 PM
 Subject: Modifying Perl script to write to
 MySQL?
 
 
  The Perl script I use is currently writing
 the
  form results ($guestbookreal) to an html page
 

(http://usedflutes.com/new_listings_publish.html):
 
  For example,
 
  INSERT INTO `mysql_db` (`Title`, `Email`,
 `City`,
  `State`, `Country`, `URL`, `Date`,
 `Description`,
  `rid`, `dt_create`, `publish` ) VALUES
 ('Test',
  '[EMAIL PROTECTED]', 'Sebastopol', 'Ca',
 'USA ',
  'http://bobafifi.com', 'Friday, February 13,
 2004
  ', 'Test', '', 'NOW()', 0)
 
  Can somebody please tell me how I need to
 change
  the following code so that it will write the
  results directly to MySQL instead??
 
  $guestbookreal =
 

/home/flute/usedflutes-www/new_listings_publish.html;
 
  Many thanks in advance,
 
  -Bob
 
 
 
 
  __
  Do you Yahoo!?
  Yahoo! Finance: Get your refund fast by
 filing online.
  http://taxes.yahoo.com/filing.html
 
  -- 
  MySQL General Mailing List
  For list archives:
 http://lists.mysql.com/mysql
  To unsubscribe:   

http://lists.mysql.com/[EMAIL PROTECTED]
 
 


__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing

Re: Modifying Perl script to write to MySQL?

2004-02-13 Thread Bob Afifi
Just to clarify a bit more (perhaps...), I
already have: 

#!/usr/bin/perl
use DBI;

=
and 
=

$dbh = DBI-connect
(DBI:mysql:host=localhost;database=my_db,
 my_id, my_password,
 {PrintError = 0, RaiseError = 1});

=

preceding the

$guestbookreal =
/home/flute/usedflutes-www/new_listings_publish.html;

part of the script.  Since the script is already
generating an INSERT statement (at least one I
can copy  paste the results into the
phpMyAdmin interface) that works, I'm wondering
how (or if) it's possible to change the
/home/flute/usedflutes-www/new_listings_publish.html;

part of the code so that the INSERT statement
will execute instead? 

Thanks again,

-Bob


__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Adding NOW() to existing INSERT statement?

2004-02-10 Thread Bob Afifi
I'm trying to get a fixed entry date using two
DATETIME fields (dt_update, dt_create). 
The first DATETIME field (dt_update)
automatically updates each time the record is 
modified, the second DATETIME field (dt_create)
doesn't. 

I've been able to get it using this: 

INSERT INTO `test` SET dt_create = NOW() 

However, what I really need is to have the above
INSERT statement (or something that 
does the same thing) integrated into another
INSERT statement which looks 
something like this: 

INSERT INTO `test` (`Title`, `Email`, `City`,
`State`, `Country`, `URL`, `Date`, 
`Description`, `rid`) VALUES ('Widget',
'[EMAIL PROTECTED]', 'Glendale', 'CA', 'USA ', 
'http://www.widget.com', 'Tuesday, February 10,
2004 ', 'Widgets for sale', '') 

Anybody know how to do this? 

Many thanks in advance, 

-Bob 



__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Adding NOW() to existing INSERT statement?

2004-02-10 Thread Bob Afifi
Never mind!

I figured it out :-)

Thanks, 

-Bob

__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]