[PHP-DB] E-mail marketing tool?

2003-10-03 Thread Tristan . Pretty
Hi there,
I've been trolling through hotscripts.com etc, looking for a tool that I 
can buy/download to use as a email marketing tool.
My company has requested the ability to allow users to sign up for certian 
offers, news items etc, and need the following functionality:

Multiple lists, and each user can subcribe to all/none of these.
Opt out E-mail links
Option for HTML E-mail
Option for attachments
Status checker (to make suer we don't duplicate E-mails)
Progress reports etc...

There are many of packages that do this, most for under $100, but before I 
spend the cash, has anyone got experiance with this kinda thing, I'n in 
the deepend here.
(To be honest, I'd love to build my own, but we don't have the time)

*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***



[PHP-DB] online test, plz help

2003-10-03 Thread Muhammad Ibrahim
i'm developing on_line entry test facility in it.
Any student who wants to take this test follows the following steps
1. he/she registered him/her self.
2.secondly he enters his user name  password in a login form,if these 
entries are valid another form appears  ,prompting him to enter his complete 
information.
3.after submitting data (I've  implemented all validation checks on all 
forms)
4.a page appears with a question following options ,a user can select any 
one or can skip by simply clicking on next button,so another question 
appears,all these questions are retrieved from sql server table 
randomly.Ofcourse it was a difficult job,but thanks to God that we have 
achieved our goal.The only problem i'm facing now is setting time for a 
student ,because a student is given 30 minuts to take the test.
for this purpose we used time() of php ,but the results was not 
satisfactory,as in php
time() returns time in second  calculation was not easy,then we used 
date(h:i:s);
But the result was cache limiter error.Now tell me how to overcome this 
problem
i'm sending script attached with this mail .

Also tell me if any changes are needed to make in php.ini files.

THANKS

here is my script!

?php
session_start();
session_register(count1);
session_register(op);
//$count1=50;
$con=mssql_connect(localhost/computername,username,password);
$db=mssql_select_db(Entry_Test,$con);
//generating random questions ids
// seed with microseconds
function make_seed() {
   list($usec, $sec) = explode(' ', microtime()*2);
   return (float) $sec + ((float) $usec * mt_rand());
}
$j=0;
$n=0;
$i=0;
//Sir,i need time check here
while($n5)
{
mt_srand(make_seed());
$rn=mt_rand(1,20);
$ar[$j]=$rn;
$s=0;
for($k=0;$k$n;$k++)
{
if($rn==$ar[$k])
$s=1;
}
if($s==0)
{
//retrieveing question from data base
$sql=mssql_query(select question,option1,option2,option3,correct_ans from 
questions where q_id='$ar[$n]',$con);
while($rec=mssql_fetch_array($sql))
{
$q=$rec[0];
$op1=$rec[1];
$op2=$rec[2];
$op3=$rec[3];
$op4=$rec[4];
$i++;
}
$n=$n+1;
$j++;

}//end of if
//sir,time must be checked here again(i.e each time when user clicks 
next(submit) button) so with in specified time user is shown questions
}//end of while
echo(centertable border=0);

echo(form   );

echo(tr td background=q1.png height=150 width=500 );
echo(h3brcenter$q/h3/td/tr);
echo(pcentertrtd img src=o1.png /td/tr);
echo(trtdinput type=radio  name=r1 value=$op1.$op1);
echo(/td/tr);
echo(trtdinput type=radio  name=r1 value=$op2.$op2);
echo(/td/tr);
echo(trtdinput type=radio  name=r1 value=$op3.$op3);
echo(/td/tr/table/centerbrinput type=image src=next_up.png);
echo(/form);
echo($r1br$opbr);
if(empty($r1))
$count1=$count1+0;
else if($r1==$op)
$count1=$count1+5;
else
$count1=$count1-5;
$x=$count1;
echo(you have got $x Marksbr);
$op=$op4;
?
html
body bgcolor=#f0f4ff
/body
/html
a href=p1.htmlshow results/a
_
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus

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


[PHP-DB] Re: Calculating time unused

2003-10-03 Thread Shaun

