Re: [PHP] PHP SQL Code

2003-03-02 Thread Tim Ward
I'd use ...
WHERE UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(sUpdated)  60*60*24*60

but I'm sure someone will come up with something more efficient.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: Philip J. Newman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, March 02, 2003 7:46 AM
Subject: [PHP] PHP SQL Code


 I would like yo show the users in a list that have a date that is more
than
 60 days old.


 $sql = SELECT * FROM stompers WHERE sUpdated 
 from_unixtime(unix_timestamp(now())-(15760*60)) AND sActive = 'Y' ORDER BY
 sUpdated DESC;

 This don't quite work ..

 Any suggestions?


 --
 Philip J. Newman.
 Head Developer
 [EMAIL PROTECTED]

 +64 (9) 576 9491
 +64 021-048-3999

 --
 Friends are like stars
 You can't allways see them,
 but they are always there.

 --
 Websites:

 PhilipNZ.com - Design.
 http://www.philipnz.com/
 [EMAIL PROTECTED]

 Philip's Domain // Internet Project.
 http://www.philipsdomain.com/
 [EMAIL PROTECTED]

 Vital Kiwi / NEWMAN.NET.NZ.
 http://www.newman.net.nz/
 [EMAIL PROTECTED]



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




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



Re: [PHP] Counting table fields having specific values

2003-02-27 Thread Tim Ward
if ($array = mysql_fetcharray($result))
{echo $array[SUM( hide = 0 )];
}

although for readability I'd prefer an 
 AS sum_hide  in the query and then use 
$array[sum_hide]

in general for reading from a mysql result ...

// for a single return row (or the just the first row)
if ($result = mysql_query(...))
{if ($array = mysql_fetch_array($result))
{...
}
}

