Re: [PHP-DB] new php developer

2002-02-06 Thread Jason G.

Hi,

At 12:17 AM 2/7/2002 -0500, John George wrote:
I am a student a the University of Pittsburgh, and a new php developer.  Is
it possible to have a mysql database that is made up of html documents that
can be accessed using php?  This question may sound strange, but I'm not
sure of any other way to say it.

Not strange, sounds like a content management system...  Store the HTML in 
a mysql TEXT field or like...  (make SURE to use addslashes() before 
inserting the data)

Another question I have was, is it possible to have php recognize a user, by
say password or ip address, and determine which which files or links to show
them.  Example, say I had a user Joe.  When Joe accessed the password
protected directory, he would be prompted to a page where php would then
recognize Joe and then create a list of files (links) that he would be
able to access.

Sure, you need to look into session management probably...  I have written 
a system like that from scratch, but there may be easier ways...


Is php the right scripting language for this job?

DEFINITLY

Thank you for your time, it is greatly appreciated.
John George
[EMAIL PROTECTED]


-Jason Garber
IonZoft.com



--
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] mass insert to database

2002-02-03 Thread Jason G.

See the set_time_limit() function in the php manual.

-Jason Garber
IonZoft.com


At 10:22 AM 2/4/2002 +0800, J-E-N wrote:
hello all,


i'm trying to make a script where i can do a mass insert to database 
(4,000 entries) and then send confirmation email to each of the entry's 
email address stating that their record has been inserted to database. My 
problem is, when i use a while loop the page time-out on the 300th entry. 
please help.

thanx


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




Re: [PHP-DB] counting with CURDATE() - please help!

2002-01-26 Thread Jason G.

if you have a date column 'birthdate'

SELECT (birthdate + INTERVAL 7 MONTH) as birthdate FROM yourtable WHERE ...

Look at the date and time functions in the MySQL manual.

-Jason Garber
IonZoft.com


At 02:28 PM 1/27/2002 +, DL Neil wrote:
Hello Sander,

  I want to add a variable numer of months to the current date CURDATE().
  I thought it should be something like this:
  select (MONTH(CURRENT_DATE)+MONTH(2))
  but i get NULL as a result.
 
  The purpose of this it to check which records with a experation date is
  earlier or later than today+2 months later.
 
  Can somebody please tell me how to do this?


Would MySQL's ADD_DATE() suit?
=dn



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] PHP/MSQL/HTML and Javascript

2001-11-22 Thread Jason G.

I don't know much about javascript, but I would do the following:

1. Figure out what javascript data structure you are going to use to hold 
the data.
2. Figure out exactly how it should be coded.
3. Simply write your PHP script to output your javascript as in 2.

The hard part of the matter (which is not very hard) is to figure out how 
to do the javascript.  Create a static page on your local hard drive with 
hard coded javascript data structures.  When you figure out how to do it 
like that, then add the PHP to generate the page in that format.

By the way, I am going to soon need to do something similar - where the 
user gives several inputs in a row, and then the data is packed and posted 
to a php script - which outputs another batch of questions.  If you are 
running a slow connection, or the server is loaded, then having to reload the
page each time you type a word or two could get quite frustrating.  So, let 
me know what you come up with if you have the time.

-Jason Garber
IonZoft.com

At 10:29 AM 11/22/2001 +0100, [EMAIL PROTECTED] wrote:
Hi, out there
Has anybody found a way to pass variables between javascript and php?
Here's what I want to achieve:
1.  I want to display a mysql_query result record-by-record
(first/prev/next/last buttons) without re-querying.
2.  I want to use a static html-form and plug the data into input
name=field_# type=text value=
 via event triggers