David Robley [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 In article [EMAIL PROTECTED], [EMAIL PROTECTED]
 says...
  Hi,
 
  I have a table called Bookings which has two important columns;
  Booking_Start_Time and Booking_End_Time. These columns are both of type
  DATETIME. Given any day how can I calculate how many hours are available
  between the hours of 09.00 and 17.30 so a user can see at a glance how
many
  hours they have unbooked on a particular day, can this be done with a
query
  or do I have to work it out with PHP?
 
  Thanks for your help

 Seems easy enough - just sum the time booked per day and subtract it from
 the constant which is the total of available hours, and group by day.
 You'll need to calculate the booked time based on existing start/end
 values but you should be able to do that in SQL.

 Cheers
 -- 
 Quod subigo farinam

 A: Because it messes up the order in which people normally read text.
 Q: Why is top-posting such a bad thing?
 A: Top-posting.
 Q: What is the most annoying thing on usenet?

Thanks for your reply,

I am having some odd results with this, just wondering if you could check
this query for me:

SELECT COUNT(B.Booking_ID) AS Booking_ID,
   SUM(8.5 - (DATE_FORMAT(Booking_Start_Date, '%h:%i:%s')) +
(DATE_FORMAT(B.Booking_End_Date, '%h:%i:%s'))) AS Available_Hours
   FROM WMS_Bookings B
   WHERE B.User_ID = '.$user_id.'
   AND B.Booking_Status  '1'
   AND '.date(Y-m-d,
strtotime($loop3_this_year-$loop3_this_month-$loop3_this_day)).' =
DATE_FORMAT(Booking_Start_Date, '%Y-%m-%d');

Thanks for your help

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



[PHP-DB] Hours available in a day

2003-10-03 Thread Shaun
Hi,

I have a table called Bookings which has two important columns;
Booking_Start_Time and Booking_End_Time. These columns are both of type
DATETIME. Given any day how can I calculate how many hours are available
between the hours of 09.00 and 17.30 so a user can see at a glance how many
hours they have unbooked on a particular day (i.e. 8.5 hours less the time
of any bookings on that day), can this be done with a query
or do I have to work it out in my code?

Thanks for your help

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



[PHP-DB] RE: [PHP-INSTALL] Problem by running mysql-connection in php-script

2003-10-03 Thread Ruprecht Helms
On Thu, 2003-10-02 at 22:28, Michael Scappa wrote:
 Ruprecht,
 
 Make sure you have PHP pointing to the right location for the
 mysql.sock. locate mysql.sock. Sometimes its in the /tmp dir. If it is
 in another location you can point to it specifically when you call
 mysql_connect (refer to php.net for the exact string), or just change it
 in your php.ini.

This are the entries I've made in the php.ini

