php-windows Digest 26 Nov 2003 04:53:26 -0000 Issue 2016
Topics (messages 22185 through 22195):
Re: insert syntax
22185 by: Svensson, B.A.T. (HKG)
22186 by: Andrei BEJENARU
22189 by: Svensson, B.A.T. (HKG)
Re: Sending Mail with PHP.
22187 by: Roderick Martin
Encryption Decryption Help Needed
22188 by: Herhuth, Ron
22191 by: Eric COLINET
Re: Online Polls
22190 by: Nik
22192 by: Robin Stoker
Selecting date/time from an Access database
22193 by: Metin Kale
I Got It.
22194 by: Nik
Internet
22195 by: Rinku Shivnani
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
insert into <target table> [(<column name>, ...)]
select <[*] | [(<column name> [as <column alias>], ...)]>
from <source table>
[where <condtions list>]
-----Original Message-----
From: Rinku Shivnani
To: [EMAIL PROTECTED]
Sent: 2003-11-25 12:57
Subject: [PHP-WIN] insert syntax
Dear All,
I want to insert data from one table to another one. But I don't
remember the syntax properly. Can you pls help me ?
Insert into tablename2 as select * from tablename1
Thank you.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,
In MySQL it's INSERT INTO table2 SELECT * FROM table1
Regards,
Andrei
"Rinku Shivnani" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Dear All,
>
> I want to insert data from one table to another one. But I don't
> remember the syntax properly. Can you pls help me ?
>
> Insert into tablename2 as select * from tablename1
>
>
> Thank you.
--- End Message ---
--- Begin Message ---
As well as ingres, postgres, Oracle, SQLServer, etc syntax.
It is rather ISO-SQL 92 syntax than a specific RDBMS syntax.
Just for the record....
-----Original Message-----
From: Andrei BEJENARU
To: [EMAIL PROTECTED]
Sent: 2003-11-25 15:30
Subject: [PHP-WIN] Re: insert syntax
Hi,
In MySQL it's INSERT INTO table2 SELECT * FROM table1
Regards,
Andrei
"Rinku Shivnani" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Dear All,
>
> I want to insert data from one table to another one. But I don't
> remember the syntax properly. Can you pls help me ?
>
> Insert into tablename2 as select * from tablename1
>
>
> Thank you.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Can anyone tell me how to configure the SMTP server in the .ini file?
For instance, does it take an IP address, or what? We are running
WindowsNT 4 and our SMTP line is set to 'localhost' which I am almost
sure is incorrect.
Any help would be great!
Thanks!
On Aug 31, 2003, at 10:53 PM, Manuel Lemos wrote:
Hello,
On 08/31/2003 03:26 PM, [EMAIL PROTECTED] wrote:
Hi all, I've been using PHP over the last year now, and have become
quite capable with the language, but, there is one function/feature
that I have yet to try/use, and that is the mail() function.
I am gonna start to learn it to night, but was wondering if there was
any adjustments that were needed within the php.ini file before I
actually start writing up the code.
The function seems staright forward enough to execute, but are there
any other things i should know that is required to send email via PHP
scripts.
I am using AOL to send and recieve emails.
You need to configure the SMTP server and the sendmail_from address in
the php.ini file. If your SMTP server requires authentication you may
get errors and it does not deliver messages.
The mail() function is mostly to send simple messages. To send more
complex messages (HTML, images, attachments, etc..) you may want to
try this class that makes your task easier and compliant with the
e-mail standards. The class also comes with a sub-class specialized in
deliverying via SMTP with authentication support if necessary:
http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I have a situation where users will be entering their credit card number
then the number will be stored in the MicroSoft SQLdatabase. I already
have SSL in place but what I would like to do is to encrypt the number in
the database to help my CIO sleep at night. We have constructed a report
to get retrieve the stored information that is locked down hard using IP
address validation and several other IIS security methods...but I will
need to have the credit card number decrypted in this report.
Can anyone point me to a method to encrypt the Credit card number on
insertion into the database, and then decryption when reporting? I have
MCrypt installed and functioning correctly on my server, I just can't find
any simple tutorials on how to do this.
Thanks,
Ron
--- End Message ---
--- Begin Message ---
Hi,
The only way i see to accomplish that is to use public key encryption.
for example:
- retrieve credit card id
- encrypt it with the administrator public key
- when the administrator need to do a report he can give the
secret key or the password of it (if it is stored on the server)
- you can then decrypt the card id with the private key
This way your encryption key does not reside on the server (in the code)
and you can have really strong encryption.
Look at the OpenSSL PHP extension, it could help.
Eric
At 17:41 25/11/2003, Herhuth, Ron wrote:
I have a situation where users will be entering their credit card number
then the number will be stored in the MicroSoft SQLdatabase. I already
have SSL in place but what I would like to do is to encrypt the number in
the database to help my CIO sleep at night. We have constructed a report
to get retrieve the stored information that is locked down hard using IP
address validation and several other IIS security methods...but I will
need to have the credit card number decrypted in this report.
Can anyone point me to a method to encrypt the Credit card number on
insertion into the database, and then decryption when reporting? I have
MCrypt installed and functioning correctly on my server, I just can't find
any simple tutorials on how to do this.
Thanks,
Ron
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I understand what you did and how you did it. However, the values within the
variables on the vote.php page are not being passed to regvote.php page. I
know this because I tried testing it. Below is just one of the examples that
i used to test it.
<?PHP
//Register User Vote - regvote.php
include 'config.inc.php';
include 'dbconnect.inc.php';
$test = $_POST['poll_id'];
echo $test;
?>
"Robin Stoker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Hey Nik
>
> Try this little piece of code (I've put in a few tips to help you with
> your website coding):
>
> ========================================================================
> =====================================
> // config.inc.php
> // here you can put website config options
> // such as database config details
> // this file, as well as the dbconnect.inc.php file, will be "included"
> in the rest of the scripts
> // by doing it this way, if any of your database connection details
> change, then you only have to
> // change them in one place, the config.inc.php file, instead of
> changing every single one of your scripts!
>
> <?php
>
> $db_host = 'localhost';
> $db_user = 'freaknik';
> $db_password = '';
> $db = 'survey';
>
> ?>
>
> // end config.inc.php
> ========================================================================
> =====================================
>
>
> // dbconnect.inc.php
> // this script will connect to the db
>
> <?
>
> $db_srv_conn = mysql_pconnect($dbhost,$db_user,$db_password)
> or die("Could not connect to the server");
>
> $db_conn = mysql_select_db($db,$db_srv_conn)
> or die("Could not connect to the database");
>
> ?>
>
> // end dbconnect.inc.php
> ========================================================================
> =====================================
>
> // vote.php
> // this is the form used for voting
> <?php
>
> include 'config.inc.php';
> include 'dbconnect.inc.php';
>
> $getpollquery = "SELECT * FROM poll ORDER BY date DESC"; // THIS WILL
> GET THE LATEST POLL FROM THE DATABASE
> $getpollquery_handle = mysql_query($getpollquery);
> $getpollquery_result = mysql_fetch_row($getpollquery_handle)
>
> ?>
>
> <form method="POST" action="regvote.php">
> <p>
> <?php echo $getpollquery_result[1]; ?></p>
> <p><input type="radio" name="R1" value="response1" checked><?php echo
> $getpollquery_result[2]; ?></p>
> <p><input type="radio" name="R1" value="response2"><?php echo
> $getpollquery_result[3]; ?></p>
> <p><input type="radio" name="R1" value="response3"><?php echo
> $getpollquery_result[4]; ?></p>
> <input type="hidden" name="poll_id" value="<?php echo
> $getpollquery_result[0]; ?>">
> <p><input type="submit" value="Submit" name="submit"></p>
> </form>
>
> // end vote.php
> ========================================================================
> =====================================
>
> // regvote.php
> // this is to process the form and insert data into the database
>
> <?php
>
> include 'config.inc.php';
> include 'dbconnect.inc.php';
>
> if (array_key_exists("R1", $_POST)) {
>
> switch ($_POST['R1']) { // check which option
> was selected and create sql query
> case "response1":
>
> $updatequery = "UPDATE poll SET votes1 WHERE
> id=".$_POST['poll_id'];
>
> case "response2":
>
> $updatequery = "UPDATE poll SET votes2 WHERE
> id=".$_POST['poll_id'];
>
> case "response3":
>
> $updatequery = "UPDATE poll SET votes3 WHERE
> id=".$_POST['poll_id'];
>
> }
>
> }
>
> if (mysql_query($updatequery)) {
>
> print "Thank-you, your vote was added successfully.";
>
> }
> else {
>
> print "Sorry, could not add your vote.";
>
> }
> ?>
>
> // end regvote.php
> ========================================================================
> =====================================
>
> Hope it works ... didn't have time to test it
>
> Good Luck :)
> - Robin
>
>
>
> -----Original Message-----
> From: Nik [mailto:[EMAIL PROTECTED]
> Sent: 23 November 2003 11:19 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Online Polls
>
> OK! now I am attempting to develop a small online polling system. I set
> up
> my tables and html pages. However, I don't seem to understand how to
> update
> the information in the polling system. I know how to update using sql
> but
> something about this polling system I don't understand. This is my code
> below.
> My Table Structure
> CREATE TABLE poll (
>
> id int(10) unsigned NOT NULL auto_increment, //id of the question
>
> question varchar(255) NOT NULL, //question
>
> response1 varchar(255) NOT NULL, //the first possible answer
>
> response2 varchar(255) NOT NULL, //the second possible answer
>
> response3 varchar(255) NOT NULL, //the third possible answer
>
> votes1 int(10) unsigned DEFAULT '0' NOT NULL, // It is these three
> I am having a problem
>
> votes2 int(10) unsigned DEFAULT '0' NOT NULL, // putting the data
> into when the user clicks the form
>
> votes3 int(10) unsigned DEFAULT '0' NOT NULL, // to post their
> choice.
>
> date date DEFAULT '0000-00-00' NOT NULL, //date of the poll
>
> PRIMARY KEY (id)
>
> );
>
>
> *********** start of code ****************
>
> $db_host = 'localhost';
> $db_user = 'freaknik';
> $db_password = '';
> $db = 'survey';
>
> $db_srv_conn = mysql_pconnect($dbhost,$db_user,$db_password)
> or die("Could not connect to the server");
>
> $db_conn = mysql_select_db($db,$db_srv_conn)
> or die("Could not connect to the database");
>
> //Vote.php
>
> $submit = $_POST['submit'];
> $response = $_POST['response'];
> if (!$submit)
> {
> echo "kindly click submit";
>
> }
> else
> {
> echo "u're gett there nik<br>";
> $query = mysql_query("UPDATE survey SET vote=$vote+1 WHERE
> response=$response"); //I don't quite understand how to get the correct
> response to go into the correct field.
>
> if (!$query)
> {
> echo "Unable to cast vote";
> }
> else
> {
> echo "Thank you for voting";
> }
>
>
> }
>
>
> ?>
>
> *********** end of code *****************
> Thanks in advance
> Nik
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hey Nik
This is very strange, and the only thing I can think of is that it may
be your php config. I assume you are using php 4.2.3 or higher? and the
only time I ever had problems with posting values was with the
register_globals option in the php.ini file.
I don't know if you know anything about this but when I was having
problems, I simply enabled this option and everything came together. I
know they say that it is a security risk, however, if you refer to
posted values using the $_POST variable, you should be o.k
Hope this helps
- Robin
-----Original Message-----
From: Nik [mailto:[EMAIL PROTECTED]
Sent: 25 November 2003 07:41 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] Online Polls
I understand what you did and how you did it. However, the values within
the
variables on the vote.php page are not being passed to regvote.php page.
I
know this because I tried testing it. Below is just one of the examples
that
i used to test it.
<?PHP
//Register User Vote - regvote.php
include 'config.inc.php';
include 'dbconnect.inc.php';
$test = $_POST['poll_id'];
echo $test;
?>
"Robin Stoker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Hey Nik
>
> Try this little piece of code (I've put in a few tips to help you with
> your website coding):
>
>
========================================================================
> =====================================
> // config.inc.php
> // here you can put website config options
> // such as database config details
> // this file, as well as the dbconnect.inc.php file, will be
"included"
> in the rest of the scripts
> // by doing it this way, if any of your database connection details
> change, then you only have to
> // change them in one place, the config.inc.php file, instead of
> changing every single one of your scripts!
>
> <?php
>
> $db_host = 'localhost';
> $db_user = 'freaknik';
> $db_password = '';
> $db = 'survey';
>
> ?>
>
> // end config.inc.php
>
========================================================================
> =====================================
>
>
> // dbconnect.inc.php
> // this script will connect to the db
>
> <?
>
> $db_srv_conn = mysql_pconnect($dbhost,$db_user,$db_password)
> or die("Could not connect to the server");
>
> $db_conn = mysql_select_db($db,$db_srv_conn)
> or die("Could not connect to the database");
>
> ?>
>
> // end dbconnect.inc.php
>
========================================================================
> =====================================
>
> // vote.php
> // this is the form used for voting
> <?php
>
> include 'config.inc.php';
> include 'dbconnect.inc.php';
>
> $getpollquery = "SELECT * FROM poll ORDER BY date DESC"; // THIS WILL
> GET THE LATEST POLL FROM THE DATABASE
> $getpollquery_handle = mysql_query($getpollquery);
> $getpollquery_result = mysql_fetch_row($getpollquery_handle)
>
> ?>
>
> <form method="POST" action="regvote.php">
> <p>
> <?php echo $getpollquery_result[1]; ?></p>
> <p><input type="radio" name="R1" value="response1" checked><?php
echo
> $getpollquery_result[2]; ?></p>
> <p><input type="radio" name="R1" value="response2"><?php echo
> $getpollquery_result[3]; ?></p>
> <p><input type="radio" name="R1" value="response3"><?php echo
> $getpollquery_result[4]; ?></p>
> <input type="hidden" name="poll_id" value="<?php echo
> $getpollquery_result[0]; ?>">
> <p><input type="submit" value="Submit" name="submit"></p>
> </form>
>
> // end vote.php
>
========================================================================
> =====================================
>
> // regvote.php
> // this is to process the form and insert data into the database
>
> <?php
>
> include 'config.inc.php';
> include 'dbconnect.inc.php';
>
> if (array_key_exists("R1", $_POST)) {
>
> switch ($_POST['R1']) { // check which option
> was selected and create sql query
> case "response1":
>
> $updatequery = "UPDATE poll SET votes1 WHERE
> id=".$_POST['poll_id'];
>
> case "response2":
>
> $updatequery = "UPDATE poll SET votes2 WHERE
> id=".$_POST['poll_id'];
>
> case "response3":
>
> $updatequery = "UPDATE poll SET votes3 WHERE
> id=".$_POST['poll_id'];
>
> }
>
> }
>
> if (mysql_query($updatequery)) {
>
> print "Thank-you, your vote was added successfully.";
>
> }
> else {
>
> print "Sorry, could not add your vote.";
>
> }
> ?>
>
> // end regvote.php
>
========================================================================
> =====================================
>
> Hope it works ... didn't have time to test it
>
> Good Luck :)
> - Robin
--- End Message ---
--- Begin Message ---
Hello all..
I've been tasked to retrieve info from an Access database and I've been
successful in selecting data and displaying it. But I do have a problem
with DATE/TIME data. When I run a query asking for "TIME" data, I get the
value "-1" returned.
<?
$conn = new COM("ADODB.Connection") or die("lala");
$dsn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=FILENAME.mdb";
$conn->Open($dsn);
$rset=new COM("ADODB.Recordset");
$rs=new COM("ADODB.Command");
$rs->Activeconnection=$conn;
$rs->CommandText="SELECT tblBooking.ReservationID, tblBooking.DateBooking,
tblRoom.Room, tblBooking.TimeeventStart, tblBooking.TimeBookingEnd
FROM tblRoom INNER JOIN tblBooking ON tblRoom.ID = tblBooking.RoomID ORDER
BY tblbooking.reservationid ASC";
$rset=$rs->Execute;
$e= $rset->Fields(4);
$d= $rset->Fields(3);
$c= $rset->Fields(2);
$b= $rset->Fields(1);
$a= $rset->Fields(0);
?>
Results:
$a: 6391
$b: 954568800
$b(formatted from the timestamp above): 4/1/2000
$c: 2D (Minnesota)
$d: -1
$e: -1
$a is the reservation ID
$b is the timestamp
$c is the room name
$d is the start time
$e is the end time
As you can see, both $d and $e are not the correct values. I opened the
Access database and checked the data and it returned the correct
time. I've never had this kind of problems with MySQL, but I have to use
Access in this instance. Has anyone seen this before?
MORE INFO:
PHP Version 4.0.6
Access 97
Thanks,
metin
--- End Message ---
--- Begin Message ---
Thanks a million for the help. I did not change the php.ini file, what I did
wuz rework your code so that I got a clearer understanding. So not only did
I learn, but I manage to solve my problem. Once again. Thank you
Nik
"Robin Stoker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Hey Nik
>
> This is very strange, and the only thing I can think of is that it may
> be your php config. I assume you are using php 4.2.3 or higher? and the
> only time I ever had problems with posting values was with the
> register_globals option in the php.ini file.
>
> I don't know if you know anything about this but when I was having
> problems, I simply enabled this option and everything came together. I
> know they say that it is a security risk, however, if you refer to
> posted values using the $_POST variable, you should be o.k
>
> Hope this helps
> - Robin
>
> -----Original Message-----
> From: Nik [mailto:[EMAIL PROTECTED]
> Sent: 25 November 2003 07:41 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-WIN] Online Polls
>
> I understand what you did and how you did it. However, the values within
> the
> variables on the vote.php page are not being passed to regvote.php page.
> I
> know this because I tried testing it. Below is just one of the examples
> that
> i used to test it.
>
> <?PHP
> //Register User Vote - regvote.php
>
> include 'config.inc.php';
> include 'dbconnect.inc.php';
>
> $test = $_POST['poll_id'];
> echo $test;
> ?>
>
>
> "Robin Stoker" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >
> > Hey Nik
> >
> > Try this little piece of code (I've put in a few tips to help you with
> > your website coding):
> >
> >
> ========================================================================
> > =====================================
> > // config.inc.php
> > // here you can put website config options
> > // such as database config details
> > // this file, as well as the dbconnect.inc.php file, will be
> "included"
> > in the rest of the scripts
> > // by doing it this way, if any of your database connection details
> > change, then you only have to
> > // change them in one place, the config.inc.php file, instead of
> > changing every single one of your scripts!
> >
> > <?php
> >
> > $db_host = 'localhost';
> > $db_user = 'freaknik';
> > $db_password = '';
> > $db = 'survey';
> >
> > ?>
> >
> > // end config.inc.php
> >
> ========================================================================
> > =====================================
> >
> >
> > // dbconnect.inc.php
> > // this script will connect to the db
> >
> > <?
> >
> > $db_srv_conn = mysql_pconnect($dbhost,$db_user,$db_password)
> > or die("Could not connect to the server");
> >
> > $db_conn = mysql_select_db($db,$db_srv_conn)
> > or die("Could not connect to the database");
> >
> > ?>
> >
> > // end dbconnect.inc.php
> >
> ========================================================================
> > =====================================
> >
> > // vote.php
> > // this is the form used for voting
> > <?php
> >
> > include 'config.inc.php';
> > include 'dbconnect.inc.php';
> >
> > $getpollquery = "SELECT * FROM poll ORDER BY date DESC"; // THIS WILL
> > GET THE LATEST POLL FROM THE DATABASE
> > $getpollquery_handle = mysql_query($getpollquery);
> > $getpollquery_result = mysql_fetch_row($getpollquery_handle)
> >
> > ?>
> >
> > <form method="POST" action="regvote.php">
> > <p>
> > <?php echo $getpollquery_result[1]; ?></p>
> > <p><input type="radio" name="R1" value="response1" checked><?php
> echo
> > $getpollquery_result[2]; ?></p>
> > <p><input type="radio" name="R1" value="response2"><?php echo
> > $getpollquery_result[3]; ?></p>
> > <p><input type="radio" name="R1" value="response3"><?php echo
> > $getpollquery_result[4]; ?></p>
> > <input type="hidden" name="poll_id" value="<?php echo
> > $getpollquery_result[0]; ?>">
> > <p><input type="submit" value="Submit" name="submit"></p>
> > </form>
> >
> > // end vote.php
> >
> ========================================================================
> > =====================================
> >
> > // regvote.php
> > // this is to process the form and insert data into the database
> >
> > <?php
> >
> > include 'config.inc.php';
> > include 'dbconnect.inc.php';
> >
> > if (array_key_exists("R1", $_POST)) {
> >
> > switch ($_POST['R1']) { // check which option
> > was selected and create sql query
> > case "response1":
> >
> > $updatequery = "UPDATE poll SET votes1 WHERE
> > id=".$_POST['poll_id'];
> >
> > case "response2":
> >
> > $updatequery = "UPDATE poll SET votes2 WHERE
> > id=".$_POST['poll_id'];
> >
> > case "response3":
> >
> > $updatequery = "UPDATE poll SET votes3 WHERE
> > id=".$_POST['poll_id'];
> >
> > }
> >
> > }
> >
> > if (mysql_query($updatequery)) {
> >
> > print "Thank-you, your vote was added successfully.";
> >
> > }
> > else {
> >
> > print "Sorry, could not add your vote.";
> >
> > }
> > ?>
> >
> > // end regvote.php
> >
> ========================================================================
> > =====================================
> >
> > Hope it works ... didn't have time to test it
> >
> > Good Luck :)
> > - Robin
--- End Message ---
--- Begin Message ---
Dear all,
Pls guide me the best Internet Connectivity which can be cheapest
and fastest one.
I know this is neither php nor windows based question, But I am
asking you because you all might be using Internet For a lot of time
in a day. So you can suggest me the best possible way.
--- End Message ---