php-windows Digest 1 Mar 2005 18:53:36 -0000 Issue 2595
Topics (messages 25691 through 25697):
Re: [PHP] Not able to add data to a MySQL database
25691 by: Armando
Re: Validation of Primary Key Datetime variable
25692 by: graeme
problem with mail() and attachment
25693 by: Stefan Sturm
25694 by: Stefan Sturm
Error 500 in IIS weblog
25695 by: Menashe
problem with mail
25696 by: Stefan Sturm
Re: mysql 4.1 php 5.0.52 apache 2 mysql_connect()
25697 by: BrAiNs
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 ---
Try removing the apostrophes around the field names that you are trying
to insert data into:
$query="insert into login (uname,access) values('try','super')";
Armando
Richard Lynch wrote:
Vaibhav Sibal wrote:
Hi,
I am not able to insert data into my mysql database using php even if
i use a simple code as follows :
<?php
$link=mysql_connect("localhost","username","password");
mysql_select_db("test_db");
$query="INSERT INTO 'login' ('uname','access') VALUES ('try','super')";
mysql_query($query,$link);
?>
ADD SOME ERROR CHECKING!!!
http://php.net/die
--- End Message ---
--- Begin Message ---
To reiterate what others have said avoid user input as your primary key,
an auto increment would be better.
But to get back to your validation problem, you might want to look up
the strtotime() function
graeme.
S.D.Price wrote:
Thanks for this George. I am populating the datetime field from user
input, and users can change the date if they need to.
The problem I have is with validation. I think I will need to use some
kind of regular expression to check that the date has been entered in
the correct format, but I am not sure what.
Steven
-----Original Message-----
From: George Pitcher [mailto:[EMAIL PROTECTED]
Sent: 28 February 2005 13:31
To: S.D.Price
Subject: RE: [PHP-WIN] Validation of Primary Key Datetime variable
Simon,
Why not use a varchar datatype and populate it yourself. It can then be
modified, but the data can still be displayed in the way you want, by
being a bit more creative with the code.
I don't store dates as date datatype but as integers, that way I could,
if required, move my code to a different db with no extra work.
George
-----Original Message-----
From: S.D.Price [mailto:[EMAIL PROTECTED]
Sent: 28 February 2005 12:38 pm
To: php-windows
Subject: [PHP-WIN] Validation of Primary Key Datetime variable
Hi, I wonder if anyone can help.
I have designed a newsblog which uses PHP and MySQL. Each news story
has a primary key which is the current date. The datatype used in
MySQL is "datetime". When stories are extracted from the database the
user can then navigate based on date order.
When a user adds a news story to the database the current days date is
shown in the form using
<dt>
<label for="publish_date"><?php echo $publish_datelabel
?></label></dt> <dd><input type="text" name="publish_date"
id="publish_date" value="<?php echo date('Y-m-d H:i:s') ?>"/></dd>
This is the date added to the DB by default.
However, the user must be able to change the date so that they can set
a date sometime in the future when they want the story to be
published. The only stories shown in the archive (and pulled through
to the home
page) are those which are before or on today's date.
My problem is that I am not sure how to validate any changes made to
the $publish_date so that it will conform to the required datetime
range in MySQL and not give the useless answer 0000:00:00 00:00:00.
Does anyone know how to do this?
Thanks
Steven Price
--
Experience is a good teacher, but she sends in terrific bills.
Minna Antrim
--- End Message ---
--- Begin Message ---
Hi,
I'm using the script below to send ascii files attached to mails via mail().
I'm running the script on different servers and it works fine. Now I got a
problem on windows server 2003. The attachment of the mail is disturbed, the
first 76 characters are missing, the rest of the attachment is correct. When
I looked at the mail headers of the mail I recieved I recognized that there
were some lines missing. Also the first line of the attachment part in the
header is mssing. As I use chunk_split without the chunklen paramter the
lines are all 76 characters long. So it just looks like that the server
ommits lines in the header. I marked the missing lines in the script with
comments. Has anybody got an idea where the problem could be?
Thank in advance
Stefan
$unique_sep =md5(uniqid(time()))";
$headers = "From: egrade questionaire\n";
$headers .= "MIME-Version: 1.0\nContent-Type:
multipart/mixed;boundary=\"$unique_sep\";\n";
#The second \n at the end of the next command is ommited, the resulting
empty line is not in the header of the received mail
$headers .= "charset=\"iso-8859-1\"\nContent-Transfer-Encoding:7bit\n\n";
$headers .= "egrade-result\n";
$headers .= "If you read this text your mail server is not supporting MIME
Format.\n";
$headers .= "--$unique_sep\n";
$headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
#The second \n at the end of the next command is ommited, the resulting
empty line is not in the header of the received mail
$headers .= "Content-Transfer-Encoding: 7bit\n\n";
#From the next command only a single \n is in the header of the received
mail, the text and the other \n are missing
$headers .= "egrade-result\n\n";
$headers .= "--$unique_sep\n";
# filename holds the path to the ascii file
$headers .= "Content-Type: {text/plain}; name=\"{$filename}\"\n";
$headers .= "Content-Transfer-Encoding: base64\n";
$headers .= "Content-Disposition: attachment\n\n";
$filedata = implode(file($filename), '');
$headers .= chunk_split(base64_encode($filedata));
$headers .= "--$unique_sep--\n";
if(mail("[EMAIL PROTECTED]","subject","egrade-result",$headers) or die("An
error occured! The questionnaire has not been processed"));
--- End Message ---
--- Begin Message ---
Hi,
I'm using the script below to send ascii files attached to mails via mail().
I'm running the script on different servers and it works fine. Now I got a
problem on windows server 2003. The attachment of the mail is disturbed, the
first 76 characters are missing, the rest of the attachment is correct. When
I looked at the mail headers of the mail I recieved I recognized that there
were some lines missing. Also the first line of the attachment part in the
header is mssing. As I use chunk_split without the chunklen paramter the
lines are all 76 characters long. So it just looks like that the server
ommits lines in the header. I marked the missing lines in the script with
comments. Has anybody got an idea where the problem could be?
Thank in advance
Stefan
$unique_sep =md5(uniqid(time()))";
$headers = "From: egrade questionaire\n";
$headers .= "MIME-Version: 1.0\nContent-Type:
multipart/mixed;boundary=\"$unique_sep\";\n";
#The second \n at the end of the next command is ommited, the resulting
empty line is not in the header of the received mail
$headers .= "charset=\"iso-8859-1\"\nContent-Transfer-Encoding:7bit\n\n";
$headers .= "egrade-result\n";
$headers .= "If you read this text your mail server is not supporting MIME
Format.\n";
$headers .= "--$unique_sep\n";
$headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
#The second \n at the end of the next command is ommited, the resulting
empty line is not in the header of the received mail
$headers .= "Content-Transfer-Encoding: 7bit\n\n";
#From the next command only a single \n is in the header of the received
mail, the text and the other \n are missing
$headers .= "egrade-result\n\n";
$headers .= "--$unique_sep\n";
# filename holds the path to the ascii file
$headers .= "Content-Type: {text/plain}; name=\"{$filename}\"\n";
$headers .= "Content-Transfer-Encoding: base64\n";
$headers .= "Content-Disposition: attachment\n\n";
$filedata = implode(file($filename), '');
$headers .= chunk_split(base64_encode($filedata));
$headers .= "--$unique_sep--\n";
if(mail("[EMAIL PROTECTED]","subject","egrade-result",$headers) or die("An
error occured! The questionnaire has not been processed"));
--- End Message ---
--- Begin Message ---
Hi,
I'm running php 5.03 on windows 2003 as isapi.
Everything looks OK, and i can see all the php pages, but when I checked the
IIS log file
I saw that all the requests to php pages are with the error 500.
Does someone had this problem ?
How can i fix it, i tried to change all the parameters i know with no
success?
Thanks.
--- End Message ---
--- Begin Message ---
Hi,
I'm using the script below to send ascii files attached to mails via mail().
I'm running the script on different servers and it works fine. Now I got a
problem on windows server 2003. The attachment of the mail is disturbed, the
first 76 characters are missing, the rest of the attachment is correct. When
I looked at the mail headers of the mail I recieved I recognized that there
were some lines missing. Also the first line of the attachment part in the
header is mssing. As I use chunk_split without the chunklen paramter the
lines are all 76 characters long. So it just looks like that the server
ommits lines in the header. I marked the missing lines in the script with
comments. Has anybody got an idea where the problem could be?
Thank in advance
Stefan
$unique_sep =md5(uniqid(time()))";
$headers = "From: egrade questionaire\n";
$headers .= "MIME-Version: 1.0\nContent-Type:
multipart/mixed;boundary=\"$unique_sep\";\n";
#The second \n at the end of the next command is ommited, the resulting
empty line is not in the header of the received mail
$headers .= "charset=\"iso-8859-1\"\nContent-Transfer-Encoding:7bit\n\n";
$headers .= "egrade-result\n";
$headers .= "If you read this text your mail server is not supporting MIME
Format.\n";
$headers .= "--$unique_sep\n";
$headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
#The second \n at the end of the next command is ommited, the resulting
empty line is not in the header of the received mail
$headers .= "Content-Transfer-Encoding: 7bit\n\n";
#From the next command only a single \n is in the header of the received
mail, the text and the other \n are missing
$headers .= "egrade-result\n\n";
$headers .= "--$unique_sep\n";
# filename holds the path to the ascii file
$headers .= "Content-Type: {text/plain}; name=\"{$filename}\"\n";
$headers .= "Content-Transfer-Encoding: base64\n";
$headers .= "Content-Disposition: attachment\n\n";
$filedata = implode(file($filename), '');
$headers .= chunk_split(base64_encode($filedata));
$headers .= "--$unique_sep--\n";
if(mail("[EMAIL PROTECTED]","subject","egrade-result",$headers) or die("An
error occured! The questionnaire has not been processed"));
--- End Message ---
--- Begin Message ---
Hi
http://forums.mysql.com/read.php?11,6400,6701#msg-6701
MySQL 5.0.0
PHP 4.3.10
Regards
BrAiNs
http://ctek.ath.cx
"Karsten Scherer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi there!
i am getting mad while trying to get this stuff running.
on my system are:
Apache 2.0.52
PHP 5.0.3
Mysql 4.1
i progrqammed a script taken from "http://3dBUZZ.com" �s
"php & Mysql Training course".
as following:
##File temp_con.php stored in webroot:
<?php
require($_SERVER["DOCUMENT_ROOT"]."/config/db_config.php");
$connection = mysql_real_connect($db_host, $db_user, $db_password)or
die("fehler beim connecten");
echo "connection war erfolgreich";
?>
## end of file
and
##File "db_config.php" stored in c:\webroot\config
<?php
$db_host = "localhost";
$db_user = "karsten";
$db_password = "sharon";
$db_name = "buzz_db";
?>
## end of file
My problem is i cant figure out how to install the new
"MYSQL_REAL_CONNECT" - feature
i am looking a whole f*$%%%ing day now and there is no germen help for
it.
everytime i locate to "http://localhost/temp_con.php"
the only thing i get back is:
a
Fatal error: Call to undefined function mysql_real_connect() in
C:\WEBSEITEN\BaltiCom2005\temp_con.php on line 3
HELP me please!!!
sincerely yours
Karsten Scherer [EMAIL PROTECTED]
--- End Message ---