[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no
limit.
mysql.max_links = -1

; Default port number for mysql_connect().  If unset, mysql_connect()
will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will
only look
; at MYSQL_PORT.
mysql.default_port =

; Default socket name for local MySQL connects.  If empty, uses the
built-in
; MySQL defaults.
mysql.default_socket = /tmp/mysql.sock

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host = localhost

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user = root


And this is my actual /tmp-directorylinux:/tmp # ls
.  .esd  AcroSaTWYY 
aaa  ksocket-root  migrate-2  
noteedit.2vmq44
.. .shtool.8404  AcroWx7cEx 
alsaplayer_root_0mc-root   migrate-3  
noteedit.rvtxIc
.ICE-unix  .webmin   Acrol21KzJ 
audacity1.1-root mcop-root migrate-4  
orbit-root
.X0-lock   AcroAgqtL1AcrooMY5eg 
gsr-record-Untitled.wav-1603.BHH8QX  medusa-idled-service  migrate-5
.X11-unix  AcroMfep2RAcrowt39f1 
jpsock.141.6939  migrate   migrate-6
.caitmpAcroQUQtXcAcrox5BdJI 
kde-root migrate-1 mysql.sock

You see there is the mysql.sock

And this is the connection-command in some scripts I use. Normaly it
works fine, but now It fails and I get the reported error.

mysql_connect(localhost,root);

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



RE: [PHP-DB] RE: [PHP-INSTALL] Problem by running mysql-connection in php-script

2003-10-03 Thread Michael Scappa

Looks possible that php isn't using that particular ini file. Make sure
it's the correct ini file, because your error message has it looking in
a different location.

Try mysql_connect(127.0.0.1:3306:/tmp/mysql.sock, etc etc etc) for
your connect (that might supposed to be the path to socket, not the file
itself, try both).


-Original Message-
From: Ruprecht Helms [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 03, 2003 8:15 AM
To: Michael Scappa
Cc: [EMAIL PROTECTED]
Subject: [PHP-DB] RE: [PHP-INSTALL] Problem by running mysql-connection
in php-script

On Thu, 2003-10-02 at 22:28, Michael Scappa wrote:
 Ruprecht,
 
 Make sure you have PHP pointing to the right location for the
 mysql.sock. locate mysql.sock. Sometimes its in the /tmp dir. If it
is
 in another location you can point to it specifically when you call
 mysql_connect (refer to php.net for the exact string), or just change
it
 in your php.ini.

This are the entries I've made in the php.ini

[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no
limit.
mysql.max_links = -1

; Default port number for mysql_connect().  If unset, mysql_connect()
will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will
only look
; at MYSQL_PORT.
mysql.default_port =

; Default socket name for local MySQL connects.  If empty, uses the
built-in
; MySQL defaults.
mysql.default_socket = /tmp/mysql.sock

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host = localhost

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user = root


And this is my actual /tmp-directorylinux:/tmp # ls
.  .esd  AcroSaTWYY 
aaa  ksocket-root  migrate-2  
noteedit.2vmq44
.. .shtool.8404  AcroWx7cEx 
alsaplayer_root_0mc-root   migrate-3  
noteedit.rvtxIc
.ICE-unix  .webmin   Acrol21KzJ 
audacity1.1-root mcop-root migrate-4  
orbit-root
.X0-lock   AcroAgqtL1AcrooMY5eg 
gsr-record-Untitled.wav-1603.BHH8QX  medusa-idled-service  migrate-5
.X11-unix  AcroMfep2RAcrowt39f1 
jpsock.141.6939  migrate   migrate-6
.caitmpAcroQUQtXcAcrox5BdJI 
kde-root migrate-1 mysql.sock

You see there is the mysql.sock

And this is the connection-command in some scripts I use. Normaly it
works fine, but now It fails and I get the reported error.

mysql_connect(localhost,root);

-- 
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] Round a number

2003-10-03 Thread Shaun
Hi,

I have a query that returns a number from  culculation in my table. It
returns say 4.00, 8.75, 0.00, 12.50 etc. How can I get MySQL to return the
number without any zeros, i.e. 4, 8.75, 0, 12.5 etc?

Thanks for your help

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



RE: [PHP-DB] Round a number

2003-10-03 Thread Gary . Every
Try the rtrim function in php


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
Pay It Forward
mailto:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: Shaun [mailto:[EMAIL PROTECTED]
 Sent: Friday, October 03, 2003 10:12 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Round a number
 
 
 Hi,
 
 I have a query that returns a number from  culculation in my table. It
 returns say 4.00, 8.75, 0.00, 12.50 etc. How can I get MySQL 
 to return the
 number without any zeros, i.e. 4, 8.75, 0, 12.5 etc?
 
 Thanks for your help
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


Re: [PHP-DB] Round a number

2003-10-03 Thread Ignatius Reilly
SELECT
TRIM( TRAILING
  '.'
  FROM TRIM( TRAILING '0' FROM mycol )
 )


Ignatius
_
- Original Message -
From: Shaun [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, October 03, 2003 5:12 PM
Subject: [PHP-DB] Round a number


 Hi,

 I have a query that returns a number from  culculation in my table. It
 returns say 4.00, 8.75, 0.00, 12.50 etc. How can I get MySQL to return the
 number without any zeros, i.e. 4, 8.75, 0, 12.5 etc?

 Thanks for your help

 --
 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] Round a number

2003-10-03 Thread Peter Beckman
On Fri, 3 Oct 2003, Shaun wrote:

 I have a query that returns a number from  culculation in my table. It
 returns say 4.00, 8.75, 0.00, 12.50 etc. How can I get MySQL to return the
 number without any zeros, i.e. 4, 8.75, 0, 12.5 etc?

 You can't in MySQL.  At least not that I could figure out.

 In PHP you could write code to do it.

 $float = 4.00;
 $text = (string)$float;
 if (preg_match(/\d+\.0+$/, $text)) {
 list($final) = (int)split(\., $text);
 } elseif {
 ... blah blah blah
 }

 code is untested, I may have written it wrong.

---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---

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



RE: [PHP-DB] Round a number

2003-10-03 Thread Dillon, John
This should do it:

http://www.mysql.com/doc/en/Miscellaneous_functions.html
FORMAT(X,D) 
Formats the number X to a format like '#,###,###.##', rounded to D decimals,
and returns the result as a string. If D is 0, the result will have no
decimal point or fractional part: 
mysql SELECT FORMAT(12332.123456, 4);
- '12,332.1235'
mysql SELECT FORMAT(12332.1,4);
- '12,332.1000'
mysql SELECT FORMAT(12332.2,0);
- '12,332'

John


 I have a query that returns a number from  culculation in my table. It
 returns say 4.00, 8.75, 0.00, 12.50 etc. How can I get MySQL to return the
 number without any zeros, i.e. 4, 8.75, 0, 12.5 etc?
















   http://www.cantor.com
CONFIDENTIAL: This e-mail, including its contents and attachments, if any, are 
confidential. If you are not the named recipient please notify the sender and 
immediately delete it. You may not disseminate, distribute, or forward this e-mail 
message or disclose its contents to anybody else. Copyright and any other intellectual 
property rights in its contents are the sole property of Cantor Fitzgerald.
 E-mail transmission cannot be guaranteed to be secure or error-free. The sender 
therefore does not accept liability for any errors or omissions in the contents of 
this message which arise as a result of e-mail transmission.  If verification is 
required please request a hard-copy version.
 Although we routinely screen for viruses, addressees should check this e-mail and 
any attachments for viruses. We make no representation or warranty as to the absence 
of viruses in this e-mail or any attachments. Please note that to ensure regulatory 
compliance and for the protection of our customers and business, we may monitor and 
read e-mails sent to and from our server(s). 

For further important information, please read the  Important Legal Information and 
Legal Statement at http://www.cantor.com/legal_information.html

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



[PHP-DB] RE: Hyperlinks in MySQL dB

2003-10-03 Thread Jeremy Shovan


-Original Message-
From: Gary H. Holabird [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 02, 2003 11:06 AM
To: [EMAIL PROTECTED]
Subject: Hyperlinks in MySQL dB

This has got to be really simple  I feel really stupid having to ask
but...

I'm a very green n00b writing my first php script.

I have a VERY simple MySQL table which I would like to display a bunch
of
hyperlinks (one hyperlink per row) but I dont want the user to see the
actual webpage addresss. eg: a field will say, for instance, Title1, but
when the user clicks on it they will be directed to the page or document
described in the link.  I'm sure everybody knows how to do this.

Also, attempting the same thing, but on an Intranet with web addresses
of MS
Word docs on the network.

Thanks tons in advance.

$sql = Select link, linktext from table;
if(!$result = mysql_query($sql)) {
//error handling code here
}
while($row = mysql_fetch_array($result)) {
extract($row);
echo(a href='$link'$linktext/abr);
}

I did not test this code.

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



[PHP-DB] PHP Issue

2003-10-03 Thread Michael Cupp, Jr.
I'm trying to 'run' a php pgoram by loading it into my browser, but
instead of running, it only displays it to me - how can I fix this?


RE: [PHP-DB] PHP Issue

2003-10-03 Thread Jack van Zanen
check your apache httpd.conf (or iis configuration or whatever your
webserver is)
see if you told it to parse php scripts before presenting it to the web.
***
   LoadModule php4_module c:/php/sapi/php4apache2.dll
   AddType application/x-httpd-php .php
***

or

install PHP

or

name your file .PHP (if type added is .php

or

start your script with ? [PHP] and end it with ?

Jack

-Original Message-
From: Michael Cupp, Jr. [mailto:[EMAIL PROTECTED]
Sent: vrijdag 3 oktober 2003 23:29
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP Issue


I'm trying to 'run' a php pgoram by loading it into my browser, but
instead of running, it only displays it to me - how can I fix this?

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



[PHP-DB] Re: Hours available in a day

2003-10-03 Thread Shaun

Shaun [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 I have a table called Bookings which has two important columns;
 Booking_Start_Time and Booking_End_Time. These columns are both of type
 DATETIME. Given any day how can I calculate how many hours are available
 between the hours of 09.00 and 17.30 so a user can see at a glance how
many
 hours they have unbooked on a particular day (i.e. 8.5 hours less the time
 of any bookings on that day), can this be done with a query
 or do I have to work it out in my code?

 Thanks for your help

Fixed:

$query = SELECT
  8.5 - (SUM(((DATE_FORMAT(B.Booking_End_Date, '%k') * 60 ) +
DATE_FORMAT(B.Booking_End_Date, '%i')) -
 ((DATE_FORMAT(B.Booking_Start_Date, '%k') * 60 ) +
DATE_FORMAT(B.Booking_Start_Date, '%i'))) / 60) AS
Available_Hours
 FROM Bookings B
  WHERE B.User_ID = '.$user_id.'
  AND DATE_FORMAT(Booking_Start_Date, '%Y-%m-%d') = '.date(Y-m-d,
strtotime($year-$month-$day)).';

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



[PHP-DB] Re: Calculating time unused

2003-10-03 Thread Shaun

Shaun [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 David Robley [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  In article [EMAIL PROTECTED],
[EMAIL PROTECTED]
  says...
   Hi,
  
   I have a table called Bookings which has two important columns;
   Booking_Start_Time and Booking_End_Time. These columns are both of
type
   DATETIME. Given any day how can I calculate how many hours are
available
   between the hours of 09.00 and 17.30 so a user can see at a glance how
 many
   hours they have unbooked on a particular day, can this be done with a
 query
   or do I have to work it out with PHP?
  
   Thanks for your help
 
  Seems easy enough - just sum the time booked per day and subtract it
from
  the constant which is the total of available hours, and group by day.
  You'll need to calculate the booked time based on existing start/end
  values but you should be able to do that in SQL.
 
  Cheers
  -- 
  Quod subigo farinam
 
  A: Because it messes up the order in which people normally read text.
  Q: Why is top-posting such a bad thing?
  A: Top-posting.
  Q: What is the most annoying thing on usenet?

 Thanks for your reply,

 I am having some odd results with this, just wondering if you could check
 this query for me:

 SELECT COUNT(B.Booking_ID) AS Booking_ID,
SUM(8.5 - (DATE_FORMAT(Booking_Start_Date, '%h:%i:%s')) +
 (DATE_FORMAT(B.Booking_End_Date, '%h:%i:%s'))) AS Available_Hours
FROM WMS_Bookings B
WHERE B.User_ID = '.$user_id.'
AND B.Booking_Status  '1'
AND '.date(Y-m-d,
 strtotime($loop3_this_year-$loop3_this_month-$loop3_this_day)).' =
 DATE_FORMAT(Booking_Start_Date, '%Y-%m-%d');

 Thanks for your help

Fixed it :)

$query = SELECT
  8.5 - (SUM(((DATE_FORMAT(B.Booking_End_Date, '%k') * 60 ) +
DATE_FORMAT(B.Booking_End_Date, '%i')) -
 ((DATE_FORMAT(B.Booking_Start_Date, '%k') * 60 ) +
DATE_FORMAT(B.Booking_Start_Date, '%i'))) / 60) AS
Available_Hours
 FROM Bookings B
  WHERE B.User_ID = '.$user_id.'
  AND DATE_FORMAT(Booking_Start_Date, '%Y-%m-%d') = '.date(Y-m-d,
strtotime($year-$month-$day)).';

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