onclick=this.form.elements[field#].value=queryresult_for_field#
3.  I read the query result into an php-array and want to pass
array_values[1-n][1-m] to query_result_for_field
4.  Obviously, I can increase/decrease values of javascript
variables
 Obviously, there's a php array and I can set I php-array-counter
 BUT: I can't achieve to pass either value to the other
5.  I know, that php parses html first and then comes javascript,
but the array is there and I can use the java-
 script to place anything into this.form.elements[field#].value
6,  The whole thing is about NOT reload/refresh the page/re-query
but placing values via javascript.objects
 and triggers into an otherwise static forms-fill-in
Has anybody got a clue on that or is it really simply not possible due
to 5 above?
regards
Dietmar


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] date help

2001-11-18 Thread Jason G.

Hello,

You said that you are using MySQL.  Create 2 columns like:

create_ts INT UNSIGNED NOT NULL,
last_login_ts INT UNSIGNED NOT NULL

Use the MySQL UNIX_TIMESTAMP() function, comparable to the PHP time() 
function (number of seconds since 1-1-1970 12:00:00 AM).

UPDATE table SET last_login_ts=UNIX_TIMESTAMP() where ID=12345;

-Jason Garber
IonZoft.com



At 02:45 PM 11/17/2001 +, Srinivasan Ranganathan wrote:
Hi

I need to store the date and time of sign-up and date
and time of last successful login in a mysql database
and calculate how long the user has been using a site.
how do i do this?

thanks in advance
Srinivasan

__
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email 
and Music Charts
http://uk.my.yahoo.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] sending bulk emails

2001-11-02 Thread Jason G.

I just encountered the same problem...

I made a MySQL table with an email_id, email, and sentdate field.

while(true)
{
   set_time_limit(10); //Give script 10 more seconds to run

   SELECT email_id, email FROM thelist WHERE sentdate=0 LIMIT 1

   if record not found, then break;

   then I use the mail function to send it

   UPDATE thelist SET sentdate=UNIX_TIMESTAMP() WHERE email_id=$email_id

   then I use the sleep() or usleep() function to wait a second or so (so I 
do not use too much bandwidth)

}

-Jason Garber
IonZoft.com


At 07:26 AM 11/2/2001 -0600, Rick Emery wrote:
Opswe've just armed a potential spammer...

-Original Message-
From: Russ Michell [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 02, 2001 6:20 AM
To: Cami
Cc: PHP DB list
Subject: Re: [PHP-DB] sending bulk emails


  Does anybody know how to send bulk emails using php?
Don't do it!!

But of you must - I guess you could build an array containing email
addresses, names, etc - taken
from form input or a database or whatever and then loop the arrays mailing
people...

$mail = mail(;
for($i=0; $i$email_array_name;$i++( {
 $mail .= $values,;
 }
$mail .= \$subject\,\$body\,\From: $from\);;

Something like that anyway (that's just off the top of my head)
Regards.

Russ

On Fri, 2 Nov 2001 11:26:22 - Cami [EMAIL PROTECTED] wrote:

  Hi guys,
  Does anybody know how to send bulk emails using php?
  Thanks,
  Cami
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

#---#

   Believe nothing - consider everything

   Russ Michell
   Anglia Polytechnic University Webteam
   Room 1C 'The Eastings' East Road, Cambridge

   e: [EMAIL PROTECTED]
   w: www.apu.ac.uk/webteam

   www.theruss.com

#---#


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Variables in a loop

2001-10-30 Thread Jason G.


If you have a string that is the name of an input field, you can do one of 
3 things:

Ex:
$sName = input.$i;  //result = input1
$sName = input.$i;  //result = input2
etc...

1: Variable Variables
$value = $$sName;

2: If you posted the form
$value = $HTTP_POST_VARS[$sName];

3: If you used GET with the form
$value = $HTTP_GET_VARS[$sName];

Regards,
-Jason Garber
IonZoft.com






At 09:10 AM 10/30/2001 +0100, * RzE: wrote:
Original message
From: LeTortorec, Jean-Louis [EMAIL PROTECTED]
Date: Mon, Oct 29, 2001 at 04:03:45PM -0500
Message-ID: 615315231286D21182E40008C7B1EED23C6E76@COMPAQ3000
Subject: [PHP-DB] Variables in a loop

  I'm trying to write a loop to read variables I receive from a form:
 
  form ...
  input name=a1 value=..
  input name=a2 value=..
  input name=a3 value=..
  input name=a4 value=..
 
 
  I'd like to get something like:
 
  for ($i=1; $i=10; $i++) { $tab[$i]=a.$i ;}
 
 
  The expression a.$i is actually a string, not a variable.  Any idea 
 how to
  read the value of that string?
 
  Thanks for your help.
 
  Jean-Louis

/Original message

Reply

Why don't you just use an array?

form ...
input name=a[] value=..
input name=a[] value=..
input name=a[] value=..
input name=a[] value=..

/Reply

--

* RzE:


-- 
-- Renze Munnik
-- DataLink BV
--
-- E: [EMAIL PROTECTED]
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
--
-- Stationsplein 82
-- 2011 LM  HAARLEM
-- Netherlands
--
-- http://www.datalink.nl
-- 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] keys in mysql

2001-10-23 Thread Jason G.

You read the mysql manual.

www.mysql.com

Look up alter table.

ALTER TABLE mytable ADD KEY keyname (keyfield1, keyfield2);

-Jason Garber

At 08:33 PM 10/23/2001 -0700, søren eriksen wrote:
How do I set up secondary keys in mysql?


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Check Boxes/UPDATE

2001-10-02 Thread Jason G.

Matt,

Assuming that you have a variable number of records being displayed out of 
the database:

As you write out the HTML, give each checkbox a name containing the ID# of 
the record that is being written out.  Ex:
input type=check name=chkAuthStatus_1203 checked
input type=check name=chkAuthStatus_1204 checked
input type=check name=chkAuthStatus_1205 checked


Use code like the following to Write and Read the web form...

?php

//Get the DB result
$dbResult = mysql_query(SELECT id, authstatus, whatever, whatever2 FROM 
table WHERE whatever);

//Get the row count
$nRowCount = mysql_num_rows($dbResult);

//Scan the result
for($i=0; $i$nRowCount; $i++)
{
 //Get the current row as an object
 $oRow = mysql_fetch_object($dbResult);

 //Format the checkbox name
 $sCheckName = chkAuthStatus_ . $oRow-id;

 //When Writing out the Web Form, use this
 $sChecked = ($oRow-authstatus ? ' checked' : '');
 echo input type=\check\ name=\$sCheckName\$sChecked;


 //When Reading in the web form, use this
 //If the checkbox variable isset(checked) then set the 
authstatus=1
 //Otherwise set the authstat= 0
 $authstatus = (isset($$sCheckName) ? 1 : 0);

 //Update the database
 mysql_query(UPDATE table SET authstatus=$authstatus WHERE 
id=$oRow-id);
}

?

-Jason Garber
www.IonZoft.com


At 03:22 AM 10/3/2001 +0100, Matt C wrote:
I have a page of jobs with AuthStatus set to 0. Basically I want to list 
each job title with a checkbox next to it. This I have done.

What I really don't understand is how do I make it so that the rows in my 
table for all the different records when ticked are updated to 1?

Please help.

Matt

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] problem with WHILE loop

2001-09-30 Thread Jason G.

the mysql_query function returns a Result Identifier.  For every row in the 
result (found by mysql_num_rows), you must call one of the the row 
retrieval functions (mysql_fetch_array, mysql_fetch_object, etc...)  These 
functions automatically advance the row position in the Result.

Replace the code with this:

?php

   $dbResult = mysql_query(select id,title from table1);
   $nRowCount = mysql_num_rows($dbResult);

   for($i=0; $i$nRowCount; $i++)
   {
 $aRow = mysql_fetch_array($dbResult);
 $title = $list_row[title];
 echo($title br\n);
   }

?

-Jason Garber
www.ionzoft.com

*
I prefer mysql_fetch_object() personally...

Replace the code with this:

?php

   $dbResult = mysql_query(select id,title from table1);
   $nRowCount = mysql_num_rows($dbResult);

   for($i=0; $i$nRowCount; $i++)
   {
 $oRow = mysql_fetch_object($dbResult);
 echo($oRow-title br\n);
   }

?




At 08:32 PM 9/30/2001 -0500, you wrote:
I have the following code on a page:

?php
   $list = mysql_query(select id,title from table1);
   $list_row = mysql_fetch_array($list);
   $title = $list_row[title];

   while($list_row)  {
   echo($title br\n);
   }
?

For some reason, when I load the page, instead of a list of the titles from
table1, I get the title from the first row of table1 repeated over and over.

Obviously I'm doing something wrong, and it's probably something really
dumb, right in front of my face... but I can't find it!  help?

Thanks,

Eric Schwinder
eric.AT.bergencomputing.DOT.com
 AT = @
 DOT = (well... you know)



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] mysql_fetch_array() doesn't work

2001-09-27 Thread Jason G.


echo a href='$PHP_SELF?offset=$i*$step' target='_top'

Missing end quote and semicolon on this line may be the reason...

Try properly indenting and formatting your code.  Also take advantage of 
going in and out of php mode to seperate your code from your display of 
content...
Ex:
instead of this:
? echo(td align=\center\ width=\$nWidth\$sContent/td); ?
Try this:
td align=center width=? echo($nWidth); ?? echo($sContent); ?/td
Or even this:
td align=center width=?=$nWidth??=$sContent?/td

It makes it MUCH easier to read and maintain, and seperates the PHP code 
from the HTML content as much as possible.

Any questions, please ask me.

-Jason Garber
Lead Programmer - www.pulseaday.com
[EMAIL PROTECTED]

At 12:48 PM 9/27/2001 +0800, you wrote:
System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98

When PHP is running at the line: $arr=mysql_fetch_array($res);
The IE always show info as below:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in c:\program files\apache
group\apache\htdocs\web\site1\list.php on line --[the number of line]

What's the problem wiht mysql_fetch_array() or other?
What does the T_STRING' or `T_VARIABLE' or `T_NUM_STRING' mean?

THANKS
Mike


The full code below:


?
$link=mysql_connect(localhost,,);
if($link==false){
echo Failed linking to database.;
exit();
}
$handler=mysql_select_db(database1);
if($handler==false)
echo Failed linking to database.;
$query=selct count(*) from users where sign=1;
$res=mysql_query($query);
$row=mysql_fetch_row($res);
$all=$row[0];
$step=5;
$pages=ceil($all/$step);   /*the number of pages needed to listed */
if(empty($offset))
$offset=0;
$query=select user_id, user_name, time, status, comment from users
where sign=1
order by user_name
limit $offset, $step;
$res=mysql_query($query);
echo tabletd align=centerUser/td
td align=centerAdded time/tdtd align=centerStatus/td/tr;
$num=mysql_num_rows($res);
for($i=0; $i$num; $i++) {
$arr=mysql_fetch_array($res);   /* HERE is line where the error occurs!!!
*/
echo trtd align=centera href=\profile.php?id=$arr['user_id']\
target='_top'
$arr['user_name']/a/td;
echo td align=center$arr['time']/td;
echo td align=center$arr['status']/td/tr;
echo tr colspan=3td$arr['comment']/td/tr;
}

echo /tablebrbrbr;

echo tabletrtd align='center';  /* show others in multi-pages */
for($i=0; $i$pages; $i++){
echo a href='$PHP_SELF?offset=$i*$step' target='_top'
echo ($i+1)./a;
echo nbsp;nbsp;;
}
echo /td/tr/table;

?


-
create table users (
user_id int not null auto_increment primary key,
user_name varchar(30),
time datetime,
status tinyint(1),
comment text,
sign tinyint(1) default '1'
);







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



Re: [PHP-DB] MySQL Update Logging ???

2001-09-20 Thread Jason G.

Check out for MySQL mailing lists

http://www.mysql.com/documentation/lists.html

-JAson Garber

At 03:42 PM 9/20/2001 -0500, Christopher Raymond wrote:

NOTES: I know this is a PHP list, but I also know that many of you are
experienced MySQL admins. In addition, I was unable to find a MySQL
newsgroup, so if you can help me out there, I would appreciated it and would
most certainly post my question there.


QUESTION: My ISP does not enable update logging with their MySQL server. Is
it possible for them or me to turn on update logging just for MY database(s)
???


I appreciate any help  God Bless America,

Christopher Raymond


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Searching/keywords

2001-09-20 Thread Jason G.

Just an idea...

You could do a str_replace(), replacing  max  with
span style=background-color: yellow max /span

You may need to use a reg-exp replace function to determine where actual 
words are like max, vs. substrings like maximus.

see http://www.php.net/manual/en/function.str-replace.php for more info...

-Jason Garber
Lead Programmer - pulseaday.com



At 12:25 AM 9/21/2001 +0100, Matt C wrote:
I have summaries of episodes stored in a database. How on earth do I go 
about highlighting keywords? I mean I have done a search and it gives a 
list of urls:

episodes.php?id=4highlight=max

But how do I get it to go through all the words and highlight max or 
whatever keyword it is??

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]