// for multiple return rows
if ($result = mysql_query(...))
{while ($array = mysql_fetch_array($result))
{...
}
}

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: rentAweek support [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, February 27, 2003 5:31 PM
Subject: [PHP] Counting table fields having specific values


   I have a table where the row named hide can have a value 0 or 1.
 I want to obtain a count of all the rows where hide has value 0.
 
 The following works on mysqladmin:
 
 SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, - 1 
 
 Giving
 
 SUM( hide = 0 ) 
 7
 
 The PHP script statements generated are:
 
 $sql = 'SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, -1';
 $result = mysql_query($sql);
 
 What assignment statement do I need to write now to obtain the SUM value 
 as shown by mysqladmin please?
 
 TIA
 
 Mike
  
 
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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



Re: [PHP] form variable problem

2003-02-15 Thread Tim Ward
you need to use $_POST[userid], etc.
accessing the form elements by name directly is 
unsafe and doesn't work anyway with
register_globals off, which is the default 
setting in your veresion of PHP.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: Antoine [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Saturday, February 15, 2003 3:12 PM
Subject: [PHP] form variable problem


 I am having a problem using php to submitting a form.  For some reason
 PHP won't handle the form variables...  I am using PHP Version 4.2.2 on
 a redhat 8 system..  I used this code from a book called PHP and MySQL
 Web Development.   
 
 
 ?php
 /* the main failure in this site is that I can't seem to submit
the form properly.   the variables wont' work */
 session_start();
 
 file://$userid = ant;
 file://$password = ant;
 /* wanted to see if this form actually received the form variables */
 echo $userid;
 echo $password;
 if ($id  $password)
 {
   // if the user has just tried to log in
 
   $db_conn = mysql_connect(localhost, root, );
   mysql_select_db(test, $db_conn);
   $query = select * from auth 
.where userid='$userid' 
. and password=password('$password');
   $result = mysql_query($query, $db_conn);
   if (($num_rows = mysql_num_rows($result))  0 )
   {
   echo $num_rows;
 // if they are in the database register the user id
 $valid_user = $userid;
 session_register(valid_user);
   }
 echo $userid;
 echo $password;
 }
 else
 {
 echo this is not working;
 }
 ?
 html
 body
 h1Home page/h1
 ?php 
 
   if (session_is_registered(valid_user))
   {
 echo You are logged in as: $valid_user br;
 echo a href=\logout.php\Log out/abr;
   }
   else
   { // This part fails also
 if (isset($userid))
 {
   // if they've tried and failed to log in
   echo Could not log you in;
 }
 else 
 {
   // they have not tried to log in yet or have logged out
   echo You are not logged in.br;
 }
 
 // provide form to log in 
 echo form method=get action=\authmain.php\;
 echo table;
 echo trtdUserid:/td;
 echo tdinput type=text name=userid/td/tr;
 echo trtdPassword:/td;
 echo tdinput type=password name=password/td/tr;
 echo trtd colspan=2 align=center;
 echo input type=submit value=\Login\/td/tr;
 echo /table/form;
   }
 ?
 br
 a href=members_only.phpMembers section/a
 /body
 /html
 
 
 -- 
  _  _ ___  _ _  _   _ _  _  _  _ 
 |__| |\ |  |  |  | | |\ | |___[__  |  | ||  | |\/| |  | |\ | 
 |  | | \|  |  |__| | | \| |______] |__| |___ |__| |  | |__| | \| 
  
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] Help with classes (oop)

2003-02-03 Thread Tim Ward
the function with the same name as the class is the
constructor and is called when the instance is created.
So $first = new first runs first::first() without passing
any parameters hence the warning.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: Chris Hayes [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 03, 2003 7:35 PM
Subject: Re: [PHP] Help with classes (oop)


 Apparently it does not like the function name to be the same as the class
 name. So change one of them.

 ? php;
 class first
 {
  var $age;
  var $name;
 
  function first($age, $name)
  {
  return $age.$name;
  }
 }
 
 //main script
 $first = new first;
 $test=$first-first(35, chris);
 
 print $test;
 ?




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




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




Re: [PHP] processing form with unknown number of checkboxes, each with a unknown name.

2003-02-02 Thread Tim Ward
howabout making the checkboxes an array i.e.
INPUT TYPE=checkbox name=checkbox[?php echo($row[0])?] VALUE=YES

then when processing ...
foreach($_REQUEST[checkbox] as $checkbox)
{...
}

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: anders thoresson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, February 02, 2003 12:28 PM
Subject: [PHP] processing form with unknown number of checkboxes, each with
a unknown name.


 Hi,

  I building a form which will be used to set access rights to different
 parts of my web album. When editing the settings for each album, like the
 albums name and wether or not everyone should be allowed to upload
pictures
 to it, I also present a list of checkboxes to the administrators. One
 checkbox for each registred user. If checked, to user is allowed to view
 the pictures, if not check, no pictures show.

  The checkbox part of the form I build uses this code:

 db_connect($dbuser, $dbpassword, $dbdatabase);
 $query = SELECT userid FROM members;
 $result = mysql_query($query);
 while($row = mysql_fetch_array($result)) {
 echo($row[0]);
 ?
 INPUT TYPE=checkbox name=?php echo($row[0])? VALUE=YES


  But how do I process this form when saving the settings for the album?
For
 the forms I've built so far, I've known what information I can find in
 $_REQUEST['']. But this time, I don't know how many checkboxes there are,
 and what their names will be. How do I do this?

  Is the form ok, or is a bad form design the reason I can't figure out
what
 to form processing code should be?

 --
 anders thoresson

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




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




Re: [PHP] Sorting multidimensional arrays..

2003-01-30 Thread Tim Ward
if 'EXTENSION' is unique then you can make life
a lot easier by making that the key of the root array
(this is a heirarchy of arrays).

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: Chad Day [EMAIL PROTECTED]
To: php general [EMAIL PROTECTED]
Sent: Thursday, January 30, 2003 7:29 PM
Subject: [PHP] Sorting multidimensional arrays..


 I'm struggling with array_multisort, was hoping someone could give me some
 help.

 I have a multidim array, such as:

 $myarray[0][FIRSTNAME] = JOE
 $myarray[1][FIRSTNAME] = TIM
 $myarray[2][FIRSTNAME] = BOB

 $myarray[0][LASTNAME] = SMITH
 $myarray[1][LASTNAME] = BROWN
 $myarray[2][LASTNAME] = JONES

 $myarray[0][EXTENSION] = 2000
 $myarray[1][EXTENSION] = 4000
 $myarray[2][EXTENSION] = 1000

 I was trying array_multisort($myarray[EXTENSION], SORT_NUMERIC,
SORT_DESC),
 but nothing seems to be happening to the array.  If anyone has any clues
or
 can point me in the right direction, I would appreciate it.

 Thanks,
 Chad


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




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




Re: [PHP] Update row problems

2003-01-27 Thread Tim Ward
your query needs to be inside the foreach loop 
so that it runs for every item, at the moment it 
just runs after you've scanned through all the items 
so just does the last one.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: Steve Jackson [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Monday, January 27, 2003 11:46 AM
Subject: [PHP] Update row problems


 Hi all,
 
 I've been playing with this for a few hours now (over the course of a
 couple of days) and it's getting frustrating!
 
 All I want to do is to be able to make one row in the database set the
 order that my categories appear on my website. Now I can do this fine
 simply by using ORDER_BY but I want to have my users be able to update
 the order through an admin page like so:
 
 -
 Catid | catname | catdesc | catorder |
 1name   desc  1
 2name   desc  2
 3name   desc  3
 4name   desc  4
 __
 
 Basically I have a form which takes data from the table above and
 displays catname (just echoed) and catorder in a text form field. When I
 submit the form I want to update catorder with whatever number the user
 puts in the field.
 
 Currently my code updates only one of the category order numbers.
 So my form code:
 
 form action=eshop_processcatorder.php method=post
 /td/tr
 ?
 while ($array = mysql_fetch_array($mysql))
 {
 echo trtd width='150'span class='adminisoleipa';
 echo {$array[catname]};
 echo /tdtdinput type='text' size='2'
 name='catorder[{$array[catid]}]' value='{$array[catorder]}';
 echo /span/td/tr;
 }
 ?
 trtdbr
 input type=submit name=Submit value=Submit class=nappi
 /form 
 
 That does everything I need it to do.
 
 However what am I doing wrong when I try to process it using this code?
 
 foreach($_POST[catorder] as $catid = $catorder) 
 {
 $query = update categories set catorder=$catorder where
 catid=$catid; 
 }
   $result = mysql_query($query) or die(Query failure: 
 .mysql_error());
 if (!$result)
 {
 echo table width='100%' border='0' cellspacing='0'
 cellpadding='0' align='center' bgcolor='#629D39';
 echo trtdimg
 src='images/admin_orders_administrate.gif'/td/tr;
 echo trtdnbsp;/td/tr;
 echo trtdspan class='adminisoleipa'Could not change
 details: please a href='mailto:[EMAIL PROTECTED]'click
 here/a to email the administratorbrbr/span;
 echo /td;
 echo /tr;
 echo /table;
 }
 else
 {
 echo table width='100%' border='0' cellspacing='0'
 cellpadding='0' align='center' bgcolor='#629D39';
 echo trtdimg
 src='images/admin_orders_administrate.gif'/td/tr;
 echo trtdnbsp;/td/tr;
 echo trtdspan class='adminisoleipa'The category page has
 had the order in which categories appear changed.brbr/span;
 echo /td;
 echo /tr;
 echo /table;
 } 
 
 Any help appraciated.
 Kind regards,
 
 Steve Jackson
 Web Developer
 Viola Systems Ltd.
 http://www.violasystems.com
 [EMAIL PROTECTED]
 Mobile +358 50 343 5159
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] Update row problems

2003-01-27 Thread Tim Ward
what version of PHP? try $HTTP_POST_VARS instead.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: Steve Jackson [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Monday, January 27, 2003 1:14 PM
Subject: RE: [PHP] Update row problems


 I'm processing on a different page so what would I use instead of
 $_POST?
 print_r($_POST)
 Didn't display anything or diagnose anything.
 
 Steve Jackson
 Web Developer
 Viola Systems Ltd.
 http://www.violasystems.com
 [EMAIL PROTECTED]
 Mobile +358 50 343 5159
 
 
 
 
 
  -Original Message-
  From: Tim Ward [mailto:[EMAIL PROTECTED]] 
  Sent: 27. tammikuuta 2003 14:57
  To: Steve Jackson
  Subject: Re: [PHP] Update row problems
  
  
  sounds like $_POST[catorder] isn't an array - if
  you're posting to the same page you need to wrap 
  the processing in something to test if the form has 
  been posted (e.g. is_array($_POST[catorder])), 
  or maybe you're using an older versionof PHP where 
  $_POST isn't available -try using print_r($_POST) 
  for diagnostics.
  
  Tim Ward
  http://www.chessish.com
  mailto:[EMAIL PROTECTED]
  - Original Message - 
  From: Steve Jackson [EMAIL PROTECTED]
  To: 'Tim Ward' [EMAIL PROTECTED]
  Sent: Monday, January 27, 2003 12:52 PM
  Subject: RE: [PHP] Update row problems
  
  
   Ok,
   
   I put the query in the loop and now I get this error?
   
   foreach($_POST[catorder] as $catid = $catorder)
   {
 $query = update categories set catorder=$catorder where
   catid=$catid; 
   $result = mysql_query($query) or die(Query failure: 
   .mysql_error());
   }
   
   Warning: Invalid argument supplied for foreach()
   in 
  /home/stephenj/public_html/viola/eadmin/eshop_processcatorder.php on
   line 27
   
   Is it a $_POST problem? Using PHP 4.06
   
   Steve Jackson
   Web Developer
   Viola Systems Ltd.
   http://www.violasystems.com
   [EMAIL PROTECTED]
   Mobile +358 50 343 5159
   
   
   
   
   
-Original Message-
From: Tim Ward [mailto:[EMAIL PROTECTED]]
Sent: 27. tammikuuta 2003 14:11
To: PHP General; Steve Jackson
Subject: Re: [PHP] Update row problems


your query needs to be inside the foreach loop
so that it runs for every item, at the moment it 
just runs after you've scanned through all the items 
so just does the last one.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: Steve Jackson [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Monday, January 27, 2003 11:46 AM
Subject: [PHP] Update row problems


 Hi all,
 
 I've been playing with this for a few hours now (over the
course of a
 couple of days) and it's getting frustrating!
 
 All I want to do is to be able to make one row in the
database set the
 order that my categories appear on my website. Now I can do
this fine
 simply by using ORDER_BY but I want to have my users be
able to update
 the order through an admin page like so:
 
 -
 Catid | catname | catdesc | catorder |
 1name   desc  1
 2name   desc  2
 3name   desc  3
 4name   desc  4
 __
 
 Basically I have a form which takes data from the table 
  above and
 displays catname (just echoed) and catorder in a text form 
field. When
 I submit the form I want to update catorder with whatever
number the
 user puts in the field.
 
 Currently my code updates only one of the category order
numbers. So
 my form code:
 
 form action=eshop_processcatorder.php method=post 
  /td/tr 
 ? while ($array = mysql_fetch_array($mysql))
 {
 echo trtd width='150'span class='adminisoleipa';
 echo {$array[catname]};
 echo /tdtdinput type='text' size='2'
 name='catorder[{$array[catid]}]' 
  value='{$array[catorder]}';
 echo /span/td/tr;
 }
 ?
 trtdbr
 input type=submit name=Submit value=Submit class=nappi
 /form 
 
 That does everything I need it to do.
 
 However what am I doing wrong when I try to process it 
  using this
 code?
 
 foreach($_POST[catorder] as $catid = $catorder)
 {
 $query = update categories set catorder=$catorder where 
 catid=$catid; }
   $result = mysql_query($query) or die(Query failure: 
 .mysql_error());
 if (!$result)
 {
 echo table width='100%' border='0' cellspacing='0'
 cellpadding='0' align='center' bgcolor='#629D39';
 echo trtdimg
 src='images/admin_orders_administrate.gif'/td/tr;
 echo trtdnbsp;/td/tr;
 echo trtdspan class='adminisoleipa'Could not change
 details: please a 
href='mailto:[EMAIL PROTECTED]'click
 here/a to email the administratorbrbr/span;
 echo /td;
 echo

Re: [PHP] nested queries/loops

2003-01-23 Thread Tim Ward
// pseudo code (mostly)
if (mysql_query(SELECT * FROM partner, category, service
WHERE partner.id = service.id
AND service.categoryid = category.id))
{while ($array = mysql_fetcharray($result))
{$partners[$array[id][]= $array;
}
}

// then do ...
foreach($partners as $services)
{...
foreach($services as $service)
{...
}
}

this may not be quite what you need but you get the general idea.
looks like services as effectively a many to many link table, nothing
wrong with that as far as I can see

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: Justin French [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Thursday, January 23, 2003 11:26 AM
Subject: [PHP] nested queries/loops


 Hi all,

 I'm aware that this post is borderline MySQL, but the solution may be more
 PHP-oriented, so I'm asking here first.

 I have 4 related tables:

 partner (id,name,url,desc)
 category (id,name)
 service (id,categoryid,name)
 pid_to_sid (pid,sid)

 To point out the obvious, a partner provides one or more services, and a
 service belongs to a category.

 However, the above table structure may not be the best solution, because
I'm
 find that I need to perform MANY queries to get the information I need.

 For example, to retrieve all 20 partners, with a list of the services they
 perform, broken into the 5 categories, requires heaps of queries:

 while(partners loop of 20+ partners)
 {
 while(category loop of 5+ categories)
 {
 list services that match this cat and partner
 }
 }

 Or, if I want to show tick boxes for all the services (broken by category)
 for a particular partner (say on an admin form):

 while(category loop of 5)
 {
 while(all services loop of 30)
 {
 query DB to see if service is true for this partner
 }
 }


 So, what I'm looking for is some missing snippet of code or information,
or
 some little theory or tutorial that shows me the light on how I might
reduce
 the number of queries, perform smarter, more complex queries, or something
 like that.

 Otherwise, I can see myself writing some really sluggish code :)


 Or perhaps my problem is back at the database level, with too many tables,
 or whatever.


 Justin French


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




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




Re: [PHP] ADV SQL Help Needed.

2003-01-21 Thread Tim Ward
off the top of my head
SELECT risk_level, COUNT(risk_level) AS rl_count GROUP BY risk_level
should do it, though I'd have to experiment with what's inside the
COUNT().

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: [-^-!-%- [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 21, 2003 12:06 PM
Subject: [PHP] ADV SQL Help Needed.



 Hello everyone,

 I need help with the following query.

 I have a table with a column named 'RISK_LEVEL'.
 RISK_LEVEL can hold three values: Low, Moderate, and High.

 I need a query that counts the number of occurences of each option.
 Now, I know I can do

 'select count(risk_level) as levelCount where risk_level=low'

 for each level (low, moderate, and high). But, I was wondering if there's
 anyway to merge the queries into one.

 I'm looking for something like

 select count(risk_level='low') as lowCount,
count(risk_level='moderate')as
 modCount, count(risk_level='high') as highCount 

 Which will return, lowCount = 1 , modCount=3, and highCount=1, for table
 with

  id | risk_level
  1  | low
  2  | moderate
  3  | moderate
  4  | high
  5  | moderate

 How do you do it? Can tha be done?

 When I run the code above, I get the same number for each record. i.e.
 lowCount, modCount, and highCount all come out to 5--which is the number
 of records in the table.

 Is this possible, or should I just run multiple queries?
 Please help.


 =P e p i e  D e s i g n s
  www.pepiedesigns.com
  Providing Solutions That Increase Productivity

  Web Developement. Database. Hosting. Multimedia.




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




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




Re: [PHP] Error in variable when looping

2003-01-14 Thread Tim Ward
you're not differentiating between form elements on different rows.
all the hidden elements have the same name and are in the same
form so only the last one will be available as all the submit buttons
are in the same form.

you need to put form ../form tags around each submit/hidden
pair.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: menezesd [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 14, 2003 12:21 AM
Subject: [PHP] Error in variable when looping


 Hello friends,

 I have made the following table of data and a button on every row to view
the details. The code is working fine and the table is displayed with the
buttons.

 The problem I have is that the $SelectedItemNumber posted to the next page
remains the same number no matter which row button I click. I have my
relevant code below. Please help me. I know I am making a mistake somewhere
but I cannot figure out where.

 Quote :



le($row=mysql_fetch_array($result)){ 
 
 Print  tr ;
 Print td width=\12%\ align=\center\ height=\6\ bgcolor=\#bf\font 
face=\Tahoma\ color=\#00\ ;
 Print   b font size=\2\ color=\ff\ $row[OrgName] /b/font;
 print /font  nbsp;/td;
 Print td width=\12%\ align=\center\ height=\6\ bgcolor=\#bf\font 
size=\2\ face=\Tahoma\ color=\#00\ ;
 Print  $row[OrgCountry]; 
 print /font  nbsp;/td;
 Print td width=\12%\ align=\center\ height=\6\ bgcolor=\#bf\font 
size=\2\ face=\Tahoma\ color=\#00\ ;
 Print  $row[OrgNumber]; 
 print /font  nbsp;/td;
 Print td width=\12%\ align=\center\ height=\6\ bgcolor=\#bf\font 
size=\2\ face=\Tahoma\ color=\#00\ ;
 Print  $row[Orgaddress]; 
 print /font  nbsp;/td;
 Print td width=\12%\ align=\center\ height=\6\ bgcolor=\#bf\font 
size=\2\ face=\Tahoma\ color=\#
00\ ;
 Print  $row[OrgChief];
 print /font  nbsp;/td;
 Print td width=\12%\ align=\center\ height=\6\
bgcolor=\#b7b700\font size=\2\ face=\Tahoma\ color=\#00\ ;
 PrintINPUT TYPE=\submit\ value=\View details\ Name=\Details\;
 print /td;
 Printinput type=\hidden\ name=\SelectedItemNumber\ value= $row[Id];
   Print /tr;}
   }
 ?



 Unquote

 Thanks
 Denis

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




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




Re: [PHP] Weird Errors

2003-01-14 Thread Tim Ward
surely you can post the part of the code that checks 
the e-mail is blank or not?

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: Mike Bowers [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 14, 2003 12:04 AM
Subject: [PHP] Weird Errors


 The errors aren't actually generadted inside the PHP but the problem im
 having makes no sense to me.
 The pages validate.php feed out:
 Please veify below that all your details are correct. If there are any
 errors, they will be lsited first.
 Error 1: Primary e-mail address was left blank.
 Error 2: Please specify whether or not your license has ever been
 revoked.
 Fatal Error: You did not agree to the terms listed.
 Errors were found in your submission. Please use your bowsers back
 button to go back and fix them.
 There were 4 errors found.
 
 The problem lies within the fact that these errors are not actually
 being triggered. The errors are told to trigger if the field is left
 blank. The problem is are the field are not left blank. The form that
 feeds to the file is at http://www.skyfor.planetmodz.com/shsapp.html and
 the PHP  script is  http://www.skyfor.planetmodz.com/validate.php .. The
 text of both are too long to post in here. I checked myself to make sure
 the form fields line up. Could someone please try to see if they can
 figure out my error?
 
 Thanks in advace,
 
 Mike Bowers
 PlanetModz Gaming Network Webmaster
 [EMAIL PROTECTED]
 ViperWeb Hosting Server Manager
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 All outgoing messages scanned for viruses
 using Norton AV 2002
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] Error in variable when looping

2003-01-14 Thread Tim Ward
print form ...;
printINPUT TYPE='submit' value='View details' Name='Details';
printinput type='hidden' name='SelectedItemNumber' value='{$row[Id]}';
print /form;

you'll  then have as many forms as you have rows and which
one is submitted will depend on which button is pressed.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: Denis L. Menezes [EMAIL PROTECTED]
To: Tim Ward [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, January 14, 2003 11:50 AM
Subject: Re: [PHP] Error in variable when looping


 Hello Tim.

 Could you help me a little further and tell me exactly where to put this?

 Thanks
 Denis
 - Original Message -
 From: Tim Ward [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, January 14, 2003 5:16 PM
 Subject: Re: [PHP] Error in variable when looping


  you're not differentiating between form elements on different rows.
  all the hidden elements have the same name and are in the same
  form so only the last one will be available as all the submit buttons
  are in the same form.
 
  you need to put form ../form tags around each submit/hidden
  pair.
 
  Tim Ward
  http://www.chessish.com
  mailto:[EMAIL PROTECTED]
  - Original Message -
  From: menezesd [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, January 14, 2003 12:21 AM
  Subject: [PHP] Error in variable when looping
 
 
   Hello friends,
  
   I have made the following table of data and a button on every row to
 view
  the details. The code is working fine and the table is displayed with
the
  buttons.
  
   The problem I have is that the $SelectedItemNumber posted to the next
 page
  remains the same number no matter which row button I click. I have my
  relevant code below. Please help me. I know I am making a mistake
 somewhere
  but I cannot figure out where.
  
   Quote :
  
  
  
  le($row=mysql_fetch_array($result)){
  
   Print  tr ;
   Print td width=\12%\ align=\center\ height=\6\
 bgcolor=\#bf\font face=\Tahoma\ color=\#00\ ;
   Print   b font size=\2\ color=\ff\ $row[OrgName]
 /b/font;
   print /font  nbsp;/td;
   Print td width=\12%\ align=\center\ height=\6\
 bgcolor=\#bf\font size=\2\ face=\Tahoma\ color=\#00\ ;
   Print  $row[OrgCountry];
   print /font  nbsp;/td;
   Print td width=\12%\ align=\center\ height=\6\
 bgcolor=\#bf\font size=\2\ face=\Tahoma\ color=\#00\ ;
   Print  $row[OrgNumber];
   print /font  nbsp;/td;
   Print td width=\12%\ align=\center\ height=\6\
 bgcolor=\#bf\font size=\2\ face=\Tahoma\ color=\#00\ ;
   Print  $row[Orgaddress];
   print /font  nbsp;/td;
   Print td width=\12%\ align=\center\ height=\6\
 bgcolor=\#bf\font size=\2\ face=\Tahoma\ color=\#
  00\ ;
   Print  $row[OrgChief];
   print /font  nbsp;/td;
   Print td width=\12%\ align=\center\ height=\6\
  bgcolor=\#b7b700\font size=\2\ face=\Tahoma\ color=\#00\
;
   PrintINPUT TYPE=\submit\ value=\View details\
Name=\Details\;
   print /td;
   Printinput type=\hidden\ name=\SelectedItemNumber\ value=
 $row[Id];
 Print /tr;}
 }
   ?
  
  
  
   Unquote
  
   Thanks
   Denis
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  


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




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




Re: [PHP] dumb time question

2003-01-13 Thread Tim Ward
use the date() function, in this case date(i) and date(h) or date(H)

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: Pag [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, January 13, 2003 10:25 PM
Subject: [PHP] dumb time question



 Ok, this is going to be laughable, but here goes. I am looking at code too
 much to get this one:

 Have 2 text fields on a database called hours and minutes.
 How can i get the current time (hour-minutes) in two digit format and
 apply it to the two variables? Everything i do only gets one digit when
the
 minutes are between 00 and 10.
 I know its going to be stupid but anyway, could use your help, i cant see
 anything straight in this code anymore. :-P
 Sorry and thanks.

 Pag



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




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




Re: [PHP] checkboxes, radio buttons and $_POST['name']

2003-01-09 Thread Tim Ward
isset($_POST[chk1]) will only be true if the checkbox is checked.


Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: John-Erik Omland [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 09, 2003 6:25 PM
Subject: [PHP] checkboxes, radio buttons and $_POST['name']


Hi

HELP!!!

I have read through the manual about using $_POST['name'] to retrieve 
data from forms, but what happens when a form element is not filled in 
or checked?

If I have a checkbox on a form called chk1 I get an error from PHP 
when I try this:
$chk1 = $_POST['chk1'];  // error if user did not chech the checkbox on 
the form!!!

How do ya usefully retrieve the fact that a form element has not been 
filled in/checked?

Be Well,

John-Erik Omland



Rhythm is the basis of life,
 not steady forward progress.
The forces of creation,  destruction, and preservation
  have a whirling, dynamic interaction.
- Kabbalah



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




Re: [PHP] URL parsing

2002-12-18 Thread Tim Ward
you could use a combination of the string functions 
(strstr(), substr(), strpos()) or you could work out 
something with regular expressions.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: Mako Shark [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 18, 2002 2:39 PM
Subject: [PHP] URL parsing


 I've got a URL like this:
 
 http://www.naturalist.com/~fungae/index.php
 
 which is stored in $http_referer (as parse_url from
 $HTTP_REFERER).
 
 I'm trying to extract the username (~fungae). I've
 read the docs on parse_url(), and have tried to get
 $http_referer[user], but it comes up with zilch. I've
 also tried to print_r $http_referer, but I only get
 scheme, host, path, and query. Any ideas?
 
 __
 Do you Yahoo!?
 Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
 http://mailplus.yahoo.com
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] Use of undefined constant error

2002-12-17 Thread Tim Ward
you've got error reporting set pretty high to get that.
The correct way to reference an array element in this case
is $_GET[id], if you do $_GET[id] you are telling PHP
to look for a constant called id. If it doesn't find one then
it assumes you meant id onstead of id and proceeds 
accordingly. Thats why you can get away with not using the 
quote marks (as long as there's no white space in the string).

On a live site (and, I'd have thought, most default set-ups) 
you'd expect error reporting to be set all off and you'd 
never see the message.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: fragmonster [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, December 17, 2002 10:49 AM
Subject: [PHP] Use of undefined constant error


 Hello,
 I've got a strange pb. Here's my code
 
 ?
 if(isset($_GET[id])){
  do something...
 else
  do something else
 }
 ?
 
 When I call myfile.php or myfile.php?id=1 I've got an error message 
 Notice: Use of undefined constant id - assumed 'id' in ...
 
 Please help
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] key pairs

2002-12-17 Thread Tim Ward
1. Have an order_id on the first table (or a separate 
ORDER table) that is INT and AUTO_INCREMENT.
2. Have an order_id on the other table(s) that is INT but 
not AUTO_INCREMENT.
3. Create the record in the first table just inserting the info 
you get in.
4. get the order_id just created using mysql_insert_id().
5. insert the data into the other table(s) with this order_id().

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: Ashley M. Kirchner [EMAIL PROTECTED]
To: PHP-General List [EMAIL PROTECTED]
Sent: Tuesday, December 17, 2002 8:15 PM
Subject: [PHP] key pairs


 
 I have the following bit of information coming in that I need to 
 generate key pairs of so I can drop it all into a database.  I'm 
 creating tables for each section (SHIP_TO and BILL_TO) with matching 
 Unique_IDs.  What's the best way to go about this (creating the pairs, 
 stripping off excess spaces from some fields that have them after the 
 last character, etc., etc.)
 
 -- data --
   SHIP TO:
   Business Name:
   Contact Name: Ashley Kirchner
   Day Number:   303 442-6410
   Evening Number:
   Fax Number:
   Address:  3550 Arapahoe Ave., Ste. #6
   Address:
   Address:
   City: Boulder
   State/Province:   CO
   Zip/Postal Code:  80303
   Country:  USA
  
   BILL TO:
   Business Name:
   Contact Name: Ashley M. Kirchner
   Day Number:   303 4426410
   Evening Number:
   Fax Number:   303 442-9010
   Address:  3550 Arapahoe Avenue
   Address:  Suite #6
   Address:
   City: Boulder
   State/Province:   CO
   Zip/Postal Code:  80303
   Country:  USA
 --
 
 
 -- 
 W | I haven't lost my mind; it's backed up on tape somewhere.
   +
   Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
   IT Director / SysAdmin / WebSmith . 800.441.3873 x130
   Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
   http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] key pairs

2002-12-17 Thread Tim Ward
what do you mean by key pairs - I assumed you 
meant a key that could link the records in each table.
If you've already done that then what's the problem?

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: Ashley M. Kirchner [EMAIL PROTECTED]
To: Tim Ward [EMAIL PROTECTED]
Cc: PHP-General List [EMAIL PROTECTED]
Sent: Tuesday, December 17, 2002 8:25 PM
Subject: Re: [PHP] key pairs


 Tim Ward wrote:
 
 1. Have an order_id on the first table (or a separate 
 ORDER table) that is INT and AUTO_INCREMENT.
 2. Have an order_id on the other table(s) that is INT but 
 not AUTO_INCREMENT.
 3. Create the record in the first table just inserting the info 
 you get in.
 4. get the order_id just created using mysql_insert_id().
 5. insert the data into the other table(s) with this order_id().
   
 
 Thanks, but that wasn't the question - I know this part. :)
 
 I need a routine to run through the data and generate the key pairs 
 for insertion in the DB.
 
 -- 
 W | I haven't lost my mind; it's backed up on tape somewhere.
   +
   Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
   IT Director / SysAdmin / WebSmith . 800.441.3873 x130
   Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
   http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.
 
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] nested if in a for statement

2002-12-17 Thread Tim Ward
looks ok as long as you are really testing what
you mean to. As you've written it if any of the variables
are an empty string, zero, logical false or not set then
the if statement will be true.

what is $auth?

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: James Brennan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, December 17, 2002 9:03 PM
Subject: [PHP] nested if in a for statement


 I am checking the values of a submited forms for empty fields with the
code
 below. My problem is that the echo statement is being executed once
 regardless of whether or not the if statement is true. What am I missing?

 thanks,
 loopjunkie

  snip 
 /* variables in array set earlier in script */
 $userVars = array($nameFirst, $nameLast, $pass, $pass2, $auth, $dob_year,
 $dob_month, $dob_day);

 for ($i=0; $i = count($userVars); $i++) {
 if (empty($userVars[$i])) {
 echo please enter all required info;
 break;
 }
 }
 --- snip 


 _
 Add photos to your messages with MSN 8. Get 2 months FREE*.
 http://join.msn.com/?page=features/featuredemail


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




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




Re: [PHP] Update query

2002-12-12 Thread Tim Ward
The best way would be to design the table so that it had an
item_id field that was an auto-incremented integer and not
updateable. It shouldn't be too late to add such a field, then it
can be passed from the form as a hidden field (as I assume
you're currently doing with $oldItemCode).

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: Steve Jackson [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Thursday, December 12, 2002 9:00 AM
Subject: [PHP] Update query


 How do you update MySQL in the following way?
 I have designed a form which has all the fields in the database
 available to edit based on a user query. The query is a field called
 $ItemCode.
 
 If the user wants to change that $ItemCode field how do I update it? In
 other words how do I use PHP to update the database row called $ItemCode
 with a new $ItemCode where $ItemCode is $ItemCode?
 
 Here is what I've tried and failed at!
 $oldItemCode = $ItemCode;
 $query = update products
  set ItemCode='$newItemCode',
  ItemName ='$ItemName',
  catid = '$catid',
  price = '$price',
  description = '$description'
 shortdesc = '$shortdesc'
  where ItemCode='$oldItemCode';
 
 Steve Jackson
 Web Developer
 Viola Systems Ltd.
 http://www.violasystems.com
 [EMAIL PROTECTED]
 Mobile +358 50 343 5159
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] Returning multiple values from function

2002-12-12 Thread Tim Ward
you can always return an array of arrays ...
return array($array1, $array2, ...);

but in your case why not make the column names
the array keys so the one array holds both column
names and types.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: Lisi [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 12, 2002 9:34 AM
Subject: [PHP] Returning multiple values from function


 Is it possible to return multiple values from a function?

 I have a function that queries a MySQL database for column names (SHOW
 COLUMNS) and then I go through the values return and create two arrays -
 one containing column names and one containing column types.

 Is it possible to return two arrays, or do I have to combine them somehow
 and then separate afterwards? Is there another way to do this?

 The code works fine when used regularly but I need to put it into a
 function so I can reuse it in more than one page.

 Thanks,

 -Lisi


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




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




Re: [PHP] How do I populate a select?

2002-12-10 Thread Tim Ward
echo(select name='...')
while ($array = mysql_fetcharray($mysql))
{echo(option{$array[catname]}/option);
}
echo(/select)

that's the simple version - you may want to put the
whole lot inside ...
if (mysql_numrows())
{ ...
} else
{echo(warning);
}

I may have got the function names wrong - I use an
abstraction layer these days

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: Steve Jackson [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Tuesday, December 10, 2002 3:24 PM
Subject: [PHP] How do I populate a select?


 How do I populate a select list with a list of category names from a DB?
 I can select the names using a query but how do I loop through them to
 display them in a select?
 
 My query below will return the cat names. (when I  do something with it
 like echoing the result)
 
 $mysql = mysql_query(SELECT catname FROM categories ORDER BY catid);
 
 But I want to give each catname in the DB a unique name in a form select
 and don't know how to go about it.
 Tutorials or tips anyone?
 Regards,
 
 Steve Jackson
 Web Developer
 Viola Systems Ltd.
 http://www.violasystems.com
 [EMAIL PROTECTED]
 Mobile +358 50 343 5159
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] fopen have a setTimeout feature?

2002-12-08 Thread Tim Ward
how about something like...

$start = time();
$timeout = 60; // number of seconds to try
while (!$file = fopen(...)  time()  $start + $timeout);
if ($file)
{   // do stuff with file
}

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: Phil Powell [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, December 08, 2002 7:32 PM
Subject: [PHP] fopen have a setTimeout feature?


Can you set something like a setTimeout feature in fopen? That is, if you
use fopen to open a URL for scraping, if that URL's server is down or
doesn't respond in x seconds, can you set a feature to show an error message
or a friendly error message indicating such?

Thanx
Phil



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




Re: [PHP] Hiding URL Variable

2002-12-08 Thread Tim Ward
store them in a session or cookie

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: Stephen [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Sunday, December 08, 2002 8:10 PM
Subject: [PHP] Hiding URL Variable


 How can you hide URL variables without using the POST method in a form?

 Thanks,
 Stephen Craton
 http://www.melchior.us

 What is a dreamer that cannot persevere? -- http://www.melchior.us







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


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




Re: [PHP] Simple text editor for Windows?

2002-12-07 Thread Tim Ward
I like arachnophilia.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: John W. Holmes [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, December 07, 2002 4:11 PM
Subject: [PHP] Simple text editor for Windows?


 I know the text editor question has been beat to death, but I'm looking
 for a simple editor with syntax highlighting that can be installed in
 Windows by a general user. It would have to be something that didn't
 access the registry, as normal users can't do that. Does anyone know of
 a program like this? Thanks.
 
 ---John Holmes...
 
 PS: Yes, I already know what program you use and it's the best and I use
 it every day to... does it answer the question above?? ;)
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] Output of MySQl sorted query to text or Word file.

2002-12-06 Thread Tim Ward
everything you need is here

http://www.php.net/manual/en/ref.filesystem.php

in particular fopen(), fputs(), fwrite(), etc.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, December 06, 2002 1:25 PM
Subject: [PHP] Output of MySQl sorted query to text or Word file.


 
 I've got a routine that queries a MySQL database and outputs the sorted
 results to a web page (script snippet below.) How can I output the exact
 same thing to a txt file using this script?
 
 ?
 
 $count = 0;
 
 $result = mysql_query (SELECT * FROM listings ORDER by a
 DESC);
 
 if ($row = mysql_fetch_array($result)) { 
 
 do { ?
 
 
 ? echo $row['company_name']; ?
 nbsp;nbsp;
 ? echo $row['agent_name']; ?
 nbsp;nbsp;
 ? echo $row['county']; ?
 nbsp;nbsp;
 ? echo $row['city']; ?
 br
 ? echo $row['mls']; ?
 nbsp;nbsp;
 $? echo number_format($row['price'], ,); ?
 nbsp;nbsp;
 ? echo $row['area']; ?
 br
 ? echo $row['copy']; ?
 br
 ? echo $row['agent_name']; ?
 p
 
 ?
 $count++;
 
 if ($count == 8) {
 
 echo hrbPage Break/bhrp;
 $count = 0;
 }
 
 }
 
 while($row = mysql_fetch_array($result));
 
 mysql_close(); } ?
 
 Thanks in advance for any ideas
 
 Ed
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] More $_ array question...

2002-12-06 Thread Tim Ward
not quite ... 
if the form elements are (e.g) input name='array[0]' ..., etc.
then you need $_POST[array][0] to refer to the element
(just like any other array of arrays in PHP).

but you're right about count($_POST[array]) ...
and foreach ($_POST[array] as $key=$value), etc.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: Mako Shark [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, December 06, 2002 5:03 PM
Subject: [PHP] More $_ array question...


 If I want to access an array of something from a form,
 is it true that I just have to use
 $_POST[array[$counter]? So I can legitimately do a
 count() of this array, like count($_POST[array])?
 
 __
 Do you Yahoo!?
 Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
 http://mailplus.yahoo.com
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




Re: [PHP] A small problem with input feilds.

2002-12-05 Thread Tim Ward
only checked checkboxes are submitted therefore you have to number
the form fields if you want to keep the relationship between the arrays
- this should be easy enough if the form is generated by your code.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: Mike [EMAIL PROTECTED]
To: php mailinglist [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 5:59 PM
Subject: [PHP] A small problem with input feilds.


 Hello everyone,
 I have the following html code that is generated via a script:

 table
  form action=/new/mp3/stuff/testsearch.php method=post target=

 trtdbArtist/b/tdtdbTitle/b/tdtdbFile
 Size/b/tdtdCheck/td/tr
  tr
   td width=295 valign=top
pb Dj Ummet/b/p
   /td
   td width=195 valign=top
pbPump This Party (extended Mix)/b
   /td
td width = 195 valign = top
bAbout 4.5 megabytes/b/p
   /td
   td valign=topinput type=checkbox name=file[]
 value=%28Dj+Ummet%29+-+Pump+This+Party+%28Extended+Mix%29.mp3
input type=hidden name=filenumber[] value=3437
   /td
  /tr
 /tr
  tr
   td width=295 valign=top
pb Metalica/b/p
   /td
   td width=195 valign=top
pbEnter Sandman/b
   /td
td width = 195 valign = top
bAbout 4.43 megabytes/b/p
   /td
   td valign=topinput type=checkbox name=file[]
 value=%28Metalica%29+-+Enter+Sandman.mp3
input type=hidden name=filenumber[] value=986
   /td
  /tr
 /tr
  tr
   td width=295 valign=top
pb Metalica/b/p
   /td
   td width=195 valign=top
pbThe Memory Remains/b
   /td
td width = 195 valign = top
bAbout 4.24 megabytes/b/p
   /td
   td valign=topinput type=checkbox name=file[]
 value=%28Metalica%29+-+The+Memory+Remains.mp3
input type=hidden name=filenumber[] value=2331
   /td
  /tr
 /tr
  tr
   td width=295 valign=top
pb Metallica/b/p
   /td
   td width=195 valign=top
pbBattery/b
   /td
td width = 195 valign = top
bAbout 4.77 megabytes/b/p
   /td
   td valign=topinput type=checkbox name=file[]
 value=%28Metallica%29+-+Battery.mp3
input type=hidden name=filenumber[] value=2136
   /td
  /tr
 /tr
 /table
 input type=submit name=submit value=submit
 /form

 the problem is this:
 Array
 (
 [filenumber] = Array
 (
 [0] = 3437
 [1] = 986
 [2] = 2331
 [3] = 2136
 )

 [file] = Array
 (
 [0] = %28Metalica%29+-+Enter+Sandman.mp3
 [1] = %28Metallica%29+-+Battery.mp3
 )

 when I submit the form, I get the whole array of filenumber but only the
 selected files. Is there a way that I could limit it so that I get only
the
 selected filenumbers and files, or should I re-think the way the script
 works?

 Thank you,
 Mike


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




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




[PHP] RE: OOP-classes in PHP

2002-11-18 Thread Tim Ward
you can't access $overall-foo because you've never defined it
you need:

function load($class){
eval(\$this-$class = new $class;);
return true;
}

Tim

 -Original Message-
 From: Tularis [mailto:[EMAIL PROTECTED]]
 Sent: 17 November 2002 22:21
 To: [EMAIL PROTECTED]
 Subject: OOP-classes in PHP
 
 
 currently I have the followig script:
 
 everything works fine, except for the fact that it doesn't seem to 
 understand $overall-foo-foo();. It returns this error:
 Fatal error: Call to a member function on a non-object in 
 d:\apache\htdocs\classes.php on line 32
 
 Now, I know the object is loaded, because the constructor is run, and 
 puts out a 1 onscreen... I wish to know how to make this work...
 any help plz?
 
 thanx
 - Tularis
 ?php
 
 class overall {
   var $loaded;
   
   function load($class){
   eval(\$$class = new $class;);
   return true;
   }
 }
 
 class foo {
   var $bar;
 
   // Constructor
   function foo(){
   if(!isset($this-bar)){
   $this-bar = 1;
   }else{
   $this-bar++;
   }
   echo $this-bar.br;
   }
 }
 
 // Start actual loading
 $overall = new overall;
 $overall-load('foo');
 
 // As of here it won't work anymore... somehow 
 $overall-foo- doesn't 
 work...
 
 $overall-foo-foo();
 ?
 
 (and if possible, I would also like to change $overall-foo-foo() to 
 $foo-foo(), but still keeping that class as a 'subclass' to 
 the overall 
 one.)
 
 

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




[PHP] RE: Problem with Class - incomplete object error

2002-11-18 Thread Tim Ward
you've included the class definition at the top of every page, right?

and why don't you just use $_SESSION[cart] directly instead of using
$cart?
that way you don't have to worry about scoping issues and continually
passing $cart through to functions.

Tim

 -Original Message-
 From: Paul [mailto:[EMAIL PROTECTED]]
 Sent: 18 November 2002 02:59
 To: [EMAIL PROTECTED]
 Subject: Problem with Class - incomplete object error
 
 
 Hi All:
 
 I have a simple page that checks for existence of object in a session.
 If the object is not stored in session object, it creates new one:
 
 If (isset ($_SESSION[cart])) {
   $cart=$_SESSION[cart];
   } else {
   $cart = new ShoppingCart ();
   $_SESSION[cart]= $cart;
   }   
 
 So the object cart is available in every page. At this point 
 the cart is
 a simple class:
 
 class ShoppingCart {
   
   var $items = array();
 
   function AddItem ($item){
   if ($this-items[$item]) {
   $this-items[$item]=$this-items[$item]+1;
   } else { 
   $this-items[$item]=1;
   }   
   } // additem
 }
 
 So the cart is either retrieved from the session or created (if non
 existent), however, every time the script calls :
 $cart-AddItem($_GET['item_id']);
 
 I get the following error:
 Fatal error: The script tried to execute a method or access a property
 of an incomplete object. Please ensure that the class definition
 shoppingcart of the object you are trying to operate on was loaded
 _before_ the session was started in  on line 59
 
 Where line 59 is pointing to $cart-AddItem($_GET['item_id'])
 
 Session_start is present in every page.
 
 Could anyone help me understand where the problem is? 
 
 Thanks
 Paul
 
 
 

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




[PHP] RE: newbie: php/mysql

2002-10-28 Thread Tim Ward
the best way to do password validation is using one way encryption (e.g.
MySQL PASSWORD() function). That way you check the encrypted user entered
password against the database ...

 ... WHERE pass = PASSWORD('{$_POST[password]}')

Tim Ward
www.chessish.com


 -Original Message-
 From: Mr. BuNgL3 [mailto:mrbungle;netcabo.pt]
 Sent: 27 October 2002 10:51
 To: [EMAIL PROTECTED]
 Subject: newbie: php/mysql
 
 
 Hey...
 I have a little problem... i want to read an encrypted field 
 from mysql
 database to a php variable... what is the code line that i 
 must enter? (ex:
 password validation in a login form)
 Thanks...
 
 
 

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




[PHP] RE: No ouput until program end, why?

2002-10-04 Thread Tim Ward

does output buffering not work with command line PHP?
http://www.php.net/manual/en/ref.outcontrol.php

Tim Ward
www.chessish.com

 -Original Message-
 From: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]]
 Sent: 04 October 2002 05:59
 To: [EMAIL PROTECTED]
 Subject: No ouput until program end, why?
 
 
 I am running a PHP program under Linux on the command line. 
 The problem 
 I have is that I get no output to the screen until the 
 program finishes.
 
 I have lots of echo statements throughout the program to help 
 me debug 
 but none of them are printed until the program finishes, 
 which is really 
 a pain since the prog takes 30 minutes to run ...
 
 The main() looks something like this. Can someone help me 
 figure out why 
 it is not printing anything until the program exists?
 
 pg_exec($CONN, BEGIN);
 for ($i = 0; $i  6001; $i++) {
$retval = process($aFields);
if ( ($i % 100) == 0 ) echo $i\n;
if ($retval == 1) echo error on line $i \n;
 }
 
 echo COMMIT \n;
 pg_exec($CONN, COMMIT);
 
 Thanks,
 
 Jc
 
 

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




[PHP] RE: Incrementing the value

2002-10-03 Thread Tim Ward

I think you mean ++$hid, otherwise the value is inserted before it is
incremented,
and why not change to $_GET[hid] for future compatibility and just to make
sure.
Are there any scoping issues we don't know about, e.g. is this snippet
within a function?

Tim Ward
www.chessish.com

 -Original Message-
 From: Jason Young [mailto:[EMAIL PROTECTED]]
 Sent: 03 October 2002 05:15
 To: [EMAIL PROTECTED]
 Subject: Re: Incrementing the value 
 
 
 Try $hid++;
 
 This automatically increments by one, its just much easier to 
 deal with 
 than +1 .. besides, it wouldn't work on my Win32 platform, either.
 
 --Jason
 
 Uma Shankari T. wrote:
   Hello ,
  
   a href=Delay.php?hid=?php echo $hid+1; ?img 
 src=Gif/nextque.gif
   border=0/a
  
   While clicking this link the $hid value get incremented 
 and fetch the value
   from the database according to that..the same thing is 
 working in linux
   platform and it is not working for the windows 
 platform..the value is not
   getting increment..Can anyone please tell me how to go 
 about with this..??
  
   Regards,
   Uma
  
 
 

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




[PHP] RE: local resource variables

2002-09-26 Thread Tim Ward

to test this try returning $result from the function
e.g.
function test()
{
   $result = mysql_query(SELECT * FROM bigbigtable);
   return $result;
}
echo(mysql_numrows(test()))

remember $result holds a number that is a pointer to the result set
resource, it isn't the actual result data set, if the memory hasn't been
freed you should still be able to get to it ... I think

Tim
www.chessish.com

 -Original Message-
 From: lallous [mailto:[EMAIL PROTECTED]]
 Sent: 26 September 2002 11:20
 To: [EMAIL PROTECTED]
 Subject: local resource variables
 
 
 Hello,
 
 
 I was wondering if i do:
 
 function test()
 {
   $result = mysql_query(SELECT * FROM bigbigtable);
 }
 
 after calling test() will  $result be freed as if calling
 mysql_free_result()?
 
 
 Elias
 
 
 

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




[PHP] RE: PHP Form and Arrays help

2002-09-25 Thread Tim Ward

use a hidden input in front of each checkbox with the same name and
the value '0' (as opposed to '1' for the checkbox).

Tim
www.chessish.com

 -Original Message-
 From: Tom Ray [mailto:[EMAIL PROTECTED]]
 Sent: 24 September 2002 17:24
 To: [EMAIL PROTECTED]
 Subject: PHP Form and Arrays help
 
 
 I'm having a small problem with a form I'm designing and I 
 hope someone can
 point me in the right direction here. The form's function is 
 rather simple
 actaully. It's supposed to take the information, run through 
 it to make sure
 all the required fields have data in them, if there is a 
 blank required field
 it is supposed to redraw the form showing the field missed 
 but also store the
 data that was already submitted so you don't have to fill the 
 form out all over
 again. Now I have it so it stores the values of text boxes, 
 drop down menus and
 radio buttons but I'm having a real tough time with the check 
 box values.
 Example of what I'm doing: (Gender Selection with Radio Buttons). 
 
 I declare an array in my PHP by doing 
 $genderarray=array();
 
 Then I store the value of the form for the redraw like so:
 $mygender=$HTTP_POST_VARS[gender];
 $genderarray[$mygender]=checked;
 
 In the actaul form I decalre a global:
 global genderarray();
 
 And under the gender selection I have:
 input name=gender type=radio value=Male ?= 
 $genderarray[Male] ? 
 (works the same for the Female)
 
 
 Now my question is how can I do this with check boxes. I 
 thought I could
 through them all into a single array, then pull out the ones 
 who have values to
 them, but that's not working the way I thought.
 
 Any thoughts or suggestions?
 
 

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




[PHP] RE: Maybe a stupid question but can it be done?

2002-09-24 Thread Tim Ward

the ID field in the first table can be an auto-increment field and 
the second table needs to have an ID INT field that is not auto increment.
Insert into the first table, use mysql_insert_id() (or whatever it is) to
get the auto incremented value and then do your second insert using that
value for the ID field.

Tim
www.chessish.com

 -Original Message-
 From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]]
 Sent: 24 September 2002 02:45
 To: PHP General
 Subject: Maybe a stupid question but can it be done?
 
 
 Ok, Let's try this again, for some reason this didn't post 
 from early today.
 
 I have db that has two tables that I am needing to post the 
 same information
 into both tables, I can't use ID. So I am want to see if 
 there is a sql
 statement that will let me or how I can do with a php page.
 
 I am sorry to ask, I have looked around to see if there any 
 on the net or in
 my mysql and php books but this seems like a weird task.
 
 Chuck Payne
 Magi Design and Support
 
 

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




[PHP] RE: Update undefined List Values in DB

2002-09-23 Thread Tim Ward

make your checkboxes in the form an array with the index being the customer
id.

e.g.

in the form ...
foreach($customers as $cust)
{   echo(tr);
...
echo(input type='hidden' name='status[{$cust[id]}]'
value='0');
echo(input type='checkbox' name='status[{$cust[id]}]');
if ($cust[status]) echo( checked);
echo();
...
echo(/tr);
}

and when processing
foreach($_POST[status] as $custid=status)
{   ... // update query for each customer
}

Tim
www.chessish.com

 -Original Message-
 From: Sascha Braun [mailto:[EMAIL PROTECTED]]
 Sent: 22 September 2002 18:43
 To: PHP Mailingliste
 Subject: Update undefined List Values in DB
 
 
 Hi,
 
 I am creating a kind of Shopsystem right now.
 
 One of the Funktions is going to be the possibiliy that the 
 page admin can set an customer status to 1 or 0
 via an listing of all customers.
 
 My Problem is, that I have to change more than one value at a 
 time due to the Listing, where all
 customers are listed in one big list.
 
 So I have to write multiple values in to the database as Update.
 
 I don't have a clue how to do this, the only thing i could do is
 to make the change possible via an extrapage per customer,
 but I'm not able to change all values at a time.
 
 Would be nice if somebody would give me a hint.
 
 Please excuse my english
 
 Sascha Braun
 

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




[PHP] RE: redefining a function

2002-09-20 Thread Tim Ward

how about
http://www.php.net/manual/en/language.oop.php

To be honest I can't remember what made classes
first click for me but feel free to ask if there's
anything there that you don't get.

Classes and OOP seem self evident when you've been 
using them for a while but I seem to remember that that
isn't always the case at first.


Tim

 -Original Message-
 From: David T-G [mailto:[EMAIL PROTECTED]]
 Sent: 19 September 2002 17:13
 To: PHP General list
 Cc: Tim Ward
 Subject: Re: redefining a function
 
 
 Tim, et al --
 
 ...and then Tim Ward said...
 % 
 % is using classes an option?
 
 I don't know.  I suppose I need to learn about classes :-)  Where do I
 start?
 
 
 % 
 % Tim Ward
 % www.chessish.com
 
 
 TIA  HAND
 
 :-D
 -- 
 David T-G  * It's easier to fight for 
 one's principles
 (play) [EMAIL PROTECTED] * than to live up to them. -- 
 fortune cookie
 (work) [EMAIL PROTECTED]
 http://www.justpickone.org/davidtg/Shpx gur 
 Pbzzhavpngvbaf Qrprapl Npg!
 
 

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




[PHP] RE: PHP source code

2002-09-20 Thread Tim Ward

then keep this info in a config file off root and
use a data abstraction class to connect.

Tim
www.chessish.com

 -Original Message-
 From: Oliver Witt [mailto:[EMAIL PROTECTED]]
 Sent: 19 September 2002 19:15
 To: [EMAIL PROTECTED]; Stephan Seidt
 Subject: Re: PHP source code
 
 
 Stephan Seidt schrieb:
 
  On Thu, 19 Sep 2002 16:50:16 +0200
  [EMAIL PROTECTED] (Oliver Witt) wrote:
 
   Hi,
   Is there any way to read php source code? I didn't think 
 so until I
   heard about people you have done that...
   Kind regards,
   Oliver
  
 
  If you mean php's source, download it ;)
 
 Well, but if I write a script with MySQl, there has to be my user name
 and password in the source code. If anybody could read it, 
 anybody could
 have access to my databases!
 Oliver
 
 
 
 

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




[PHP] RE: How to approach a new project?

2002-09-19 Thread Tim Ward

first thing is get the data structure right - third normal 
form at least.

table1:
date
group

table2:
group
exercise
weight
reps

or something like that.
get the data model right and reports and input forms write 
themselves, get the structure wrong and everything becomes 
really difficult.

there's lots of stuff out there for graphs in gdlib using 
php (providing you've got it installed).

I think this is a pretty good sort of project to start with, 
but are you new to PHP or programming? If you're relatively 
new to programming then that will be the thing you need to
learn - not PHP.

Tim Ward
www.chessish.com



 -Original Message-
 From: Wm [mailto:[EMAIL PROTECTED]]
 Sent: 18 September 2002 23:25
 To: [EMAIL PROTECTED]
 Subject: How to approach a new project?
 
 
 I'm trying to work out the best way to approach a new 
 project, and would
 appreciate any suggestions/beware ofs from the experienced 
 PHPers out
 there.  I want to build a project where I can enter data from 
 a gym routine
 online and generate graphs of the data.  I'm not familiar 
 with GDLIB, but is
 this something that can help generate a graph from mySQL 
 data?  Is this
 project feasible/realistic for a new PHP programmer?
 
 Also, any suggestions on the structure of the mySQL database would be
 appreciated.  The general data that would need to be input would be:
 
 Date
 Group
 Exercise1
 Ex1Weight
 Ex1Reps
 Ex2Weight
 Ex2Reps
 Ex3Weight
 Ex3Reps
 Exercise2
 Ex1Weight
 Ex1Reps
 Ex2Weight
 Ex2Reps
 Ex3Weight
 Ex3Reps
 etc...
 
 Plus several calculations would need to be made, which I 
 could presumably do
 with PHP when I extract the data.
 
 Any/all suggestions on how to plan this process would be greatly
 appreciated!  I'm hoping to have a sound game plan for beginning this
 process.
 
 Thanx!
 Wm
 luvs2shootAThotmailDOTcom
 
 
 
 
 

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




[PHP] RE: use of mysql_free_result (was Re: [PHP] Efficiency)

2002-09-19 Thread Tim Ward

if your query is within a loop then it would probably help, e.g.

for ($i = 1; $i = 1000; $i++)
{   $result = mysql_query(...);
...
}

in this case as $result is a resource identifier then reusing
it doesn't release the original result.

Tim Ward
www.chessish.com


 -Original Message-
 From: Support @ Fourthrealm.com [mailto:[EMAIL PROTECTED]]
 Sent: 19 September 2002 01:18
 To: [EMAIL PROTECTED]
 Subject: use of mysql_free_result (was Re: [PHP] Efficiency)
 
 
 Rick, or anyone,
 
 Based on what you said below, can you describe for me when the 
 mysql_free_result tag should be used, and when it is not necessary?
 
 I'm fluent in other web languages (iHTML, ASP), but am fairly 
 new to PHP, 
 so I'm still learning the intricacies of the language, and 
 the best way to 
 use it
 
 Many thanks,
 Peter
 
 
 
 At 04:02 PM 9/18/2002 -0600, you wrote:
 If you aren't doing anything else in a script, 
 mysql_free_result is not needed
 in a script like this because the result set will be cleaned 
 up by PHP when
 the script ends.
 
 - - - - - - - - - - - - - - - - - - - - -
 Fourth Realm Solutions
 [EMAIL PROTECTED]
 http://www.fourthrealm.com
 Tel: 519-739-1652
 - - - - - - - - - - - - - - - - - - - - -
 
 

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




[PHP] RE: redefining a function

2002-09-19 Thread Tim Ward

is using classes an option?


Tim Ward
www.chessish.com



 -Original Message-
 From: David T-G [mailto:[EMAIL PROTECTED]]
 Sent: 19 September 2002 04:54
 To: PHP General list
 Subject: redefining a function
 
 
 Hi, all --
 
 Is there any way to redefine or undefine (to then redefine) a 
 function?
 We have an image handling function, for instance, and would 
 like to let
 our users put in their own definition instead.  I haven't yet found
 anything that will allow this...
 
 
 TIA  HAND
 
 :-D
 -- 
 David T-G  * It's easier to fight for 
 one's principles
 (play) [EMAIL PROTECTED] * than to live up to them. -- 
 fortune cookie
 (work) [EMAIL PROTECTED]
 http://www.justpickone.org/davidtg/Shpx gur 
 Pbzzhavpngvbaf Qrprapl Npg!
 
 

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




[PHP] RE: Pass array in HTTP_POST_VARS question

2002-09-04 Thread Tim Ward

you just name the form elements as array elements, e.g. with explicit keys
name='array[0]'   name='array[1]'   etc.
or allowing php to assign the keys
name='array[]'   name='array[]'   etc.  

then the array is an element of $HTTP_POST_VARS[] when the form is posted

Tim Ward
www.chessish.com

 -Original Message-
 From: Paul Maine [mailto:[EMAIL PROTECTED]]
 Sent: 04 September 2002 03:25
 To: PHP PHP
 Subject: Pass array in HTTP_POST_VARS question
 
 
 Is it possible to pass an array in a form post? If so, how do 
 I reference
 the array on the next page?
 
 Thank You
 Paul
 php
 
 

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




[PHP] RE: PHP checkbox/hidden field question

2002-09-02 Thread Tim Ward

you need to define the key for checkbox arrays in order to distinguish them
(as only the checked ones will be posted)..
something like ...

tdinput type=checkbox name=d_c_arr[?php echo($count++); ?]/td


Tim Ward
www.chessish.com

 -Original Message-
 From: Paul Maine [mailto:[EMAIL PROTECTED]]
 Sent: 02 September 2002 00:56
 To: PHP PHP
 Subject: PHP checkbox/hidden field question
 
 
 I am executing the follwoing statement as part of a while 
 loop. This is
 part of a form and I wish to pass the name and value of the 
 checkbox as a
 hidden field only is the checkbox is checked. Can you suggest 
 how I can
 accomplish this task?
 
 
 tdinput type=checkbox name=d_c_arr[] value=?php echo
 $db-f(order_id) ?/td
 
 Thank You
 Paul
 php
 
 

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




[PHP] RE: array_unique multi-dimensional arrays

2002-08-20 Thread Tim Ward

array_unique tests the values of each element of the top level array - which
are all 'array' - hence you only get one element left

the way I'd do this is ...
$archive_nav[$year/$month] = array(month = $month, year = $year,
longmonth = $longmonth);

this will prevent duplicate combinations of month and year (and,
incidentally, allow you to sort on year and month very easily).

Tim Ward
www.chessish.com

 -Original Message-
 From: sasha [mailto:[EMAIL PROTECTED]]
 Sent: 19 August 2002 19:10
 To: [EMAIL PROTECTED]
 Subject: array_unique  multi-dimensional arrays
 
 
 I am trying to clean up some junky code in a journal/news type 
 script and redoing the archive navigation.  I am pulling all of 
 the dates of the entries and pushing it into a multi-
 dimensional array like so:
 
 array_push($archive_nav, array(month = $month, year = $year, 
 longmonth = $longmonth));
 
 I assumed I could just use array_unique to filter out all of 
 the duplicates in the array.  But it doesn't seem to work that 
 way, and the only month/year combo I end up with is the very 
 oldest one (according to year/month) in the array.
 
 $archive_nav = array_unique($archive_nav);
 
 If I leave out array_unique, I am getting all of the 
 appropriate month/year combos in my script while doing a 
 foreach... just one for every single entry in the database for 
 that combo (which is a lot in some cases!).
 
 Is there a better way to do this?
 
 sasha
 
 
 

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




[PHP] RE: RE: array_unique multi-dimensional arrays

2002-08-20 Thread Tim Ward

Sasha ... I'm sending this again to the list as it seemed to bounce from
your address

the way I was doing it prevents unique values from being created in the
first place. The only array that gets overwritten is one that would be the
same any way

while ($row = mysql_fetch_array($result))
{   $month = date(m, $row['timestamp']);
$year = date(Y, $row['timestamp']);
$archive_date = mktime(1,1,1,$month,1,$year);

$archive_nav[$archive_date] = $archive_date;
}

... ensures that if the date has already been added to the array then it
overwrites the existing one instead of adding a new element.

Tim Ward


 -Original Message-
 From: sasha [mailto:[EMAIL PROTECTED]]
 Sent: 20 August 2002 14:36
 To: Tim Ward
 Subject: Re: RE: array_unique  multi-dimensional arrays
 
 
 It may just have been that I was not putting your 
 sample code in the right location...  I had ended up 
 doing it differently than I originally intended:
 
 while ($row = mysql_fetch_array($result)) {
   $month = date(m, $row['timestamp']);
   $year = date(Y, $row['timestamp']);
   $archive_date = mktime(1,1,1,$month,1,$year);
   
   array_push($archive_nav, $archive_date);
 }
 $archive_nav = array_values(array_unique
 ($archive_nav));
 
 And then later on, I do a date check on the new 
 timestamp to get the month/year/longmonth out of it.  
 Only 3 extra lines of code this way.
 
 I don't understand exactly how your code works.  If I 
 do it inside of the while loop, it would overwrite the 
 previous contents of the array (unless I did a '.=', 
 instead of just '=').  So when I tried doing it 
 outside of the loop, all I ended up with was nothing.
 
 thanks
 sasha
 
 8/20/2002 3:58:01 AM, Tim Ward 
 [EMAIL PROTECTED] wrote:
 
 array_unique tests the values of each element of the 
 top level array - which
 are all 'array' - hence you only get one element left
 
 the way I'd do this is ...
 $archive_nav[$year/$month] = array(month = $month, 
 year = $year,
 longmonth = $longmonth);
 
 this will prevent duplicate combinations of month and 
 year (and,
 incidentally, allow you to sort on year and month 
 very easily).
 
 Tim Ward
 www.chessish.com
 
  -Original Message-
  From: sasha [mailto:[EMAIL PROTECTED]]
  Sent: 19 August 2002 19:10
  To: [EMAIL PROTECTED]
  Subject: array_unique  multi-dimensional arrays
  
  
  I am trying to clean up some junky code in a 
 journal/news type 
  script and redoing the archive navigation.  I am 
 pulling all of 
  the dates of the entries and pushing it into a 
 multi-
  dimensional array like so:
  
  array_push($archive_nav, array(month = $month, 
 year = $year, 
  longmonth = $longmonth));
  
  I assumed I could just use array_unique to filter 
 out all of 
  the duplicates in the array.  But it doesn't seem 
 to work that 
  way, and the only month/year combo I end up with is 
 the very 
  oldest one (according to year/month) in the array.
  
  $archive_nav = array_unique($archive_nav);
  
  If I leave out array_unique, I am getting all of 
 the 
  appropriate month/year combos in my script while 
 doing a 
  foreach... just one for every single entry in the 
 database for 
  that combo (which is a lot in some cases!).
  
  Is there a better way to do this?
  
  sasha
  
  
  
 
 
 
 

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




[PHP] RE: sessions don't work

2002-08-16 Thread Tim Ward

why do you think the session isn't working? If there is a run time error in
'file' then an error would be reported and the output terminated. If you
have error reporting off then you would expect to get eactly what you see.
Sounds like a problem inside 'file'.


Tim Ward
St Ives Direct

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html 



 -Original Message-
 From: Félix García Renedo [mailto:[EMAIL PROTECTED]]
 Sent: 16 August 2002 08:51
 To: php
 Subject: sessions don't work 
 
 
 Hello,
 I have a problem with php sessions. 
 I have a php file like:
 
 ?
 session_start();
 session_register('pagina');
 ?
 html
 head
 ...
 /head
 body
 ?
 include('file');
 ?
 ...
 /html
 
 I have done diferent proofs and I have seen that the problem 
 is that when I put include don't work sessions and if I left 
 session it works. When I put all together it prints in the 
 browser the code from html to body. It don't continue. 
 If I reload the page it works properly. But I haven't found 
 the way to do it automaticaly.
 
 Are there somebody who knows how to fix it?
 
 
 Thanks.
 
 
 
 Un saludo.
 

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




[PHP] RE: Destroy session variable when IE close

2002-08-15 Thread Tim Ward

yes but the variables are still held and would be available if you knew the
session id. until the garbage collection clears it out the session variables
are still there. the session doesn't die when the browser closes, just the
browser's reference to it.


Tim Ward

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html 


 -Original Message-
 From: lallous [mailto:[EMAIL PROTECTED]]
 Sent: 14 August 2002 14:44
 To: [EMAIL PROTECTED]
 Subject: Re: Destroy session variable when IE close
 
 
 Afaik, the session will die automatically when IE gets closed.
 Or at least the cookie that links to that session.
 
 Elias
 
 Christian Ista [EMAIL PROTECTED] wrote in message
 000101c24384$442ab9b0$c000a8c0@p3portable">news:000101c24384$442ab9b0$c000a8c0@p3portable...
  Hello,
 
  Is it possible to set to null (or destroy) the session 
 variables when I
  close IE ?
 
  Bye
 
 
 
 

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




[PHP] RE: dir to array?

2002-08-01 Thread Tim Ward

 Not sure why this isn't working, any help is appreciated.  I 
 am trying to
 read the files in a directory and place them into an array.  
 Here is the
 code:
 
 /* Function to create array of directory contents */
 function dCNTS($files) {
  $dir = opendir(/path/to/directory/);
   while($imgs = readdir($dir)) {
if (($imgs != .)  ($imgs != ..)) {
 $cnt[count($imgs)] = $cnt;

is this typo in the original code? surely should be  = $imgs;

} else {
 print Cannot create array of files in directory!; }
}
   closedir($dir);
  }

Tim Ward
www.chessish.com

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




RE: [PHP] String Question

2002-08-01 Thread Tim Ward

or ...
while($new = substr($old, $i++ * $strlen, $strlen)) $array[] = $new;


Tim Ward
www.chessish.com 

 -Original Message-
 From: Richard Baskett [mailto:[EMAIL PROTECTED]]
 Sent: 31 July 2002 20:47
 To: Randy Johnson; PHP General
 Subject: Re: [PHP] String Question
 
 
 ?
 $string = 'abcdefghijklmnopqrstuvwxyz';
 $strNum = ceil(strlen($string)/8);
 
 for ($i=0; $i$strNum; $i++) $newString[] = substr($string, 
 ($i*8), 8);
 
 for ($j=0; $jcount($newString); $j++) echo string$j = 
 $newString[$j]br
 /;
 ?
 
 Rick
 
 A sense of humor can help you over look the unattractive, tolerate the
 unpleasant, cope with the unexpected, and smile through the 
 unbearable. -
 Moshe Waldoks
 
  From: Randy Johnson [EMAIL PROTECTED]
  Date: Wed, 31 Jul 2002 15:26:15 -0400
  To: [EMAIL PROTECTED]
  Subject: [PHP] String Question
  
  Hello,
  
  I would like to be able to do the following but have not 
 figured out a way to
  handle it
  
  $string=abcdefghijklmnopqrstuvwxz;
  
  I would like to divde the above string into separate 
 strings 8 charactes long
  , example
  
  $string1=abcdefgh
  $string2=ijklmnop
  $string3=qrstuvwx
  $string4=yz
  
  if the string were only 10 long
  
  $string=abcdefghij
  
  then
  
  $string1=abcdefgh
  $string2=ij
  
  any suggestions would be greatly appreciated.
  
  Thanks,
  
  
  Randy
  
 
 

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




RE: [PHP] Re: Table formatting -- PARTIALY SOLVED

2002-07-30 Thread Tim Ward

why would you expect a for loop to know whether there was an array returned
from the mysql_fetch_array($result). you haven't told it to check this. This
is why I suggested using the fetch_array() to control the loop and a counter
to determine when to start and end rows - did you not get that?


Tim Ward
www.chessish.com

 -Original Message-
 From: César Aracena [mailto:[EMAIL PROTECTED]]
 Sent: 29 July 2002 16:39
 To: 'Martin Towell'; [EMAIL PROTECTED]
 Subject: RE: [PHP] Re: Table formatting -- PARTIALY SOLVED
 
 
 Thnx a lot Martin and all, this worked. Anyway, apart of this being a
 logical solution (I almost kill myself for not thinking it 
 before), why
 is that the FOR looping (before using that division operator) 
 worked in
 such a strange way? Isn't it supposed to stop looping if 
 nothing else is
 fetched from the DB?
 
 Pardon my interest in learning, but this is how I am.
 
 Thanks a lot, C.
 
  -Original Message-
  From: Martin Towell [mailto:[EMAIL PROTECTED]]
  Sent: Monday, July 29, 2002 2:05 AM
  To: 'César Aracena'; [EMAIL PROTECTED]
  Subject: RE: [PHP] Re: Table formatting
  
  try changing these two lines
  
  $num_rows = mysql_num_rows($result);
  $num_cols = 2;
  
  to this
  
  $num_cols = 2;
  $num_rows = mysql_num_rows($result) / $num_cols;
  
  this isn't the full solution, but will help you on your way...
  
  HTH
  Martin
  
  -Original Message-
  From: César Aracena [mailto:[EMAIL PROTECTED]]
  Sent: Monday, July 29, 2002 2:03 PM
  To: [EMAIL PROTECTED]
  Subject: RE: [PHP] Re: Table formatting
  
  
  I know no one in this list like to think we newbie's want 
 the job done
  for us, so I'm trying to figure out the below question myself, but
 trust
  me when I say it's making me nuts... this is my best shot so far:
  
  $query = SELECT * FROM saav_arts ORDER BY artid;
  $result = mysql_query($query) or die(mysql_error());
  $num_rows = mysql_num_rows($result);
  $num_cols = 2;
  
  for ($x = 0; $x  $num_rows; $x++)
  {
  echo tr;
  
  for ($i = 0; $i  $num_cols; $i++)
  {
  
  $row = mysql_fetch_array($result);
  echo td align=\center\;
  echo a href=\details.php?artid=.$row[artid].\img
  src=\.$CFG-artdir./.$row[artsmall].\
  ALT=\.$row[artname].\ BORDER=\0\/a;
  echo /td;
  }
  
  echo /tr;
  }
  
  The thing is that it shows up two columns as I want, but not the 4
  images that I have in DB... it shows 2 rows of 2 images each and
 antoher
  2 rows of 2 *NOT DIPLAYED* images which I don't have... like it was
  looping again with nothing to fetch from the DB... What is this?
  
  Jason: as I wrote this, your tip came over and as you can see I did
  figure it out (almost melted my brain though)... now, do 
 you know what
  is going on?
  
  Thanx, C.
  
   -Original Message-
   From: César Aracena [mailto:[EMAIL PROTECTED]]
   Sent: Monday, July 29, 2002 12:27 AM
   To: 'Chris Earle'; [EMAIL PROTECTED]
   Subject: RE: [PHP] Re: Table formatting
  
   I like this method a lot. Now, considering I do like FOR 
 looping as
 a
   fact, how can I make a loop inside another loop. I mean, if I tell
 the
   first loop that $i=0 and then do the comparison and then add 1 to
 $i,
  in
   the inner or second loop should I state that $i=$i or what? Also
 make
  it
   $i=0???
  
   Thanks, C.
  
-Original Message-
From: Chris Earle [mailto:[EMAIL PROTECTED]]
Sent: Saturday, July 27, 2002 1:54 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Table formatting
   
You can do what he said or just put a separate loop inside the
   original
loop.
   
Depending on how you get the info, you can use either way (his
 would
create
less overhead if you are just using the same TD info 
 every row,
otherwise
they're really the same because his way you'll have to create an
  array
   to
access later for multiple rows, or just do my way and have the
 loop
   access
the NEXT *3* (or whatever) items ...).
   
i.e.,
for (LOOP FOR TR)
{
for (LOOP FOR TD) {}
}
   
César aracena [EMAIL PROTECTED] wrote in message
001a01c234f0$a5e8ad80$28ed0dd1@gateway">news:001a01c234f0$a5e8ad80$28ed0dd1@gateway...
Hi all.
   
Last nite I've came across a problem I wasn't able to figure out
 by
  my
self. It's not difficult to make a loop that will make 
 new *TABLE
   ROWS*
(tr) to show several DB objects in a nice way. what I need to
 do,
  is
to display 2 or maybe even 3 of this objects stored in a DB per
  table
row, separated in different *TABLE COLUMS* (td). how can I
 achieve
this? What I usually do is:
   
--
// DB QUERY
$query = SELECT * FROM table_name;
$result = mysql_query($query) or die(mysql_error());
$num_rows = mysql_num_rows($result);
   
// NOW THE LOOP
for ($i=0; $i$num_rows; $i++)
{
 $row = mysql_fet

RE: [PHP] beginner in PHP

2002-06-13 Thread Tim Ward

From the symptoms it sounds like you're destroying the session okay but
leaving the variables
In the script. Are you sure you're unsetting them at the appropriate scope
level. 

Tim Ward
www.chessish.com http://www.chessish.com 

--
From:  Phillip Perry [SMTP:[EMAIL PROTECTED]]
Sent:  13 June 2002 05:18
To:  Martin Towell; Tom Rogers; Php
Subject:  RE: [PHP] beginner in PHP

Thanks Martin!! That really helped out a lot. And thanks to all who
tried to
help me. I appreciate it!

I have one other question that is really not so much important as it
is
annoying, but I can't figure it out myself.

I'm practicing with sessions. What I'm making..if you couldn't tell
by the
array output from before...is a test shopping cart. Now the
annoyance is
that when I click the checkout link it's just supposed to destroy
the
session and reset everything to 0 including the shopping cart. And
also if
an item is clicked, that item gets deleted. With both choices when I
click
once the session does get destroyed, but everything stays on the
page until
I refresh the page. I want the info to get reset when I click the
link.
Here's the delete and checkout code...remember they both do actually
work,
just not as I want. Any suggestions on how to make it refresh on a
click
only?

/ DELETE SHOPPING CART ITEMS

function chout(){
session_destroy();
$mycart = array();
$cart_items = 0;
echo pThank you for shopping!/p;
}

if ($action == delnow)
{
unset($mycart[$itemid]);
}

// END DELETE SHOPPING CART ITEMS

if ($action == checkout)
{
chout();
}

-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 12, 2002 11:55 PM
To: '[EMAIL PROTECTED]'; Tom Rogers; Php
Subject: RE: [PHP] beginner in PHP


here's the revised loop


$cat_cnt = count($catalog);
while (list($key,$value) = each($mycart))
{
  for ($j = 0; $j  $cat_cnt; $j++)
if ($value == $catalog[$j][itemcd])
{
  echo $catalog[$j][unitprice];
  break;
}
}


-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 13, 2002 1:50 PM
To: '[EMAIL PROTECTED]'; Tom Rogers; Php
Subject: RE: [PHP] beginner in PHP


Ah! $catalog is a 2D array - any your if statement is expecting a 1D
array...

-Original Message-
From: Phillip Perry [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 13, 2002 1:52 PM
To: Tom Rogers; Php
Subject: RE: [PHP] beginner in PHP


I meant Martin :) sorry.

-Original Message-
From: Phillip Perry [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 12, 2002 11:44 PM
To: Tom Rogers; Php
Subject: RE: [PHP] beginner in PHP


Array ( [0] = gerainiums [1] = roses [2] = roses [3] = roses [4]
=
roses [5] = roses )

1
1

Your output is different from the last print_r that Tom had me do. I
wonder
why that is

-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 12, 2002 11:44 PM
To: [EMAIL PROTECTED]; Php
Subject: RE: [PHP] beginner in PHP


Hi
Then I guess you will have to add some debug code
try this before the while loop and make sure your if ($value ==
$catalog[itemcd]) will produce a match (and you do need the quotes
really
:)

echo pre.print_r($catalogue).br.print_r($mycart)./pre;
Tom

At 11:31 PM 12/06/2002 -0400, Phillip Perry wrote:
Thanks, but that didn't work either

-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 12, 2002 11:32 PM
To: [EMAIL PROTECTED]; Php
Subject: Re: [PHP] beginner in PHP


Hi
itemcd and unitprice should be in quotes I think if they are keys
in an
array.
$catalog[itemcd]
$catalog[unitprice]

Tom

At 10:56 PM 12/06/2002 -0400, Phillip Perry wrote:
 Can someone tell me why this doesn't work?
 The $mycart array is fine and the $catalog array is also fine but
nothing
 inside the if statement prints. I've tried other echo statements
but
nothing
 prints at all.
 
 while (list($key,$value) = each($mycart))
  {
  if ($value == $catalog[itemcd

RE: [PHP] PHP function for listing number of columns in table

2002-06-10 Thread Tim Ward

Just off the top of my head wouldn't describe then mysql_num_rows() be a lot
more efficient.

Tim Ward
www.chessish.com http://www.chessish.com 
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 

--
From:  John Holmes [SMTP:[EMAIL PROTECTED]]
Sent:  09 June 2002 18:29
To:  [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject:  RE: [PHP] PHP function for listing number of columns in
table

No. There is, however, a function that'll tell you how many columns
are
in a result set. So, if you select all columns, then you can use
that
function to find out how many columns are in the table.

www.php.net/mysql_num_fields

---John Holmes...

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, June 09, 2002 12:54 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP function for listing number of columns in table
 
 Pardon the probably stupid question but,
 
 Is there a PHP function for listing number of columns in a mySQL
table?
 
 Thanks in advance
 
 JJ Harrison
 [EMAIL PROTECTED]
 www.tececo.com



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




[PHP] RE: simplicity with 2 queries..

2002-06-10 Thread Tim Ward

If ($result = mysql_query(SELECT * FROM $table_user, $table_quiz 
WHERE
$table_quiz.user_id=$table_user.user_id 
AND username='$valid_user' 
AND password='$valid_password'))
{   if ($array = mysql_fetch_array($result))
{   $quiz_id = $array[quiz_id];
} else
{   // log in failed
}
}

I think you need to spend a bit of time on basic sql and structure 
your code a bit if you want the desired result.

Tim Ward
www.chessish.com http://www.chessish.com 
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 

--
From:  Jule Slootbeek [SMTP:[EMAIL PROTECTED]]
Sent:  10 June 2002 04:35
To:  php-general
Subject:  simplicity with 2 queries..

Hey guys and gals,

I have the following function which accesses the following tables,
now i want to 
know if there is a way to get the quiz_id from table quiz without
runnning both 
these queries...
thanks,

Jule

--tables--

mysql describe user;

++--+--+-+-++
| Field  | Type | Null | Key | Default | Extra
|

++--+--+-+-++
| user_id| int(10) unsigned |  | PRI | NULL|
auto_increment |
| first_name | varchar(10)  |  | | |
|
| last_name  | varchar(20)  |  | | |
|
| email  | varchar(100) |  | | |
|
| username   | varchar(16)  |  | | |
|
| password   | varchar(32)  |  | | |
|

++--+--+-+-++

mysql describe quiz;

+-+--+--+-+-++
| Field   | Type | Null | Key | Default | Extra
|

+-+--+--+-+-++
| quiz_id | int(10) unsigned |  | PRI | NULL| auto_increment
|
| user_id | int(10) unsigned |  | | 0   |
|
| title   | varchar(255) |  | | |
|
| noa | tinyint(2)   |  | | 0   |
|

+-+--+--+-+-++

--function--

function addquiz_get_quiz_id() {

global $valid_user, $valid_password;

mysql_select_db($db_glob, $link_glob);

$table_user = user;
$table_quiz = quiz;
$query = SELECT * FROM $table_user WHERE
username='$valid_user' AND 
password='$valid_password';
$result = mysql_query($query);
$user_info = mysql_fetch_array($result);
$user_id = $user_info[user_id];

$query = SELECT * FROM $table_quiz WHERE
user_id='$user_id';
$result = mysql_query($query);
$user_info = mysql_fetch_array($result);
$quiz_id = $user_info[quiz_id];

mysql_close($link_glob);
return $quiz_id;
}
-- 
Jule Slootbeek  
[EMAIL PROTECTED] 

http://blindtheory.cjb.net 



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




[PHP] RE: your philosophy on php-design

2002-05-30 Thread Tim Ward

You can use OOP for this sort of thing - define a base class with the
structure you want and 
override the bits you need to in each page.

Class BasePage
{   function BasePage()
{   // constructor
}

function Header()
{   
}

function MainMenu()
{   
}

function SubMenu()
{   
}

function MainContent()
{   
}

function SubContent()
{   
}

function Footer()
{   
}

function Output()
{   $this-Header();
echo(bodytable);
echo(trtd colspan='3');
$this-Header();
echo(/td/tr);
echo(trtd);
$this- SubMenu();
echo(/tdtd);
$this- MainContent ();
echo(/tdtd);
$this- SubContent ();
echo(/td/tr);
echo(trtd colspan='3');
$this- Footer();
echo(/td/tr);
echo(/table/body);
}
}

you get the idea


Tim Ward
www.chessish.com http://www.chessish.com 

--
From:  Wilbert Enserink [SMTP:[EMAIL PROTECTED]]
Sent:  30 May 2002 08:51
To:  [EMAIL PROTECTED]
Subject:  your philosophy on php-design

Hi all,


I'm busy building a website. I cannot use frames.
Every page can be  divided in a table with 3x3 cells.

The row will be my main menu.
The first column wil be submenu.
The middel cell will display the actual content. 


||
--main menu--
|--  |---
 sub  |  main   |sub content
 menu   |  content   |
||
|--  |--
--footer-- 
||


the main menu will always be the same, same as the footer --
includes
the main content cell depends on which submenu function is choosen.

Some submenu items are: 

login
search in database
add to your favourite items
add to basket


Now I was wondering how to build my site. How should I deal with a
function like 'add to basket'. I mean, when a certain item is displayed and
the customer wants to add it to their basket I have call the script
add_to_basket.php or something like that. However I don't want to leave the
page where the item is displayed, cause that's confusing to the visitor.
Even more..In the 'sub-content' cell I want to display data about ordering
info, like there are so many items in the basket. 

So I have to call upon a script which stores the info about
add_to_basket, load a total new page where 1 table cell changes, namely the
sub-content cell, but still displayes the original product. 

So, If I were to use frames It could be done, but now I'm not
thinking of frames but of displaying content dynamically in a tabe cell.

I would very much appreciate your expert opinion on this matter, I'm
sure every idea helps me form my own ideas which I can use.
maybe there are people out there who have done this kind of thing,
or know about large sites which use this same concept

Any philosophies are much appreciated!

Wilbert Enserink



 











-
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
[EMAIL PROTECTED]
-

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




[PHP] RE: Global variables

2002-05-30 Thread Tim Ward

What about storing them in database or (below root) flat files?

Tim Ward
www.chessish.com http://www.chessish.com 

--
From:  serge gedeon [SMTP:[EMAIL PROTECTED]]
Sent:  29 May 2002 14:35
To:  [EMAIL PROTECTED]
Subject:  Global variables

Dear sir,

I would like to know if I could create using PHP, global variables
that I 
could use in diferrent files. I don't want to use http_get_vars or
post or 
cookies is there an other way?

Thank you.
Serge GEDEON




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


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




[PHP] RE: Month Values in UNIX timestamps and workaround(Newbie)

2002-05-30 Thread Tim Ward

If you just want the number of seconds in each month then ...

function SecondsInMonth($month, $year)
{   return mktime(0,0,0,$month + 1, 1, $year) - mktime(0,0,0,$month, 1,
$year);
}

... works, although you may need to play around with the is_dst parameter to
fine tune it.

Tim ward
www.chessish.com http://www.chessish.com 

--
From:  [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
Sent:  30 May 2002 04:37
To:  [EMAIL PROTECTED]
Subject:  Month Values in UNIX timestamps and workaround(Newbie)

I began to write a function that correctly diveded up the months
into their correct UNIX timestamps and wrote content from a database
accordingly.
 
I have had an idea that maybe eaiser to implement but slower. Could
one or two people tell me what the think and if it is a good idea. I am also
interested in speed and efficiany of both methods.
 
The original method is:
 
I do a few maths functions to get the value in seconds of each month
etc
 
New Method:
 
I do string compares with with dates then convert them to UNIX
timestamps.
 
JJ Harrison
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
www.tececo.com http://www.tececo.com 

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




[PHP] RE: odd class/session/db behaviour

2002-05-29 Thread Tim Ward

I'm not sure if this is your problem but are you closing the connection
anywhere in the script?

e.g.

function Fred()
{   $freddb = mysql_connect(servername,user,password);
mysql_close($freddb);
}

$db = mysqlconnect(servername,user,password);
Fred();

Mysql_query(select ..., $db); // will fall over as the connection has been
terminated



Identical attempts to connect in the same script create multiple pointers to
the same connection. 
The resource identifier is scoped to the function in the case above but the
connection isn't.

This may not have anything to do with your problem but it's something that
tripped me up when
I started doing OOP stuff in PHP.

Tim Ward
www.chessish.com http://www.chessish.com 

--
From:  Nick Wilson [SMTP:[EMAIL PROTECTED]]
Sent:  29 May 2002 09:51
To:  php-general
Subject:  odd class/session/db behaviour

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all
I've been wrestling with a php problem that has, as far as I'm
aware, no
reason to be happening unless php handling of OOP and Sessions is to
blame. This note looks long, but has been *seriously* condensed!


I have an application set up like this (bear with me it *is* simple
:-)

*   Database (MySQL)
*   Class to handle add, edit, delete, list etc (basic
functionality)
*   Admin program  // use the class and forms etc to allow admin of
db

Now the problem appears to be with the sessions and class: the Admin
program is just a big switch statement that reloads itself eachtime
like
this:

switch($mode) {
case add:
do_some_adding();
break;
}

and etc with all the other things it needs to do.

*** The ERROR *

I'm getting 'Access denied' errors sometimes and the only cure I've
found is this:

if I instantiate the class at the top of the Admin program and it
accesses the db then the next time it needs to access the db it wil
fail
unless I instantiate a new class? 

Very odd. 

The class holds properties of $this-user, $this-host, $this-pass
and
uses them in an private method $this-_db_connect() so I see no
reason
why it should be doing this.

It doesn't appear to be losing the properties, just not being able
to
connect to the db.


* Conclusion ***

Until someone points out the blindingly stupid mistake I'm making
;-)
I'll have to assume their is some OOP/Sessions problem, sure I have
a
solution, but it is very messy, inelegant, and destroys the point of
using a class and session for this purpose.

Can anyone shed any light on this?

Many thanks
- -- 
Nick Wilson //  www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE89JB5HpvrrTa6L5oRArInAKCbmvkGII1uJ5Olmm3oRFyTUhlnDwCeL/xp
Jm00SFzoHn/NNqNuGSCj0Vs=
=d6TN
-END PGP SIGNATURE-

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




[PHP] RE: array_search in 2-d arrays

2002-05-15 Thread Tim Ward

First this is not a 2d array it is a single d array each element of which is
another array.
If you search the array for a value you won't find it as each element is an
array.
$layerDes[1][0] is not an element of $layerDes it is an element of the array
$layerDes[1].

As far as I know there is no built in way to search down this tree. I think
you'll need
To walk the array and check the first element of each e.g.

Foreach($layerDes as $count=$array)
{   if ($array[0] == $searchstring)
{   $key = $count;
break;
}
}

Tim Ward
www.chessish.com http://www.chessish.com 

--
From:  Pushkar Pradhan [SMTP:[EMAIL PROTECTED]]
Sent:  14 May 2002 19:51
To:  [EMAIL PROTECTED]
Subject:  array_search in 2-d arrays

I've a 2 D array and would like to search for vals. in the first
dimension
only i.e.
myArray[0][0]
myArray[1][0]
myArray[2][0]
myArray[3][0]
.
.
.
and not in the elements myArray[0][1]

CODE:
for($l = 0; $l  count($layer); $l++) {
   $key = array_search($layer[$l], $layerDes);   // $layerDes is 2-D
   $layer[$l] = $layerNames[$key];
}
My $key is undefined after execution, is it because the elements are
in
$layerDes[i][0]?
Using $key === also didn't help? Any ideas, thanks.

-Pushkar S. Pradhan



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




[PHP] RE: An array of objects?

2002-05-14 Thread Tim Ward

$_SESSION[rooms][1] = array(room_name=Bob's Room, room_status=1)
$_SESSION [rooms][2] = array(room_name=Jeff's Room, room_status=0)
etc.

then for a given room_id ...
echo($_SESSION [$room_id][room_name]) and so on


Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 

--
From:  Nathan [SMTP:[EMAIL PROTECTED]]
Sent:  13 May 2002 17:47
To:  PHP
Subject:  An array of objects?

I have some data I need to store in the session array and I'm not
exactly sure how to get it there
and get it back... I have a list of room ID numbers, and each room
ID has a few attributes I need to
keep track of. I end up with a listing like so:

room_id = 1, room_name = Bob's Room, room_status = 1
room_id = 2, room_name = Jeff's Room, room_status = 0

Room_id is unique, room_name is a string, and room_status is
boolean. There are on average 30 rooms
that need to be kept track of. I'd like to put all this data in the
session array so I don't have to
query my database every time the page reloads, which will happen
fairly often. If the data is in the
session, then I can simply update the room_status where I need to
without fetching everything again.

Anyway, I am having a really hard time figuring out how to keep
track of all this data, and I've
looked at it so long I'm sure I'm making far more complex that
necessary.

I've attempted to create an array of objects but I get warnings
whenever I try to refer to
$myObject[$1]-status or anything like that. I've also tried a 4D
array, but I am doing something
very wrong trying to reference the data... Anyone got ideas here?

Many thanks!

# Nathan


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




[PHP] RE: textarea problem

2002-05-14 Thread Tim Ward

Are you POSTing or GETting the data?

Tim Ward
www.chessish.com http://www.chessish.com 

--
From:  Enrique Vadillo [SMTP:[EMAIL PROTECTED]]
Sent:  14 May 2002 01:33
To:  [EMAIL PROTECTED]
Subject:  textarea problem

Hi,

I'm not sure if this is purely a PHP problem but here it goes:

i have a form that sends text data to a PHP script, i have some
textarea field which goes like this:

TEXTAREA wrap=soft NAME=mynote ROWS=15 COLS=70/TEXTAREA

everytime i POST this, $mynote is truncated to 1867 bytes, i have
repeatedly tried to submit text 2500 bytes long but it's always
truncated to that size -btw there is no javascript or anything in
the
middle that might modify the size- my questions is: do i have to
setup anything special in my php.ini? i have this in my php.ini:

post_max_size = 30M

I have also noticed that Hotmail has no problem sending textarea
input 2500 bytes long or more using exactly the same tags.. what's
wrong then? I use Apache 1.3.23 and PHP 4.1.1 (on RedHat 7.1)

if anyone has encountered this problem b4, i'd appreciate some help.

Enrique-



_
Únase con MSN Hotmail al servicio de correo electrónico más grande
del 
mundo. http://www.hotmail.com


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




RE: [PHP] problems with form/form

2002-05-10 Thread Tim Ward

I've only just picked up on this thread, but why not put each form inside a
td element?

i.e.
table
tr
tdform ... /form/td
tdform ... /form/td
/tr
/table

apologies if I've misinterpreted the question

Tim Ward
www.chessish.com http://www.chessish.com 


--
From:  David Freeman [SMTP:[EMAIL PROTECTED]]
Sent:  09 May 2002 22:24
To:  [EMAIL PROTECTED]
Subject:  RE: [PHP] problems with form/form


  a table with several contents, and I have a form on every 
  row, the problem is that the form is to big, so the tab le 
  looks ugly, I tried with everything I could come up with, 

The form/form tags imply a break which adds space vertically.
It's
contrary to doing good html and will most likely cause errors in an
html
validator but about the only way I've found to get around it is to
bury
your form/form somewhere that the implied break won't do
anything.
If you're using a table then between the table and tr or between
/tr and /table is a pretty good place.

CYA, Dave



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




RE: [PHP] build array dinamicaly

2002-04-30 Thread Tim Ward

Be careful - I fell into this trap when I first started doing this sort
of thing. This code will produce an extra element on your array
with value logical false. You need to do ...

While ($array = mysql_fetch_array($result)) $myarray[] = $array;

... to avoid this

Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 

--
From:  Richard Emery [SMTP:[EMAIL PROTECTED]]
Sent:  29 April 2002 21:57
To:  Rodrigo Peres; PHP
Subject:  Re: [PHP] build array dinamicaly

$query = SELECT name,address FROM tbl;
$result = mysql_query($query);
while($myarray[] = mysql_fetch_array($result);

- Original Message - 
From: Rodrigo Peres [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Monday, April 29, 2002 9:20 AM
Subject: [PHP] build array dinamicaly


Hi list,

I want to buil an multidimensional array with the results of Mysql,
but I
don't know how to do it.
What I need is:
SELECT name,adress from tbl_.

array name will receive the names
array adress will receive the adresses
and array clientes will contain both, so when i try to access i will
have
something like $cliente['nome'][0] or $clientes['adress'][1] and so
on.

Someone can help???

Thank's in advace

Rodrigo Peres


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



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




[PHP] RE: Problem with array

2002-04-30 Thread Tim Ward

Try some diagnostics to tell you what's going on

In the page you're submitting to try
Foreach($HTTP_POST_VARS as $key=$value) echo($key=$valuebr);

Part of your problem may be that you're using the number of 
form elements returned to control the for loop. It doesn't
really have any significance in this context.

Is there any reason why you're not naming the checkboxes RG[1], RG[2], etc.?
This would make everything much easier - you can then do ...

Foreach ($HTTP_POST_VARS[RG] as $value) $RGs[] = $value


Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 

--
From:  Carlos Fernando Scheidecker Antunes
[SMTP:[EMAIL PROTECTED]]
Sent:  30 April 2002 16:11
To:  PHP-GENERAL
Subject:  Problem with array

Hello All,

I've got a form that creates checkboxes based on the number of rows
on a table. The user has to check some of the boxes and then click submit.
The boxes are named RG1, RG2, RG3, 

If there are 4 checkboxes and the user selects them all or selects
the first, second and fourth, or the first third and fourth my code works.
But if the user selects the second, third and fourth (He does not checks the
first one) no information is recorded on my array.

Here's the code that I have to search the $HTTP_POST_VARS and then
fill a array variable called $RG.


function SearchRGs() {
global $HTTP_POST_VARS;
global $RGs;

// fills the array variable RGs with the values of checked
checkboxes that start with the name RG# (where # goes from 1,2,3,).
   // returns the qty of checked RGs and size of the $RGs array.

$index = count($HTTP_POST_VARS);
$count = 0;

for ($i=1; $i  $index; $i++) {
if (isset($HTTP_POST_VARS[RG$i])) {
$RGs[] = $HTTP_POST_VARS[RG$i];
$count++;
}
}

return $count;

}


Can anyone help me with this?

Why if I do not check the first checkbox on the form the array  is
not filled.

Thank you,

Carlos Fernando.

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




[PHP] RE: Array indices

2002-04-24 Thread Tim Ward

Why not just...
Foreach (array_diff($array1, $array2) as $value)
{   $newarray[] = $value;
}

or am I missing something?

Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 

--
From:  esivertsen [SMTP:[EMAIL PROTECTED]]
Sent:  23 April 2002 13:09
To:  php-general
Subject:  Array indices

Hi all,
I have a question regarding array indices:

At a certain point in code, I run array_diff() on two arrays to
produce a reduced version of one of the argument arrays.
Problem is, I dont want the key-value associations to be preserved. 
I need that the returned array has new (integer, not string) indices
in numerical order from 0...N without holes.

Does anybody know how to do this? I have looked at different sort
functions etc, but I'd rather not do a sort to the array.
The code is for random selection with reduction of the sample set
(i.e. with withdrawal).

All the best, 

Eivind




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




[PHP] RE: how to get row by row from CSV file

2002-04-19 Thread Tim Ward

Look at file() and fgets() functions.
File gives you the whole file as a row per element array
e.g. ...
If ($csvfile = file(yourfile.csv))
{   foreach($csvfile as $row)
{   $csvarray[] = explode(,, $row);
}
}
... gives you a structure from the csv that you can walk through in php.

Using fopen and while fgets may be more efficient, especially if you don't
want the whole file
If ($fhandle = fopen(yourfile.csv, r))
{   while ($row = fgets($fhandle))
{   ... // etc.
}
}

Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 

--
From:  Jack [SMTP:[EMAIL PROTECTED]]
Sent:  18 April 2002 14:18
To:  [EMAIL PROTECTED]
Subject:  how to get row by row from CSV file

Dear all
I'm a beginner of php, i tried to get the CSV file, but it return
like
Column by Colume, but how i can get it in Row by Row, cause i want
to point
to specific data i want, but not the whole file content!

--
Thx a lot!
Jack
[EMAIL PROTECTED]




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




RE: [PHP] .inc over .php

2002-04-19 Thread Tim Ward

I've settled on .inc.php, .class.php, etc. that way you get the best of both
worlds. Your files are identified as what they are and don't get sent out
unparsed

Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 


--
From:  Jason Wong [SMTP:[EMAIL PROTECTED]]
Sent:  19 April 2002 09:28
To:  [EMAIL PROTECTED]
Subject:  Re: [PHP] .inc over .php

On Friday 19 April 2002 16:10, Jacob Wyke wrote:
 Just a few quick questions if anybody is out there.

Nobody here but us chickens.

 Why use .inc as a file extenstion when you can use .php ??

Just a matter of aesthetics. Some people might like to use .inc to
remind 
themselves that the file is to be included and not run on its own.

 What are the advantages/disadvantages to using .inc?

None from a technical point of view

 Is one more secure?

On default webserver settings, .inc may be less secure because by
default the 
webserver would not treat .inc files as php files and thus return
them as-is. 
Thus if people know the name of your filename.inc they could
potentially  
browse to it and thus see its contents. 

There are two ways to counter this:

1) have the .inc files in a directory outside the scope of the
webserver 
directory.

2) set the webserver to treat .inc files as php files.

 Which is faster?

No difference.

 Which is consider a better pratice?

As long as you take the necessary precautions then it boils down to
a matter 
of preference.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications
Development *

/*
Home, Sweet Home must surely have been written by a bachelor.
-- Samuel Butler
*/

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




RE: [PHP] save html created by loop in variable

2002-04-18 Thread Tim Ward

How about something like ...
$agents = array();
If ($result = mysql_query(SELECT h.title, h.address, a.agentname 
FROM homes h, agents a WHERE
h.owner=a.id AND a.id=$aid))
{   while ($array = mysql_fetch_array($result))
{   $agents[$array[agentname]][] = $array;
}
}

foreach($agents as $agent=$addresses)
{   echo($agentbr);
foreach($addresses as $address)
{   echo({$address[title]}, {$address[address]});
}
}

Please treat this as pseudo code, but you get the idea. Arrays of arrays can
be really powerful for stuff like this.

Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 

--
From:  Jason Dulberg [SMTP:[EMAIL PROTECTED]]
Sent:  18 April 2002 05:27
To:  [EMAIL PROTECTED]
Subject:  RE: [PHP] save html created by loop in variable

Thanks for your reply... I just tried it with ob_start(); and I
think I'm
almost on the right track. Just one small issue. Since the records
are in a
while loop, the results are printed line by line as expected.
However, I
need to print something obtained from the sql query just once then
the rest
to loop.

//a.agentname displays only once and h.title/h.address will be in a
list
SELECT h.title, h.address, a.agentname FROM homes h, agents a WHERE
h.owner=a.id AND a.id=$aid

Basically what I'm after is displaying something like:

Agent: Fred
nice house, 123 street
ugly house, 643 road

Thanks again for your help on this.

Jason

 -Original Message-
 From: Miguel Cruz [mailto:[EMAIL PROTECTED]]
 Sent: April 17, 2002 8:28 PM
 To: Jason Dulberg
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] save html created by loop in variable
 
 
 On Wed, 17 Apr 2002, Jason Dulberg wrote:
  I have a WHILE loop that I am interested in storing the html
that is
  generated based on its results to a variable. This variable 
 would then be
  echoed later on.
 
 Check in the manual under Output Buffering.
 
 miguel
 
 

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




[PHP] RE: simple question

2002-04-03 Thread Tim Ward

Try http://www.idocs.com/tags/forms/ http://www.idocs.com/tags/forms/ 

Also (as the definitive reference for html) http://www.w3.org/MarkUp/
http://www.w3.org/MarkUp/ 

Once you've got html forms working okay, then the fields you've named in
your form are available as variables in the php page the form submits to
(the action property of the form tag, which can be the same page).

Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 

--
From:  Denis L. Menezes [SMTP:[EMAIL PROTECTED]]
Sent:  02 April 2002 17:34
To:  [EMAIL PROTECTED]
Subject:  simple question

Hello friends.

I am able to add and query my database using php. I now wish to
build
webpages with textboxes and search the database with criteria from
the
textboxes.

Can someone tell me the resources for building these pages?

Thanks
Denis


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




RE: [PHP] check form - save arrays in hidden fields?

2002-03-26 Thread Tim Ward

Why in a scalar? Why not pass the array through, i.e.

Foreach($test as $element)
{   echo(input type='hidden' name='test[]' value='$element');
}

Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 

--
From:  Fabian Krumbholz - 2k web solutions
[SMTP:[EMAIL PROTECTED]]
Sent:  26 March 2002 09:31
To:  PHP Mailingliste
Subject:  [PHP] check form - save arrays in hidden fields?


I have a contact form (form.php). I check the submitted data with
the
same php file.

If the e-mail adress is not valid I ask the user for a valid e-mail
adress.
Therefor I create a new form with the field e-mail. The valid date
name,
adress, ...
I put into hidden fields, so they don't get lost.

This works fine until I integreate a file upload into my form.
The file data stored in the $_FILES array get lost, when I submit
the
form the second time (when the e-mail adress isn't valid).

The same problem occours when I integrate a list box where it is
possible to
choose more then one item:

select name=test[] size=3 multiple
  option value=test1 test1/option
  option value=test2 test2/option
  option value=test3 test3/option
/select

Is there an easy way (in PHP 4.1.2) to store arrays like scalar
variables in
hidden fields, without using a database or transforming the array
data
into a string?

Thanks,

Fabian Krumbholz
www.2k-web.de


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




[PHP] RE: Browser Detection without use of browsecap.ini file

2002-03-22 Thread Tim Ward

$HTTP_ENV_VARS[HTTP_USER_AGENT] contains this info if it's been sent

Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 

--
From:  R'twick Niceorgaw [SMTP:[EMAIL PROTECTED]]
Sent:  21 March 2002 17:06
To:  [EMAIL PROTECTED]
Subject:  Browser Detection without use of browsecap.ini file

Hi all,
is there any way, I can detect the browser without using
browsecap.ini file
? I'm simply interested to know if the user using netscape 4.x or
earlier.

I  tried get_browser() function but it returns blank! after checking
my
server's configuration i found browsecap file setting in
uninitialized. I'm
not sure if my hosting company will setit up properly for me, but
already
contacted them and waiting to hear a response form them..

Any help will be much appreciated.

R'twick



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




RE: [PHP] Re: Return the column names of MySQL table?

2002-03-20 Thread Tim Ward

The result of the DESCRIBE query is a dataset like that of any other query
so ... 

$query = DESCRIBE montileaux_events ;
if ($result = mysql_query($query))
{   while ($field = mysql_fetch_array($result))
{   foreach($field as $key = $val)
{   echo $key : $val |;
}
echo(br);
}
}

Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 

--
From:  Kevin Stone [SMTP:[EMAIL PROTECTED]]
Sent:  19 March 2002 23:21
To:  [EMAIL PROTECTED]
Subject:  RE: [PHP] Re:  Return the column names of MySQL table?

Philip thanks for the tip-off to the mysql_list_fields() function..
that
simplifies things quite a bit.  Problem solved. :)

I'm still wondering about the other method though.  I noticed the
DESCRIBE table_name method in the MySQL docs but couldn't figure
out
how to use it.  Alone it seems to return information about only the
first column...

?
$query = DESCRIBE montileaux_events ;
$result = mysql_fetch_array(mysql_query($query))
foreach ($result as $key = $val)
{
echo $key : $val br;
}
?

--- returns -
0 : keynum 
Field : keynum 
1 : int(11) 
Type : int(11) 
2 : 
Null : 
3 : PRI 
Key : PRI 
4 : 
5 : auto_increment 
Extra : auto_increment 
6 : select,insert,update,references 
Privileges : select,insert,update,references
--

keynum is the name of the frist column in the table.  But beyond
that
there doesn't appear to be any data to increment through.  The
function
returns this and only this.  Am I using it wrong?

Thanks,
Kevin


-Original Message-
From: Philip Hallstrom [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 19, 2002 4:02 PM
To: Geoff Hankerson
Cc: Kevin Stone; [EMAIL PROTECTED]
Subject: [PHP] Re: Return the column names of MySQL table?

Or if you want to do this within PHP use the mysql_list_fields
function.

On Tue, 19 Mar 2002, Geoff Hankerson wrote:

 I believe it is:
 describe tablename;
 - Original Message -
 From: Kevin Stone [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, March 19, 2002 4:43 PM
 Subject:  Return the column names of MySQL table?


  Forgive me for the off topic question.  This is a MySQL
question..
has
  nothing to do with PHP directly.  However I was not able to find
an
  answer in the MySQL documentation, on Usenet, or the MySQL
mailing
list
  archives.  Also MySQL.com's  mail manager is on the fritz so I
can't
  even subscribe to the MySQL email list.  Anyway since many of
you
are
  familiar with SQL this is as good a place to ask this question
as
any.
 
  I simply need to return a list of column names of a MySQL table.
What's
  the syntax to do that?
 
  Thanks,
  Kevin
 


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



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




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




RE: [PHP] OBJECT£ºWHAT'S THE RALATION BETWEEN A,B AND C?

2002-03-18 Thread Tim Ward

The line you've marked prints the value attribute of $a-b-a, which is a
pointer to the base object ($a). You have just changed the value attribute
of this to 11 and it prints 11 ... what's wrong?

Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 

--
From:  Oliver Heinisch [SMTP:[EMAIL PROTECTED]]
Sent:  17 March 2002 12:20
To:  [EMAIL PROTECTED]
Subject:  Re: [PHP] OBJECT£ºWHAT'S THE RALATION  BETWEEN A,B AND C?

At 17.03.2002  10:01, you wrote:

?php
class A
{
 function A($i)
 {
 $this-value = $i;
 // try to figure out why we do not need a reference here
 $this-b = new B($this);
 }

 function createRef()
 {
 $this-c = new B($this);
 }

 function echoValue()
 {
 echo br,class ,get_class($this),': ',$this-value;
 }
}


class B
{
 function B($a)
 {
 $this-a = $a;
 }

 function echoValue()
 {
 echo br,class ,get_class($this),':
',$this-a-value;
 }
}

// try to undestand why using a simple copy here would yield
// in an undesired result in the *-marked line
$a =new A(10);
$a-createRef();

$a-echoValue();
$a-b-echoValue();
$a-c-echoValue();

$a-value = 11;

$a-echoValue();
$a-b-echoValue(); // *
$a-c-echoValue();

?
Even if I don´t understand what your code does, shouldn´t you
give any variable a place to be stored so it schould look like
class foo
{
 var $a;
 var $b;
function fooplus()
{
 $this - a = foofoo;
and so on ??
}
}
HTH Oliver


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




[PHP] RE: Invalid Argument ??? Not sure how to debug this

2002-03-18 Thread Tim Ward

Try ...

If ($result = ...)
{   ...
...
} else echo(mysql_error());

I always do querying like this anyway (without the error echo in live stuff
obviously)

Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 

--
From:  Daniel Negron/KBE [SMTP:[EMAIL PROTECTED]]
Sent:  17 March 2002 08:38
To:  [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject:  Invalid Argument ???  Not sure how to debug this

Hi all and Good Morning.

I have been struggling with this code:  I was wondering if someone
could
lend me a hand.

I am working with this code and can't get the error to disappear.

After running I get

|---
--|
| Warning: Supplied argument is not a valid MySQL result resource in
C:\My Documents\My   |
| Webs\php\TMPibtpit3zq0.php on line 12
|

|---
--|


Line 12 happens to be the WHILE statement.  I am not sure if it is
the
while statement or the results its looking for.

TIA  So far, i havent been able to sleep atleast until I get this.

html
?
if (isset($searchstring))
 {

 $db = mysql_connect(localhost,webuser,);
 mysql_select_db(cd_collection,$db);
 $sql= SELECT * FROM cd_list WHERE $searchstring LIKE
'%searchstring%'
ORDER BY artist ASC;
 $result = mysql_query($sql,$db);
 echo TABLE BORDER=2;
 echo
trtdbArtist/btdbTitle/btdbOptions/b/tr;
 while ($myrow = mysql_fetch_array($result))
 {
   echo
trtd.$myrow[artist].td.$myrow[title];
   echo tda href=\edit.php?id=.$myrow[cd_id].
\View/a;
  }
  echo /TABLE;
 }
else
 {
  ?
  form method=POST action=? $PHP_SELF ?
  table border=2 cellspacing=2
  trtdInsert Your Search String Here./td
  tdSearch Type/td/tr
  tr
  tdinput type=text name=searchstring size=28/td
  tdselect size=1 name=searchtype
   option selected value=artistArtist/option
   option value=titleTitle/option
   option value=categoryCategory/option
  /select/td
  /tr
  /table
  pinput type = submit value=Submit name=B1
  input type=reset value=Reset/p
  /form
  ?
 }
 ?

 /html


**DAN**




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




RE: [PHP] Re: A stupid question...

2002-03-11 Thread Tim Ward

If you mean select by first letter then wild cards are what you want ...
http://www.mysql.com/doc/S/t/String_comparison_functions.html
http://www.mysql.com/doc/S/t/String_comparison_functions.html 

in your case SELECT ... WHERE lastname LIKE '$Letter%' ORDER BY lastname

... if you mean sort all records but don't sort past the first letter then
SELECT ..., LEFT(lastname, 1) AS lastname_first ... ORDER BY
lastname_first or you might even be able to do  ... ORDER BY
LEFT(lastname, 1) you'll have to experiment with that one.

Tim Ward
Internet chess www.chessish.com http://www.chessish.com 

--
From:  Chuck PUP Payne [SMTP:[EMAIL PROTECTED]]
Sent:  11 March 2002 02:59
To:  Cary; mysql lists.mysql.com
Cc:  PHP General
Subject:  Re: [PHP] Re: A stupid question...

I want to sort my a letter in a set colomn. Let say I want to sort
the
colomn last_name

http://www.myserver.com/mysort.php?Letter=A

Like to create a link like A then sort only the last name ore what
ever I
want to sort by that letter.

I hope that's helps. I can order by, but I can't so a sort like the
example
above.

Chuck Payne
Magi Design and Support


on 3/10/02 9:42 PM, Cary at [EMAIL PROTECTED] wrote:

 At 08:24 PM 3/10/02, Chuck \PUP\ Payne wrote:
 Hi,
 
 I not a newie but I am not a pro at mysql either. I want to do a
query by
 letter(a, b, c..ect.). Is there a simple way to do it. I am
writing in PHP.
 So can someone please so me the how.
 
 
 I'm not totally sure what your looking for. If you could elaborate
a little
 I am sure that one of us could help you out.
 
 Cary
 
 
 


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




RE: [PHP] Re: User accounts

2002-03-08 Thread Tim Ward

Surely an empty string is == false.

In fact I'd be interested if anyone can come up with a situation where  !$x
doesn't return the same as empty($x)

i.e. can anyone get a value of $x such that !$x !== empty($x) 

Tim Ward
Internet Chess www.chessish.com http://www.chessish.com 

--
From:  Kevin Stone [SMTP:[EMAIL PROTECTED]]
Sent:  07 March 2002 23:56
To:  'David Johansen'; [EMAIL PROTECTED]
Subject:  RE: [PHP] Re: User accounts

I understand your confusion.  The thing is that empty() and ! are
two
completely different arguments.

if(empty($var)) is looking for: $var = '';

if(!$var) is looking for: $var = false; or $var = 0;

If $var is set to anything other than 0 or false then the ASCII
value of
the string is (by definition) equivilant to an integer value of 1 or
more.  And thus is interpreted as true.

Hope that helps.

-Kevin

-Original Message-
From: David Johansen [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, March 07, 2002 3:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: User accounts

Here's a little piece of code that gives me a weird problem:

?php
if (!$logout)
{
   if ($_SESSION['loggedin'])
   {
  unset($_SESSION['loggedin']);
   }
}
?


I have the session started and everything, but it gives me the
following
error.
Warning: Undefined variable: logout in
c:\inetpub\wwwroot\uslogin.php on
line 13
I've seen this used on several examples. I know that if I just use
empty($logout) then it'll work ok, but I just wanted to know why
it's
used
in so many examples but doesn't work in my code. Is there some
setting
that
I have set wrong or something? Thanks,
Dave

David Johansen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm new to this php thing and I would like to set up a web page
were
the
 users can login and edit their preferences and all that stuff. I
have
the
 basic login stuff worked out and I was passing the username and
password
as
 a hidden input in the form, but then the password can be seen with
view
 source. I know that there's a better way to do this, so could
someone
point
 me to a good tutorial or example on how I could make it so that
the
user
 could login and logout and then I wouldn't need to be passing the
password
 all around like this. Thanks,
 Dave





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




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




RE: [PHP] Does anyone follow?

2002-03-05 Thread Tim Ward

How about:

while ($mydata = mysql_fetch_object($news))
{   $mydata-AUS = str_replace( ;, ;, $mydata-AUS);
$mydata-AUS = str_replace(; , ;, $mydata-AUS);
$tempauthors = explode(;, $mydata-AUS);
foreach ($tempauthors as $singleauthor)
{   if ($singleauthor  )
$authors[$singleauthor][] = $mydate-id;
}
}

ksort($authors);
foreach ($authors as $author=$ids)
{   echo a
href=\match.php?searchenquiry=.urlencode($author).match=partial+match\
);
echo($author./a);
echo((. count[$ids] .) [);
foreach ($ids as $id) echo($id); // need something a bit fancier
here, but you get the idea
echo(]br\n);
}


Tim Ward
Internet chess www.chessish.com http://www.chessish.com 


--
From:  jtjohnston [SMTP:[EMAIL PROTECTED]]
Sent:  04 March 2002 23:55
To:  [EMAIL PROTECTED]
Subject:  Re: [PHP] Does anyone follow?

Can you show me how :) ? I'm in over my head.
I get working with arrays, but need more practice,
examples etc. to learn how to code from. How would two arays work?
John


 Does anyone follow what I'm trying to do?

 I have a list of authors I explode from a field called AUS. I sort
them
 sort($authors);

 The layout is agreeable. What I would like now to do is change:

array_push($authors,$singleauthor);

 for

array_push($authors,$singleauthor,$mydata-id);

 But how do I sort them now? These two lines permitted me to:

 sort($authors);
 foreach (array_count_values ($authors) as $author=$count)

 sort, count and display each occurence only once.

 O'Henry, James (5)  #--- there were 5 occurences of O'Henry in my
 database explode

 Now what I want to do is display the id number (record number) of
each
 occurence of O'Henry:

 O'Henry, James (5) [record 1, record 4, record, 87, record 119,
record
 120]

 How do I re-evaluate this code, modify it to display authors one
time
 only,
 count the number of occurences in my database
 and somehow integrate $mydata-id  ?

 Does anyone follow what I'm trying to do?

 --snip---
 $myconnection = mysql_connect($server,$user,$pass);
 mysql_select_db($db,$myconnection);

 $news = mysql_query(select id,AUS from $table);

 $authors = array();

 while ($mydata = mysql_fetch_object($news))
 {
 $mydata-AUS = str_replace( ;, ;, $mydata-AUS);
 $mydata-AUS = str_replace(; , ;, $mydata-AUS);
 $tempauthors = explode(;, $mydata-AUS);
  foreach ($tempauthors as $singleauthor)
   {
if ($singleauthor  )
array_push($authors,$singleauthor);
   }
  }

 sort($authors);
 foreach (array_count_values ($authors) as $author=$count)
 {
 echo a

href=\match.php?searchenquiry=.urlencode($author).match=partial+match\
 .$author./a
 (.$count.)br\n;
 }

 mysql_close($myconnection);


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




[PHP] RE: Sessions and switching between php and htm documents

2002-02-27 Thread Tim Ward

I haven't experienced this myself, but I'd have thought that if you're
propagating the session via the URL rather than a cookie then it won't get
added if the page isn't parsed. If  it's not passed on just once it's lost.

Tim Ward
Internet chess www.chessish.com http://www.chessish.com 

--
From:  Dave [SMTP:[EMAIL PROTECTED]]
Sent:  27 February 2002 04:37
To:  [EMAIL PROTECTED]
Subject:  Sessions and switching between php and htm documents

login.htm
form submits information

login.php
session_start();
$HTTP_SESSION_VARS[username]=$formUserName;
header(Location: displaypage.htm);

displaypage.htm
show some static stuff
links to formpage.htm

formpage.htm
form submits information to form.php

form.php
session_start();
echo $HTTP_SESSION_VARS[username];  -  has no value


Does the chain of pages have to be continually PHP pages to allow
the transition
of the session variables?  if not, any ideas on why we are losing
session
variables?

Dave


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




[PHP] RE: Help with showing tables in DB

2002-02-27 Thread Tim Ward

Have you tried any diagnostic to find out what fields are being returned by
the query, something like:
If ($result = mysql_query(show tables))
{   while ($row = mysql_fetch_array($result))
{   foreach($row as $fieldname=$value) echo($fieldname=$valuebr);
}
}

I think you'll find the field you want is something like Tables_in_dbname.

Tim Ward
www.chessish.com http://www.chessish.com 

--
From:  Ron Clark [SMTP:[EMAIL PROTECTED]]
Sent:  26 February 2002 21:02
To:  [EMAIL PROTECTED]
Subject:  Help with showing tables in DB

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Consider the following:

mysql_select_db($db_name);
$result = mysql_query(show tables);
while ($rows = mysql_fetch_object($result)) {
echo $rows;
}

So why does this not return the Table names? I have even tried echo
rows-Table and echo rows-Tables to no avail. So how do I fix
this?
Thanks in advance,
Ron C.

-BEGIN PGP SIGNATURE-
Version: PGP 7.1

iQA/AwUBPHv32kSpEYIqgLQzEQISfQCeLVinx7oQc4Gmudv1MJbb17dGCPoAnA7S
yRR86rJUwHsXGJlU0yVckVyK
=2bva
-END PGP SIGNATURE-




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




[PHP] RE: str_replace and associative arrays

2002-02-26 Thread Tim Ward

From the manual (http://www.php.net/manual/en/function.str-replace.php
http://www.php.net/manual/en/function.str-replace.php ) In PHP 4.0.5 and
later, every parameter to str_replace() can be an array. 

I tried a test case (php 4.0.0) and found that if I passed an array in as
the subject the search and replace was performed on the string array.

Tim Ward
Internet chess www.chessish.com http://www.chessish.com 

--
From:  Michael Crowl [SMTP:[EMAIL PROTECTED]]
Sent:  25 February 2002 22:01
To:  [EMAIL PROTECTED]
Subject:  str_replace and associative arrays


I haven't been able to find any leads on this in the archives, nor
in the
documentation, so here goes.

When feeding an associative array to str_replace as the subject,
does it
still return an associative array?

My instance:

extract(str_replace(,,,$result_row));

After pulling an associative array using mysql_fetch_array(), I can
feed
it to extract() by itself and it works as predicted and documented.

However, if I do the above, where I want to make sure that the text
fields
(from the db) that I'm using have the commas stripped out of them,
extract() chokes with a Warning: Bad datatype for extract().

I'm sure there are no commas in the key names, so those shouldn't be
altered.  My only assumption is that str_replace returns array
results without keys, even though it should take and return mixed
subjects, correct?

I may just be missing something obvious here, so have pity on a poor
soul.
You've all been there.  (And one of the problems may be that I'm
working
off of PHP 4.0.3...)


$leepless_in_seattle(me);



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




RE: [PHP] Re: php - assigning date variables

2002-02-26 Thread Tim Ward

How about SELECT * FROM table WHERE date = '$startdate' AND date =
'$enddate';
You can then define startdate and enddate depending on whether you want a
date earlier later or the same i.e. if the same then make startdate and
enddate the date you want, if earlier then make the startdate blank, etc.

Tim Ward
Internet chess www.chessish.com http://www.chessish.com 

--
From:  Craig Westerman [SMTP:[EMAIL PROTECTED]]
Sent:  25 February 2002 19:32
To:  Lerp
Cc:  [EMAIL PROTECTED]
Subject:  RE: [PHP] Re: php - assigning date variables

Joe,

I don't want to change the query itself like you show. I want to use
this
query

$query = 
mysql_query(SELECT * FROM table WHERE date LIKE '%. $query .%');

and change only the variable $query = 

I use $query throughout script for other things.

Thanks

Craig 
[EMAIL PROTECTED]


Hi there :)

1. mysql_query(SELECT * FROM table WHERE date ='$mydate');   #
where date
is same
2. mysql_query(SELECT * FROM table WHERE date  '$mydate');  #
where date
is newer
3. mysql_query(SELECT * FROM table WHERE date  '$mydate');  #
where date
is older
4.mysql_query(SELECT * FROM table WHERE date BETWEEN '$myfirstdate'
AND
'$myseconddate'); # where date is between 2 dates

Hope this helps, Joe :)



Craig Westerman [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 $query = 
 mysql_query(SELECT * FROM table WHERE date LIKE '%. $query
.%');
 // returns all items in database


 $query = 2001-01-01
 mysql_query(SELECT * FROM table WHERE date LIKE '%. $query
.%');
 // returns all rows that have 2001-01-01 as the date


 What is proper way to define a variable to include all dates newer
than
 1995-01-01?
 $query = ???

 What is proper way to define a variable to include all dates older
than
 1995-01-01?
 $query = ???

 What is proper way to define a variable to include all  dates
between
 1995-01-01 and 1998-12-31?
 $query = ???


 Everything I tried gives me a error. This has to be simple, but I
must be
 overlooking something. Where would I find the answer?

 Thanks

 Craig 
 [EMAIL PROTECTED]




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


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




[PHP] RE: word wrapping again

2002-02-26 Thread Tim Ward

This is really an html issue. HTML will only text wrap (in a compliant
browser) on white space. If you want a server side solution to solve this
you'll need to break up long words with a space or line-break.

Tim Ward
Internet chess www.chessish.com http://www.chessish.com 

--
From:  Michael P. Carel [SMTP:[EMAIL PROTECTED]]
Sent:  26 February 2002 04:37
To:  php
Subject:  word wrapping again

Hi there,

Is there any function that can i used in wrapping a continuous line
of words
that will be displayed in the HTML table  to avoid destroying its
table
format. I've tried wordwrapping function but it only wraps word with
spaces
between them. I have a REPORT NO. that is  continously incrementing
that's
why i need that approach. The table will be destroyed if it contains
a
continuous line of alhanumeric numbers.

Please help.



Regards,
Mike


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




RE: [PHP] overwriting PHP_SELF and PHP_AUTH_xxxx

2002-02-22 Thread Tim Ward

Forgive me if I'm treating pseudo as real but surely 
print trtd ...  value='$cancel[$or]' ... /td;
should be
print trtd ...  value='{$cancel[$or]}' ... /td;

same goes for the array element in the sql statement

Tim Ward
Internet chess www.chessish.com http://www.chessish.com 

--
From:  Michael Romagnoli [SMTP:[EMAIL PROTECTED]]
Sent:  22 February 2002 12:21
To:  [EMAIL PROTECTED]
Subject:  Re: [PHP] overwriting PHP_SELF and PHP_AUTH_


I have a special set of information retrieved from a while loop that
I would
like a person to be able to edit and send back into a MySQL table.

I know all of the basic MySQL commands for doing such, but the PHP
side to
get the input from the form to go in is really stumping me.

This is what I have:

-

$or = 0;

while($or  $orderidrows) {

$orderinfo = mysql_fetch_row($orderidinfo);
$domain[$or] = $orderinfo[2];
$cancel[$or] = $orderinfo[3];

print trtdfont size=2 face=Arial
$domain[$or]/font/tdtdfont
size=2 face=ArialCancel This Domain?/font/tdtdfont size=2
face=Arialinput type=text name=confirm value='$cancel[$or]'
size=3/font/td;

$or++;
}

--

The values/data I would normally insert into the MySQL from the form
would be
$confirm, based on $domain - however, in this case, I have a number
of rows
with the same
name. I've received help as far as distinguishing one row from
another -
thanks.  :)

The problem I am really having is trying to insert the data back
into one
particular table.  You see, when I select the data, I get multiple
orderid's with multiple domains attached to them.  When I try to
UPDATE the
MySQL with the data, only the last orderid seems to be the one
getting
updated.  And, to boot, I want to update based on the domain name
(since
that is unique) and ignore the orderids.  I only used the orderids
to pull
the data out.

So, I've been using a query like this in a loop;

$update = UPDATE table2 SET cancel='$cancel[$a]' WHERE domain =
$domain[$a]

Any suggestions?  I'm getting pretty desparate here!  :\

Thanks,

-Mike


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




[PHP] RE: timestamp confusion

2002-02-21 Thread Tim Ward

Time() returns unix timestamp (which is GMT), date() is interpreting that
according to the local time zone. 
Tim Ward
internet chess at www.chessish.com http://www.chessish.com 

--
From:  Justin French [SMTP:[EMAIL PROTECTED]]
Sent:  21 February 2002 03:21
To:  php
Subject:  timestamp confusion

hi,

when people add something to a table, i'm logging the time()...
later,
when I pull it out, i'm doing something like date('d M Y',$stamp),
which
all works fine, printing something like 21 Jan 2002.

problem is, i'm on a server in canada, but 99% of my users will be
in Australia.

to get an idea of the time difference, I made a simple php file
called
time on both my local test server and the live server:

?

$stamp = time();
echo $stamp.BR;
echo date('d M Y H:m:s', $stamp);

?

I ran both scripts within 5 seconds of each other, and got the
following:

local:
1014261839
21 Feb 2002 14:02:59

live:
1014260440
20 Feb 2002 21:02:40


So, if I look at the second line of the output, they're about 17
hours
behind me, but if I look at the first line [time()] (according to
the
manual, the number of seconds since that date in 1970 i think), I
get a
way different result:

1014261839 - 1014260440 = 1399 seconds difference, about 23 minutes.


I want to be able to determine the $difference between the two
stamps in
seconds, then do something like:
?
echo date('d M Y',$stamp - $difference);
?


Seems easy enough, but 1399 doesn't seem right to me!

Where have I lost the plot???


Justin French
http://indent.com.au
http://soundpimps.com

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




[PHP] RE: novice question -- array_push($real[$i][$j],$s[$j]);????????

2002-02-20 Thread Tim Ward

Array_push() takes an array as it's first parameter. In your case you have
an array of arrays (NOT a 2 dimensional array) and to add an element on to
the end of one of them you need to pass the name of the element of the top
level array you want to add an element to into the function.

I.e. if you have
$fred[0] = array(1,2,3);
$fred[1] = array(4,5,6);

array_push($fred[1], 7)

will leave
$fred[0] = array(1,2,3);
$fred[1] = array(4,5,6,7);

or 

array_push($fred[0], 7)

will leave
$fred[0] = array(1,2,3,7);
$fred[1] = array(4,5,6);

Tim Ward
www.chessish.com http://www.chessish.com 

--
From:  brendan conroy [SMTP:[EMAIL PROTECTED]]
Sent:  20 February 2002 12:27
To:  [EMAIL PROTECTED]
Subject:  novice question --
array_push($real[$i][$j],$s[$j]);

Hi, thanks for reading this,
Iam trying to push elements into a two dimentional array, but I cant
find 
the proper syntax, I'd be grateful if someone could email me the
proper 
method. Iam using the normal method, which worked fine for a one
dimentional 
array, but when I use it for a two dimentional array, it doesnt seem
to 
recognise that is an array, even though I initialized the array with

$real[0][0] = 0;.

Thanks a million for your time,


Bren

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


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




RE: [PHP] What Do You Think?

2002-02-19 Thread Tim Ward

Timothy Taylor's and Sam Smith's are much better example of Yokshire beer. I
know people who've found bottled Sam's all over the world

Tim Ward
www.chessish.com http://www.chessish.com 

--
From:  Richard Crawford [SMTP:[EMAIL PROTECTED]]
Sent:  15 February 2002 19:56
To:  Erik Price
Cc:  hugh danaher; Arik Ashepa; php
Subject:  Re: [PHP] What Do You Think?

Tetley's is good stuff.

Try Old Nick.  Only beer I've found that needs a chaser.


On Fri, 2002-02-15 at 11:52, Erik Price wrote:
 
 On Friday, February 15, 2002, at 02:40  PM, Richard Crawford
wrote:
 
  Hmm.  I'd also be interested in a Guinness Finder site.  Plug
in your
  zip code, and you get a list of all of the pubs and bars in your
area
  that serve draft Guinness.  I could support a site like that, or
help
  build one.
 
 
 Guiness lovers have it easy.  My favorite beer, of all time, which
I 
 love with a passion far greater than the zeal of any Guinness
drinker on 
 this list, is Tetley's English Ale.  I live for that stuff.
 
 Not only can I hardly find a place with Tetley's on tap, I can
hardly 
 find it in stores!
 
 
 LOVE Tetley's.
 
 
 Erik
 
 
 
 
 Erik Price
 Web Developer Temp
 Media Lab, H.H. Brown
 [EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
-- 
Sliante,
Richard S. Crawford

mailto:[EMAIL PROTECTED]  http://www.mossroot.com
AIM:  Buffalo2K   ICQ: 11646404  Yahoo!: rscrawford
MSN:  [EMAIL PROTECTED]

It is only with the heart that we see rightly; what is essential is
invisible to the eye.  --Antoine de Saint Exupery

Push the button, Max!



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




RE: [PHP] HTTP_POST_VARS problem

2002-02-08 Thread Tim Ward

Make the name of the select an array
e.g. select name='selection[]' ...

then ...
foreach($HTTP_POST_VARS[selection] as $selection)

Tim
www.chessish.com http://www.chessish.com 

--
From:  [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
Sent:  08 February 2002 02:47
To:  [EMAIL PROTECTED]
Subject:  Re: [PHP] HTTP_POST_VARS problem

Please ignore my question - I just figured it out. I had the
method=post
in the input type=submit tag rather than in the form tag. It
works!

However, if one has an HTML select/option menu scrolling list with
multiple
selections, how does one get the number of values for the same name
with
HTTP_POST_VARS? Or how does one scroll through the list of choices
passed?
Thanks,

Eurico

[EMAIL PROTECTED] wrote:

 Hi. I'm a newbie at this and am having problems understanding how
this
 works.

 I have a form with method=post. The server program does display
 REQUEST_STRING as I expect (e.g., choice=yes but displaying
 HTTP_POST_VARS[choice] is null). However, displaying
 HTTP_GET_VARS[choice] does display yes. Running phpinfo()
displays
 that the REQUEST_METHOD = GET. Why is this GET and how do I get it
set
 to POST? How do I get HTTP_POST_VARS to work since my form does
have
 method=post?

 Here are some php.ini settings (I'm running PHP 4.1.1 with Apache
1.3.22

 under Win98):

 variables_order = EGPCS
 register_globals = On
 register_argc_argv = On
 gpc_order = GPC

 Thanks...

 Eurico
 [EMAIL PROTECTED]

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


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




RE: [PHP] Limit 15 where Newest

2002-02-05 Thread Tim Ward


If (!$start) $start=0;
$sql=select author, title, chapter from table order by date DESC
limit $start, 15;
...

and a link on the same page:
echo(a href='samepage?start= . ($start + 15) . 'next/a);

or something like that

Tim
www.chessish.com http://www.chessish.com 


--
From:  Tyler Longren [SMTP:[EMAIL PROTECTED]]
Sent:  05 February 2002 04:49
To:  WIll; [EMAIL PROTECTED]
Subject:  Re: [PHP] Limit 15 where  Newest

$sql=select author, title, chapter from table order by date DESC
limit 15;

That's how you'd go about getting the 15 most recent table entries.
The
next 15 thing will require a bit more though.

Tyler

- Original Message -
From: WIll [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 04, 2002 9:37 PM
Subject: [PHP] Limit 15 where Newest


 I am trying to write a limit statement for my database. I want to
say
 something like

 $sql=select author, title, chapter from database where
last_update =
 Newest order by date limit 15;

 My question is how do you say  Newest in php MySQL?
 And how do you put t link on the bottom of the page that will
select the
 next 15 items in the database?

 Thank you.

 --WIll

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




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




[PHP] RE: Initializing Array

2002-01-29 Thread Tim Ward

As far as using them is concerned they are already zero (as indeed are
undefined elements). If you want force the type you'll have to step through
the array.

$pos[17][7][3] = 0; // will only set the value of that element, in PHP or C

Tim
www.chessish.com http://www.chessish.com 

--
From:  pong-TC [SMTP:[EMAIL PROTECTED]]
Sent:  28 January 2002 19:07
To:  [EMAIL PROTECTED]
Subject:  Initializing Array

Hello All

I would like to initialize the array $pos[17][7][3] to zero.  Can i
do
like in C ie. $pos[17][7][3] = 0;?  Or, will I have to do initialize
every
single element of array to zero by using loop?

Thank you.
Pong


-- 
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]




[PHP] RE: phpwiki save button

2002-01-24 Thread Tim Ward

What is it you actually want to do? Add the current date/time or a timestamp
entered on the submitting form? See date() for the former. Once you've got
your stamp in a format you want just add it to the front of the story before
saving. Give us a bit more detail about what it is that isn't working, or
the code that you want to modify.

(also) Tim
www.chessish.com http://www.chessish.com 

--
From:  Tim Bogart [SMTP:[EMAIL PROTECTED]]
Sent:  23 January 2002 17:47
To:  [EMAIL PROTECTED]
Subject:  phpwiki save button

Hello everybody.  My name is Tim and I am new to this list.  I am
not a 
programmer and don't even play one on tv.  

I've recently installed and have started to attempt to customize
phpwiki.  I 
need to modify the way the save button works.  I not only need it
to do the 
save, but I would like it to append a date and time stamp to the
text being 
posted to the wiki.  My first choice would that the line of text
being typed 
would be prefixed with the stamp rather than slapping it on the end.
This I 
believe would be the most ergonomically convienient for those
reading that 
which has been posted.

Is there anybody out there willing to give me a hand.  

TIA,

Tim B.

-- 
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]




[PHP] RE: One Line text boxes vs. Multiline text boxes

2002-01-24 Thread Tim Ward

Sounds to like you're not putting the value in quotes.
i.e. input type=text value=fred you can get away with input type=text
value=tom,dick and harry you can't.
textarea's (what I assume you are referring to as multiline text boxes)
are different as the value goes between the tabs and seems to be treated as
prefdefined text (like between PRE tags)

Tim
www.chessish.com http://www.chessish.com 

--
From:  Phil Schwarzmann [SMTP:[EMAIL PROTECTED]]
Sent:  23 January 2002 17:13
To:  [EMAIL PROTECTED]
Subject:  One Line text boxes vs. Multiline text boxes

For some reason, when a user enters information into a form field
that's
only one line, it might enter the database differently than if it
was a
multiline text box.
 
Anything characters after a blank space or a comma will get deleted
if
it is entered into a single-line text box.  But if I make it a
multiline
text box, it enters all the information correctly.
 
Why is this??

-- 
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]




[PHP] RE: phpwiki save button

2002-01-24 Thread Tim Ward

I think you just need to add the timestamp to the start of the story before
you save it,
i.e.
$content = date(d/m/Y H:i:s - ) . $content;

or am I missing something?


Tim
www.chessish.com

 -Original Message-
 From: Tim Bogart [SMTP:[EMAIL PROTECTED]]
 Sent: 24 January 2002 15:01
 To:   Tim Ward; [EMAIL PROTECTED]
 Subject:  Re: phpwiki save button
 
 On Thursday 24 January 2002 06:36 am, Tim Ward wrote:
  What is it you actually want to do? Add the current date/time or a
  timestamp entered on the submitting form? 
 
 yes.  That is exactly what I wish to do.
 
 See date() for the former. Once
  you've got your stamp in a format you want just add it to the front of
 the
  story before saving. Give us a bit more detail about what it is that
 isn't
  working, or the code that you want to modify.
 
 The following is the savepage.php script.  It (in as much as I can figure)
 is 
  what is executed when one pushes or clicks on the save button when
 phpwiki 
 is serving up theeditpage.html file to a user on his or her browser, and
 
 the individual is finished editing, and wishes to save their entry.  The 
 save button is at the bottom of the edit page.  What I wish to have
 happen 
 is, to have the save button do what it does now, save the changes, but in 
 addition to that, if I had my perfect world, I would like this
 savepage.php 
 script prefix the edited text with a date and time stamp on the left side
 of 
 the page, appearing as a (redundancy here) prefix to the typed material.  
 That way each entry would have a date and time stamp.  I hope I am
 describing 
 this in a fashon you can understand.  Let me give you an example.  One
 types 
 ...
 
 This is a good day.
 
 Then the individual pushes the save button.  The save is executed, and the
 
 user is bounced back to the preview page (the preview page part happens as
 a 
 result simply of how the thing just works).  When the preview page is 
 displayed, the newly added text appears, but looks like this...
 
 2002 01/24 09:33:45  This is a good day.
 
 The format of the date and time are really fluff to me, as long as it
 appears.
 
 I hope my description is understandable.  I eagerly await your response.
 
 Tim B.
 
 Here's the script...
 
 -
 
 s_id('$Id: savepage.php,v 1.17 2001/11/14 21:05:38 dairiki Exp $'); 
 require_once('lib/Template.php'); 
 require_once('lib/transform.php'); 
 require_once('lib/ArchiveCleaner.php'); 
  
 /* All page saving events take place here. All page info is also taken
 care 
 of here. This is klugey. But it works. There's probably a slicker way of 
 coding it. 
 */ 
  
 // FIXME: some links so that it's easy to get back to someplace useful
 from 
 these // error pages. 
  
 function ConcurrentUpdates($pagename) { /* xgettext only knows about c/c++
 
 line-continuation strings is does not know about php's dot operator. We
 want 
 to translate this entire paragraph as one string, of course. 
 */ 
 $html = p; $html .= gettext (PhpWiki is unable to save your changes, 
 because another user edited and saved the page while you were editing the 
 page too. If saving proceeded now changes from the previous author would
 be 
 lost.); 
 $html .= /p\np; $html .= gettext (In order to recover from this 
 situation follow these steps:); 
 $html .= \nolli; $html .= gettext (Use your browser's bBack/b 
 button to go back to the edit page.); 
 $html .= /li\nli; $html .= gettext (Copy your changes to the
 clipboard 
 or to another temporary place (e.g. text editor).); 
 $html .= /li\nli; $html .= gettext (bReload/b the page. You
 should 
 now see the most current version of the page. Your changes are no longer 
 there.); 
 $html .= /li\nli; $html .= gettext (Make changes to the file again.
 
 Paste your additions from the clipboard (or text editor).); 
 $html .= /li\nli; $html .= gettext (Press bSave/b again.); 
 $html .= /li/ol/p\n; $html .= QElement('p', gettext (Sorry for
 the 
 inconvenience.)); 
  
 echo GeneratePage('MESSAGE', $html, sprintf (gettext (Problem while
 updating 
 %s), $pagename)); 
 ExitWiki(); 
 } 
  
 function PageIsLocked($pagename) { 
 $html = QElement('p', gettext(This page has been locked by the
 administrator 
 and cannot be edited.)); 
 $html .= QElement('p', gettext (Sorry for the inconvenience.)); 
  
 echo GeneratePage('MESSAGE', $html, sprintf (gettext (Problem while
 editing 
 %s), $pagename)); 
 ExitWiki (); 
 } 
  
 function NoChangesMade($pagename) { $html = QElement('p', gettext (You
 have 
 not made any changes.)); $html .= QElement('p', gettext (New version not
 
 saved.)); 
 echo GeneratePage('MESSAGE', $html, sprintf(gettext(Edit aborted: %s), 
 $pagename)); 
 ExitWiki (); 
 } 
  
 function BadFormVars($pagename)
 { $html = QElement('p', gettext (Bad form submission));
   $html .= QElement('p', gettext (Required form variables are
 missing.)); 
   echo GeneratePage('MESSAGE', $html, sprintf(gettext

RE: [PHP] RE: phpwiki save button

2002-01-24 Thread Tim Ward

without the full source code of the classes you are using I'd be guessing,
but within savePreview() and savePage() $content is passed to an object
method that does the saving. You could just pass date(d/m/Y H:i:s - ) .
$content instead of $content. However it looks like this may be amended from
previous versions ... if so you'll need to strip the first x characters from
the front ... but this is getting messy.

the better way to do this is with a last_updated field in the database
holding a timestamp and handle including it at the top of the text when
displaying. I'd be surprised if the table doesn't already have a field like
that. 


Tim
www.chessish.com

 -Original Message-
 From: Tim Bogart [SMTP:[EMAIL PROTECTED]]
 Sent: 24 January 2002 15:43
 To:   Tim Ward; [EMAIL PROTECTED]
 Subject:  Re: [PHP] RE: phpwiki save button
 
 No, you're not missing a thing.  I just need to know exactly where to put
 the 
 line you sent me.  The word content is mentioned a few times in the
 script 
 and I'm not a programmer, remember?  Could you please indicate exactly
 where 
 you would put the line you sent me?  I'm sure you are taking for granted
 that 
 I know more than I seem, but I don't.  I'm a newbie at this and have to
 have 
 my nose put down into it before I understand.  Where should I put the
 line?
 
 Thanks!
 
 Tim
 
 On Thursday 24 January 2002 10:07 am, Tim Ward wrote:
  I think you just need to add the timestamp to the start of the story
 before
  you save it,
  i.e.
  $content = date(d/m/Y H:i:s - ) . $content;
 
  or am I missing something?
 
 
  Tim
  www.chessish.com
 
   -Original Message-
   From: Tim Bogart [SMTP:[EMAIL PROTECTED]]
   Sent: 24 January 2002 15:01
   To:   Tim Ward; [EMAIL PROTECTED]
   Subject:  Re: phpwiki save button
  
   On Thursday 24 January 2002 06:36 am, Tim Ward wrote:
What is it you actually want to do? Add the current date/time or a
timestamp entered on the submitting form?
  
   yes.  That is exactly what I wish to do.
  
   See date() for the former. Once
  
you've got your stamp in a format you want just add it to the front
 of
  
   the
  
story before saving. Give us a bit more detail about what it is that
  
   isn't
  
working, or the code that you want to modify.
  
   The following is the savepage.php script.  It (in as much as I can
   figure) is
what is executed when one pushes or clicks on the save button when
   phpwiki
   is serving up theeditpage.html file to a user on his or her browser,
   and
  
   the individual is finished editing, and wishes to save their entry.
 The
   save button is at the bottom of the edit page.  What I wish to have
   happen
   is, to have the save button do what it does now, save the changes, but
 in
   addition to that, if I had my perfect world, I would like this
   savepage.php
   script prefix the edited text with a date and time stamp on the left
 side
   of
   the page, appearing as a (redundancy here) prefix to the typed
 material.
   That way each entry would have a date and time stamp.  I hope I am
   describing
   this in a fashon you can understand.  Let me give you an example.  One
   types
   ...
  
   This is a good day.
  
   Then the individual pushes the save button.  The save is executed, and
   the
  
   user is bounced back to the preview page (the preview page part
 happens
   as a
   result simply of how the thing just works).  When the preview page is
   displayed, the newly added text appears, but looks like this...
  
   2002 01/24 09:33:45  This is a good day.
  
   The format of the date and time are really fluff to me, as long as it
   appears.
  
   I hope my description is understandable.  I eagerly await your
 response.
  
   Tim B.
  
   Here's the script...
  
   -
  
   s_id('$Id: savepage.php,v 1.17 2001/11/14 21:05:38 dairiki Exp $');
   require_once('lib/Template.php');
   require_once('lib/transform.php');
   require_once('lib/ArchiveCleaner.php');
  
   /* All page saving events take place here. All page info is also taken
   care
   of here. This is klugey. But it works. There's probably a slicker way
 of
   coding it.
   */
  
   // FIXME: some links so that it's easy to get back to someplace useful
   from
   these // error pages.
  
   function ConcurrentUpdates($pagename) { /* xgettext only knows about
   c/c++
  
   line-continuation strings is does not know about php's dot operator.
 We
   want
   to translate this entire paragraph as one string, of course.
   */
   $html = p; $html .= gettext (PhpWiki is unable to save your
 changes,
   because another user edited and saved the page while you were editing
 the
   page too. If saving proceeded now changes from the previous author
 would
   be
   lost.);
   $html .= /p\np; $html .= gettext (In order to recover from this
   situation follow these steps:);
   $html .= \nolli; $html

RE: [PHP] Nobody know nothing about? Php login scripts using PHP4.01, Apache3.01 CGI on W2K

2002-01-22 Thread Tim Ward

Use html form for user input with text field for user name and password
filed for password. Hold password encrypted using MySQL password() function
and check login by SELECT * FROM users WHERE user='$user' AND
pass=PASSWORD($password). If (mysql_num_rows($result)) login = true;

Tim
www.chessish.com http://www.chessish.com 

--
From:  [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
Sent:  21 January 2002 19:58
To:  [EMAIL PROTECTED]
Subject:  [PHP] Nobody know nothing about?  Php login scripts
using PHP4.01, Apache3.01 CGI on W2K


Atte. Ignacio Estrada F.
Centro Nacional de Control de Energia
Area de Control Occidental
025+6463, 025+6464, 025+6469



ignacio.estrada@
cfe.gob.mx  Para:
[EMAIL PROTECTED]
cc:
01/21/2002 09:34Asunto:  [PHP] Php
login scripts using PHP4.01, Apache3.01 CGI on W2K





Hi, am looking for good samples scripts for authentication, but I am
using
the CGI version of Apache.   However could be a good way for make
authentication using some file or database as the source for the
login name
and so on.

Please let me know if you know where exists a good samples scripts
for
that.

Greetings!!

Atte. Ignacio Estrada F.
Centro Nacional de Control de Energia
Area de Control Occidental
025+6463, 025+6464, 025+6469


--
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]






-- 
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]




[PHP] RE: file upload with story

2002-01-22 Thread Tim Ward

I found everything I needed to upload images here:
http://www.php.net/manual/en/features.file-upload.php
http://www.php.net/manual/en/features.file-upload.php 

Tim
www.chessish.com http://www.chessish.com 

--
From:  will hives [SMTP:[EMAIL PROTECTED]]
Sent:  21 January 2002 23:01
To:  [EMAIL PROTECTED]
Subject:  file upload with story

Please can someone help, I can't find any answers anywhere

I have this code:

?

$db_name = name;

$table_name = my_contacts;

$connection = @mysql_connect(www.myserver.net, username,
password) or
die (couldn't connect.);

$db = @mysql_select_db($db_name, $connection) or die (couldn't
select
database.);

$sql = INSERT INTO $table_name
(id, fname, lname, address1, address2, address3, postcode, country,
prim_tel, sec_tel, fax, email, birthday)
VALUES
(\\, \$fname\, \$lname\, \$address1\, \$address2\,
\$address3\,
\$postcode\, \$country\, \$prim_tel\, \$sec_tel\, \$fax\,
\$email\, \$birthday\) ;

$result = @mysql_query($sql, $connection) or die (couldn't execute
query);

?

it's really just an online contacts book, what I want to do as have
the
ability to upload an image with the record.

Then when the contact details are viewed it shows the also uploaded
image.

How do I add that code into this...any help would be fantastic.

Cheers
Will


-- 
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]




[PHP] RE: Printer funtions

2002-01-22 Thread Tim Ward

Why would you expect these functions to do anything on the client machine?
These are for printers attached to the server.

Tim
www.chessish.com http://www.chessish.com 

--
From:  James Mclean [SMTP:[EMAIL PROTECTED]]
Sent:  21 January 2002 23:48
To:  [EMAIL PROTECTED]
Subject:  Printer funtions


All,

I have been reading through the php.net printer function pages, but
from what I 
can see it does not look like the docs are that good. 

basically, I want to run through to see if any one has any pointers
before 
using the PHP printers funtions. IE does printer_open() open a
connection to 
the default printer specified on the client machine? The docs doent
eben 
specify this...

The site mentions listing the printer in php.ini, but this is not
possible in 
this instance, having to cater for printers that will be unknown to
me.

any pointers helpful! TIA.

Regards,

James Mclean
Adam Internet Web Design Team

Windows didn't get as bad as it is overnight -- it took over ten
years of 
careful development.

-- 
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] How to call Calling Non-Existing function

2002-01-22 Thread Tim Ward

This generates a parse error if Draw_Table() doesn't exist rather than
returning false, unless there's something in my set up that's different to
yours.

Tim
www.chessish.com http://www.chessish.com 

--
From:  val petruchek [SMTP:[EMAIL PROTECTED]]
Sent:  21 January 2002 11:22
To:  [EMAIL PROTECTED]
Cc:  PHP
Subject:  Re: [PHP] How to call Calling Non-Existing function

Not sure this is exactly what you need but try this:

@Draw_Table() or default_func();


Valentin Petruchek (aki Zliy Pes)
http://zliypes.com.ua
mailto:[EMAIL PROTECTED]
- Original Message -
From: S. Murali Krishna [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Monday, January 21, 2002 1:17 PM
Subject: [PHP] How to call Calling Non-Existing function



 Hi PHP Experts,

 Is there any way to call a non-existent or undeclared function
 and redirect the call to someother function by knowing its
non-existense.

 Is there any try() and catch() idea or any configurations,
 or may be either error handler like thing.

 for example if I call a function 'Draw_Table()' without declaring
like
 this

 Draw_Table();

 it should know the non-existense of Draw_Table() and redirect to
 'default_func'

 function default_func()
 {
 
 }

 Note:
 
 Perl  programmers please recollect 'AUTOLOAD' Method of a
package.
 C++,Java  programmers please recollect exception handling.


 Thanks in Advance.

 S.Murali Krishna
 [EMAIL PROTECTED]
 =
 We grow slow trying to be great

- E. Stanley Jones
 -


 --
 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]





-- 
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] RE: Printing structure and data of array

2002-01-22 Thread Tim Ward

how about ...

function ShowArray($array)
{   echo(ul);
foreach ($array as $key=$value)
{   echo(li$key)
if (is_array($value))
{   ShowArray($value);
} else
{   echo(=$value);
}
echo(/li)
}
echo(/ul);
} // end of fn ShowArray


Tim
www.chessish.com

 -Original Message-
 From: Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
 Sent: 22 January 2002 12:01
 To:   'Tim Ward'; PHP List
 Subject:  RE: [PHP] RE: Printing structure and data of array
 
 hi,
 
 how can I display the array exactly as it is the format specified??? like
 if
 their exists sub elements of elements, how could I represent them in a
 multidimensional format??
 
 I went thru most of the array functions but unable to adapt any of them..
 
 pl help..
 
 TIA,
 sands
 
 -Original Message-
 From: Tim Ward [mailto:[EMAIL PROTECTED]]
 Sent: segunda-feira, 21 de Janeiro de 2002 10:24
 To: PHP List; Daniel Alsén
 Subject: [PHP] RE: Printing structure and data of array
 
 
 Foreach($array as $key=$value) ech0($key=$valuebr);
 
 Tim
 www.chessish.com http://www.chessish.com 
 
   --
   From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
   Sent:  20 January 2002 19:33
   To:  PHP List
   Subject:  Printing structure and data of array
 
   Hi,
 
   i know i have this answered before. But i can´t find that mail in
 the
   archive.
 
   How do i print an array to see both the structure and the data
 within?
   (test = value, test2 = value2)...
 
   # Daniel Alsén| www.mindbash.com #
   # [EMAIL PROTECTED]  | +46 704 86 14 92 #
   # ICQ: 63006462   | +46 8 694 82 22  #
   # PGP: http://www.mindbash.com/pgp/  #
   
 
 -- 
 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]

--
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] RE: Printing structure and data of array

2002-01-22 Thread Tim Ward

I may have lost the original problem, but I thought you wanted a way of
displaying the structure of an array hierarchy,
e.g.
$fred[0][0] = array(length=10, width=20);
$fred[0][1] = array(length=20, width=30);
$fred[0][2] = array(length=30, width=20);
$fred[0][3] = Hello world;
$fred[1] = another string;

if this isn't what you're trying to do I apologise for misinterpreting the
question

Tim Ward
Senior Systems Engineer

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html

 -Original Message-
 From: Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
 Sent: 22 January 2002 14:42
 To:   'Tim Ward'; PHP List
 Subject:  RE: [PHP] RE: Printing structure and data of array
 
 
 nope...
 
 It continues to print in a single column indexed from 0 to  It does
 not
 print the sub elements as sub elements.
 
 any more ideas???
 
 regards,
 sands
 -Original Message-
 From: Tim Ward [mailto:[EMAIL PROTECTED]]
 Sent: terça-feira, 22 de Janeiro de 2002 12:56
 To: Sandeep Murphy; PHP List
 Subject: RE: [PHP] RE: Printing structure and data of array
 
 
 how about ...
 
 function ShowArray($array)
 { echo(ul);
   foreach ($array as $key=$value)
   {   echo(li$key)
   if (is_array($value))
   {   ShowArray($value);
   } else
   {   echo(=$value);
   }
   echo(/li)
   }
   echo(/ul);
 } // end of fn ShowArray
 
 
   Tim
   www.chessish.com
 
  -Original Message-
  From:   Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
  Sent:   22 January 2002 12:01
  To: 'Tim Ward'; PHP List
  Subject:RE: [PHP] RE: Printing structure and data of array
  
  hi,
  
  how can I display the array exactly as it is the format specified???
 like
  if
  their exists sub elements of elements, how could I represent them in a
  multidimensional format??
  
  I went thru most of the array functions but unable to adapt any of
 them..
  
  pl help..
  
  TIA,
  sands
  
  -Original Message-
  From: Tim Ward [mailto:[EMAIL PROTECTED]]
  Sent: segunda-feira, 21 de Janeiro de 2002 10:24
  To: PHP List; Daniel Alsén
  Subject: [PHP] RE: Printing structure and data of array
  
  
  Foreach($array as $key=$value) ech0($key=$valuebr);
  
  Tim
  www.chessish.com http://www.chessish.com 
  
  --
  From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
  Sent:  20 January 2002 19:33
  To:  PHP List
  Subject:  Printing structure and data of array
  
  Hi,
  
  i know i have this answered before. But i can´t find that mail in
  the
  archive.
  
  How do i print an array to see both the structure and the data
  within?
  (test = value, test2 = value2)...
  
  # Daniel Alsén| www.mindbash.com #
  # [EMAIL PROTECTED]  | +46 704 86 14 92 #
  # ICQ: 63006462   | +46 8 694 82 22  #
  # PGP: http://www.mindbash.com/pgp/  #
  
  
  -- 
  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]

--
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]




  1   2   3   >