[PHP] need some help on stratagy... (php/mysql/javascript)

2002-07-23 Thread Alexander Ross

I have an embedded object in my webpage which will play a DVD movie right in
the page (provided you have a disc in teh dvdrom drive).  One of the
javascript methods attached to this object returns the current time.  OK, on
to the php/mysql part.  I have a mysql database which has a table to catalog
camera shots digramed like so:
___
|*shot_num|
|  start_time|
|  end_time |
|__|  * = primary key

During play, I have a javascript function which continuously gets teh
current time and puts it in an input field called cur_time (clever huh?).
So my question is... what is the best way to have a second field called
shot_num which is continuously changing?  It can't be good to query the
database continuously, even if it is a small query, can it?  What is a good
stratagy to work with here?  I'm still a bit of a novice with php/mysql, so
be gentle.

Thanks
Alex Ross
[EMAIL PROTECTED]




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




[PHP] date

2002-07-24 Thread Alexander Ross

I have a column in one of my mysql tables which holds the date & time that
the record was inserted.  When I run a query later on I want to display the
date, but if the date is today or yesterday I want to display "today" or
"yesterday" instead .. how do i compare to stored date with todays date?
todays date -1?  Thanks



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




[PHP] datetime field - still a newbie

2002-07-24 Thread Alexander Ross

I have a datetime field in one of my mysql tables...when displaying some of
my records I want to display the date in the aforementioned datetime field,
but if the date is today I want to display "today" instead.  If the date is
yesterday I want it to display that  so I how do I compare the date in
my record to todays date? Thanks

Alex



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




Re: [PHP] datetime field - still a newbie

2002-07-25 Thread Alexander Ross

Thanks bunches


"John Holmes" <[EMAIL PROTECTED]> wrote in message
001101c233ba$3de3d430$b402a8c0@mango">news:001101c233ba$3de3d430$b402a8c0@mango...
> > I have a datetime field in one of my mysql tables...when displaying
> some
> > of
> > my records I want to display the date in the aforementioned datetime
> > field,
> > but if the date is today I want to display "today" instead.  If the
> date
> > is
> > yesterday I want it to display that  so I how do I compare the
> date in
> > my record to todays date? Thanks
>
> I posted this response earlier...did you get it? Are you looking for a
> MySQL solution or a PHP solution??
>
> SELECT IF(TO_DAYS(CURDATE()) =
> TO_DAYS(date_column),'Today',IF(TO_DAYS(CURDATE())-1 =
> TO_DAYS(date_column),'Yesterday',date_column)) FROM your_table;
>
> If you want a PHP solution, then just select the regular MySQL date
> format MMDD and use something like this when looping through your
> results.
>
> switch($your_row['Date_Column'])
> {
>   case date("Ymd"):
> echo "Today";
> break;
>   case date("Ymd",strtotime("-1 day")):
> echo "Yesterday";
> break;
>   default:
> echo $your_row['Date_Column'];
> }
>
> Untested code, of course...
>
> ---John Holmes...
>
>
>



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




[PHP] invalid use of group function (mysql)

2002-07-26 Thread Alexander Ross

Why am I getting this error?  My statement is:

SELECT * FROM shots WHERE shot_num = MAX(shot_num) LIMIT 1;


There is one record in the table "shots".  Its shot_num value is 0.



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




[PHP] spiffy error handling ...

2002-08-09 Thread Alexander Ross

This may be kids play for some of you, but I figured this out and thought
I'd share...

$connect = connect-to-db() or (alert("error") xor die());

or

$connect = connect-to-db() or (alert("error") xor return(false));

It makes for much cleaner code than what I used to do:

$connect = connect-to-db()
if (!$connect){
  alert("Error");
  return(false);
}

Alex



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




[PHP] Re: spiffy error handling ...

2002-08-09 Thread Alexander Ross

p.s.  alert is a simple function I wrote to call a javascript alert window.


"Alexander Ross" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> This may be kids play for some of you, but I figured this out and thought
> I'd share...
>
> $connect = connect-to-db() or (alert("error") xor die());
>
> or
>
> $connect = connect-to-db() or (alert("error") xor return(false));
>
> It makes for much cleaner code than what I used to do:
>
> $connect = connect-to-db()
> if (!$connect){
>   alert("Error");
>   return(false);
> }
>
> Alex
>
>



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




[PHP] including a php file in an html doc

2002-08-11 Thread Alexander Ross

I have a .php file whose purpose, ultimately, is to set one variable;
$hotspot.  Now I want to include that var in a bunch of places in my html
page (it must remain html).  So this was my thought.  In the  include
the following:



and then anywhere in the html doc I want to print the value of $hotspot I
type:



but it doesn't work.  I have a feeling I cant include a php script that way
because in trying to debug the problem I made the first line of hotspot.php
= echo "test"; and the word test never shows.  What am I missing?

Thnks
Alex





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




[PHP] Re: including a php file in an html doc

2002-08-12 Thread Alexander Ross

I still seem to be missing something.  I guess the easiest thing for me to
do is just show you my code.  All I want is to be able to reference the
$hotspots array from any .html page oon my site.  I thought I could include
hotspot.php and then reference the array using  syntax.  What should I
do?  The one requirement is that I cannot make all my pages PHP. They must
be html.

HTML PAGE (test.html):


Untitled Document









PHP PAGE (hotspot.php):



"Bogdan Stancescu" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Alexander!
>
> You're missing the distinction between a server-side script (PHP) and a
> client-side script (JavaScript, VB etc). When you use the syntax you
> used, the browser attempts to download the src and execute it - and it
> can't do that, because in the best case the php code runs on the server
> and returns "test" (your echo()) and then it "tries" to run that as php
> code, which again it doesn't know how. It does work for JavaScript
> however, because it downloads the JavaScript file (which is plain text)
> and then executes the code (because it knows how to execute JavaScript).
>
> What you should do would be write
> 
> instead of "
> Bogdan
>
> Alexander Ross wrote:
> > I have a .php file whose purpose, ultimately, is to set one variable;
> > $hotspot.  Now I want to include that var in a bunch of places in my
html
> > page (it must remain html).  So this was my thought.  In the <head>
include
> > the following:
> >
> > <script language="php" src="hotspot.php">
> >
> > and then anywhere in the html doc I want to print the value of $hotspot
I
> > type:
> >
> > 
> >
> > but it doesn't work.  I have a feeling I cant include a php script that
way
> > because in trying to debug the problem I made the first line of
hotspot.php
> > = echo "test"; and the word test never shows.  What am I missing?
> >
> > Thnks
> > Alex
> >
> >
> >
> >
>



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




RE: [PHP] Re: including a php file in an html doc

2002-08-12 Thread Alexander Ross

So is there any way to accomplish what I want to using php without
naming the files *.php??

-Original Message-
From: Brian V Bonini [mailto:[EMAIL PROTECTED]] 
Sent: Monday, August 12, 2002 10:11 AM
To: Alexander Ross; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: including a php file in an html doc

Because your trying to put PHP directives in an html file. Your web
server
does not know to parse html files as php files unless you tell it to do
so.



> -Original Message-
> From: Alexander Ross [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 12, 2002 9:50 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: including a php file in an html doc
>
>
> I still seem to be missing something.  I guess the easiest thing for
me to
> do is just show you my code.  All I want is to be able to reference
the
> $hotspots array from any .html page oon my site.  I thought I
> could include
> hotspot.php and then reference the array using  syntax.
> What should I
> do?  The one requirement is that I cannot make all my pages PHP. They
must
> be html.
>
> HTML PAGE (test.html):
> 
> 
> Untitled Document
> 
> 
> 
>
> 
> 
> 
> 
>
> PHP PAGE (hotspot.php):
>  include_once("../board/db_fns.php");
>
> echo "hotspot = ".$hotspots;
>
> if (!isset $hotspots){
>   $connect = connect_to_db();
>   $query = "SELECT * FROM hotspots";
>   $result = mysql_query($query);
>   $count = mysql_numrows($result);
>
>   $hotspots = array();
>   for($i=0;$i<$count;$i++)
>   {
> $hotspot = mysql_fetch_assoc($result);
>  $hotspots[$hotspot['hotspot']]=$hotspot['val'];
>   }
>   print_r($hotspots);
> }
> ?>
>
>
> "Bogdan Stancescu" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi Alexander!
> >
> > You're missing the distinction between a server-side script (PHP)
and a
> > client-side script (JavaScript, VB etc). When you use the syntax you
> > used, the browser attempts to download the src and execute it - and
it
> > can't do that, because in the best case the php code runs on the
server
> > and returns "test" (your echo()) and then it "tries" to run that as
php
> > code, which again it doesn't know how. It does work for JavaScript
> > however, because it downloads the JavaScript file (which is plain
text)
> > and then executes the code (because it knows how to execute
JavaScript).
> >
> > What you should do would be write
> > 
> > instead of " >
> > Bogdan
> >
> > Alexander Ross wrote:
> > > I have a .php file whose purpose, ultimately, is to set one
variable;
> > > $hotspot.  Now I want to include that var in a bunch of places in
my
> html
> > > page (it must remain html).  So this was my thought.  In the
<head>
> include
> > > the following:
> > >
> > > <script language="php" src="hotspot.php">
> > >
> > > and then anywhere in the html doc I want to print the value
> of $hotspot
> I
> > > type:
> > >
> > > 
> > >
> > > but it doesn't work.  I have a feeling I cant include a php
> script that
> way
> > > because in trying to debug the problem I made the first line of
> hotspot.php
> > > = echo "test"; and the word test never shows.  What am I missing?
> > >
> > > Thnks
> > > Alex
> > >
> > >
> > >
> > >
> >
>
>
>
> --
> 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] switch statement question

2002-08-13 Thread Alexander Ross

Say i have a variable $string_var = "Once upon a time";

is there a way to do this:

Switch($string_var)
{
  case(contains "Once"):
   doSomething();
   break;
  case(contains "the end.")
   doOtherThing();
   break;
  case(contains "time")
   doNothing();
   break;
  default:
echo "ERROR"
}

Thanks
Alex




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




[PHP] newbie array question

2002-08-13 Thread Alexander Ross

If I have a string variable that is already of the form
('item','item2','item3')   [including the parens and quotes in the string],
is there an easy way to change that variable into an array??
Array($var) doesn't work. Thanks



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




[PHP] mysql statement (still a semi newbie)

2002-08-14 Thread Alexander Ross

What is wrong with the statement below?  Am I using DEFAULT incorrectly?
That first column is an auto_incrementing column so i don't want any data to
get inserted there.  Thanks for you help.

INSERT INTO cast VALUES(DEFAULT, 'Rick', 'Blaine', 'Humphrey', 'Bogart',
'male');

Thanks!
Alex



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




[PHP] assoc array question

2002-08-15 Thread Alexander Ross

I have this: (note that $info is an Assoc Array

while (list ($key, $val) = each ($info))
  {
   do stuff
  }

I would like to do slightly different stuff if I'm at the very first, or
very last item in the array.  How do I do this.  Below is the pseudo code
which would be ideal:

while (list ($key, $val) = each ($info))
  {
if(onFirstKey or onLastKey)
  do fun stuff
   else
  do other stuff
  }

Please help.  Thanks




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




RE: [PHP] assoc array question

2002-08-15 Thread Alexander Ross

But what about the first position??

-Original Message-
From: Brian V Bonini [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, August 15, 2002 5:37 PM
To: Alexander Ross; [EMAIL PROTECTED]
Subject: RE: [PHP] assoc array question

Off teeh top of my novice head I think count() or sizeof() is what your
looking for.

> -Original Message-
> From: Alexander Ross [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 15, 2002 5:23 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] assoc array question
>
>
> I have this: (note that $info is an Assoc Array
>
> while (list ($key, $val) = each ($info))
>   {
>do stuff
>   }
>
> I would like to do slightly different stuff if I'm at the very first,
or
> very last item in the array.  How do I do this.  Below is the pseudo
code
> which would be ideal:
>
> while (list ($key, $val) = each ($info))
>   {
> if(onFirstKey or onLastKey)
>   do fun stuff
>else
>   do other stuff
>   }
>
> Please help.  Thanks
>
>
>
>
> --
> 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] assoc array question

2002-08-15 Thread Alexander Ross

aha!! array_keys !!!


"Brian V Bonini" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Off teeh top of my novice head I think count() or sizeof() is what your
> looking for.
>
> > -Original Message-
> > From: Alexander Ross [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, August 15, 2002 5:23 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] assoc array question
> >
> >
> > I have this: (note that $info is an Assoc Array
> >
> > while (list ($key, $val) = each ($info))
> >   {
> >do stuff
> >   }
> >
> > I would like to do slightly different stuff if I'm at the very first, or
> > very last item in the array.  How do I do this.  Below is the pseudo
code
> > which would be ideal:
> >
> > while (list ($key, $val) = each ($info))
> >   {
> > if(onFirstKey or onLastKey)
> >   do fun stuff
> >else
> >   do other stuff
> >   }
> >
> > Please help.  Thanks
> >
> >
> >
> >
> > --
> > 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] what am I missing here?

2002-08-15 Thread Alexander Ross

what am i missing here??  I have a simple if statement that wont do whats
inside it even when true.

this works:

   echo $key==$info_keys[0]; // returns 1 or 0 correctly
if($key==$info_keys[0])
  $query = $query;
else  $query = $query." and ";
$query = $query.$key."='".$val."'";

this doesn't:
 // the "$query = $query." and ";" just doesn't get executed .. nor does any
other statment I put inside the if statement

   echo $key==$info_keys[0]; // returns 1 or 0 correctly
if(!$key==$info_keys[0])// if it isn't the first item in the array
 $query = $query." and ";
$query = $query.$key."='".$val."'";



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




[PHP] +=

2002-08-19 Thread Alexander Ross

Is there a += equivilant for strings??

$string = "Hello";
$string += "world.";

I know that
  $string = $string." world.";
would work, but I keep having to do it.  Is there a shortcut?



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




[PHP] getting directory info

2002-08-27 Thread Alexander Ross

Can I use php to get a list of all the jpgs in a folder?  I want to make a
photo album type thing for a website, and I want it to be real simple (i.e.
you put photos (jpgs) in a folder called photos and upload them.  Then the
album is built dynamically using php.  Thoughts?



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




[PHP] using mapquest with php

2002-11-18 Thread Alexander Ross
I want to make a very simple form which asks for a starting city/state
and an ending city/state.  When the user hits submit, the number of miles
from city A to City B is displayed ... no directions, no maps, no exact
locations .. just the milage.  Can I use mapquest to do this?  how? Is
there another way? Thoughts?

Alex




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




[PHP] newbie: a couple basic questions

2002-07-07 Thread Alexander Ross

1) in a fuction, does a return statment automatically exit the function as
well?
2) can someone give me a better explination of $HTTP_POST_VARS



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




[PHP] newbie: question about question marks

2002-07-07 Thread Alexander Ross

Can someone explain to me what the ? does.  I have a vague idea of what it
means in a URL (please cearify that) but I haven't the slightest what it
means in php code.  Thanks for your help

Alex



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




[PHP] tree structures

2002-07-08 Thread Alexander Ross

I am creating a message board (pretty standard) using php and mysql.  In
order to manage all the posts and replies I am using a treenode structure
(so that I can recursively add, delete, display, etc...) Everything works so
far (www.bleen.net/forum).  I want to be able to display 10 posts (including
relies in that count) at a time; then have a next link and display the next
10 (you've all seen it before).  How do I modify a recursive function to
stop and start?  My display finction is listed below.

Thanks
Alexander Ross

function display($row, $start = 0)
{ //display the tree
  if($this->m_postid<>0)
  { // if this is the empty root node skip displaying
print "";
 else
   print "'#ff'>";

  // indent replies to the depth of nesting

  print "";
  print " m_postid >";
  if ($this->m_depth == 1)
print " '$this->m_title' - $this->m_poster
(".reformat_date($this->m_posted).")";
  else
print "'$this->m_title' - $this->m_poster
(".reformat_date($this->m_posted).")";
  print "";
  }
  // increment row counter to alternate colors
  $row++;

  $num_children = count($this->m_childlist);
  for($i = 0; ($i<$num_children); $i++)
  { // call display on each of this node's children
$row = $this->m_childlist[$i]->display($row);
  }

  return ($row);
 }



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




[PHP] Re: newbie: a couple basic questions

2002-07-09 Thread Alexander Ross

Thank you kindly ...


"Richard Lynch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> >1) in a fuction, does a return statment automatically exit the function
as
> >well?
>
> Yes.  Nothing more will get executed inside the function after the
"return;"
>
> Some purists claim that you should *NEVER* have a return *ANYWHERE* except
> the last line of a function.
>
> EG:
>
> # WRONG
> function divide($numerator, $denominator){
>   if ($denomiator == 0){
> return '';
>   }
>   else{
> return $numerator/$denominator;
>   }
> }
>
> # RIGHT
> function divide($numerator, $denominator){
>   $result = '';
>   if ($denominator == 0){
> $result = '';
>   }
>   else{
> $result = $numerator/$denominator;
>   }
>   return $result;
> }
>
> It probably seems "silly" here, but when your functions get to be three or
> four screenfuls long, a "return" you aren't seeing on the monitor can
> frequently get you very confused, very fast.
>
>
> >2) can someone give me a better explination of $HTTP_POST_VARS
>
> If you give somebody an HTML FORM (like those forms you fill out on-line),
> after they fill it out, the PHP page that *proccess* the FORM page will
find
> all the data in an array named $HTTP_POST_VARS.
>
> Actually, it got renamed to $_POST recently.  (The old one will still work
> for a while, but convert ASAP).
>
> Sample HTML:
>
> 
>
> 
>
> Sample PHP:
> (note the filename must match the ACTION= part above)
>
>echo "Searchkey is ", $_POST['searchkey'], "\n";
>   echo "search button was clicked: ", isset($_POST['search']), "\n";
> ?>
>
> You could even not "know" what fields are in the FORM, and just output all
> of them:
>
> (this would be a "replacement" process.php file)
>while (list($variable, $value) = each($_POST)){
> echo "$variable is $value\n";
>   }
> ?>
>
> --
> Like Music?  http://l-i-e.com/artists.htm
>



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




Re: [PHP] newbie: question about question marks

2002-07-09 Thread Alexander Ross

How bout the question marks in the following line of php generated html:



what do they mean?


"Miguel Cruz" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Sun, 7 Jul 2002, Alexander Ross wrote:
> > Can someone explain to me what the ? does.  I have a vague idea of what
> > it means in a URL (please cearify that) but I haven't the slightest what
> > it means in php code.  Thanks for your help
>
> Read about the ternary operator at:
>
>   http://www.php.net/manual/en/language.operators.comparison.php
>
> miguel
>



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




[PHP] passing objects in url

2002-07-09 Thread Alexander Ross

If $this is an object, can I have the following link?

Process

Will the URL become too long?  Will teh info get passed correctly? thanks

Alexander Ross




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




Re: [PHP] tree structures

2002-07-09 Thread Alexander Ross

Yes but the first 10 rows may or may not be the correct information to
post

Post 1 = "test1
Post 2 = "test2"
Post 3 = "re: test1"
Post 4 = "test3"
...
Post 11 = "re test1"

I think that illustrates what I mean.

Thanks for your help
Alex



"Ed Lazor" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> You're basically paging through results.  You have a SQL statement to get
> the data - just limit the statement to only draw information applicable to
> the page you're on.  Like this:
>
> select * from table limit 0,10;
>
> That will select the first 10 records.
>
> Then you can use variables.
>
> if (empty($P))
> $P = 0;
> $C = 10;
>
> select * from table limit $P, $C
>
> Make a link at the bottom
>
> $NextPage = $P + $C;
> if ($P > $C)
> $PreviousPage = $P - $C;
> else
> $PreviousPage = 0;
>
> print "Next Page";
>
> You get the idea...
>
>
>
> -Original Message-
> From: Alexander Ross [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 08, 2002 6:22 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] tree structures
>
>
> I am creating a message board (pretty standard) using php and mysql.  In
> order to manage all the posts and replies I am using a treenode structure
> (so that I can recursively add, delete, display, etc...) Everything works
so
> far (www.bleen.net/forum).  I want to be able to display 10 posts
(including
> relies in that count) at a time; then have a next link and display the
next
> 10 (you've all seen it before).  How do I modify a recursive function to
> stop and start?  My display finction is listed below.
>
> Thanks
> Alexander Ross
>
> function display($row, $start = 0)
> { //display the tree
>   if($this->m_postid<>0)
>   { // if this is the empty root node skip displaying
> print "";
>  else
>print "'#ff'>";
>
>   // indent replies to the depth of nesting
>
>   print " width=".(22*$this->m_depth)." alt='' valign = bottom>";
>   print " m_postid > 'view_post.php?postid=$this->m_postid'>";
>   if ($this->m_depth == 1)
> print " '$this->m_title' - $this->m_poster
> (".reformat_date($this->m_posted).")";
>   else
> print "'$this->m_title' - $this->m_poster
> (".reformat_date($this->m_posted).")";
>   print "";
>   }
>   // increment row counter to alternate colors
>   $row++;
>
>   $num_children = count($this->m_childlist);
>   for($i = 0; ($i<$num_children); $i++)
>   { // call display on each of this node's children
> $row = $this->m_childlist[$i]->display($row);
>   }
>
>   return ($row);
>  }
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

> This message is intended for the sole use of the individual and entity to
> whom it is addressed, and may contain information that is privileged,
> confidential and exempt from disclosure under applicable law.  If you are
> not the intended addressee, nor authorized to receive for the intended
> addressee, you are hereby notified that you may not use, copy, disclose or
> distribute to anyone the message or any information contained in the
> message.  If you have received this message in error, please immediately
> advise the sender by reply email and delete the message.  Thank you very
> much.



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




Re: [PHP] tree structures

2002-07-09 Thread Alexander Ross

Never mind .. That can't happen because of how I build the tree .. thank
you!!!



"Alexander Ross" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Yes but the first 10 rows may or may not be the correct information to
> post
>
> Post 1 = "test1
> Post 2 = "test2"
> Post 3 = "re: test1"
> Post 4 = "test3"
> ...
> Post 11 = "re test1"
>
> I think that illustrates what I mean.
>
> Thanks for your help
> Alex
>
>
>
> "Ed Lazor" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > You're basically paging through results.  You have a SQL statement to
get
> > the data - just limit the statement to only draw information applicable
to
> > the page you're on.  Like this:
> >
> > select * from table limit 0,10;
> >
> > That will select the first 10 records.
> >
> > Then you can use variables.
> >
> > if (empty($P))
> > $P = 0;
> > $C = 10;
> >
> > select * from table limit $P, $C
> >
> > Make a link at the bottom
> >
> > $NextPage = $P + $C;
> > if ($P > $C)
> > $PreviousPage = $P - $C;
> > else
> > $PreviousPage = 0;
> >
> > print "Next Page";
> >
> > You get the idea...
> >
> >
> >
> > -Original Message-
> > From: Alexander Ross [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, July 08, 2002 6:22 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] tree structures
> >
> >
> > I am creating a message board (pretty standard) using php and mysql.  In
> > order to manage all the posts and replies I am using a treenode
structure
> > (so that I can recursively add, delete, display, etc...) Everything
works
> so
> > far (www.bleen.net/forum).  I want to be able to display 10 posts
> (including
> > relies in that count) at a time; then have a next link and display the
> next
> > 10 (you've all seen it before).  How do I modify a recursive function to
> > stop and start?  My display finction is listed below.
> >
> > Thanks
> > Alexander Ross
> >
> > function display($row, $start = 0)
> > { //display the tree
> >   if($this->m_postid<>0)
> >   { // if this is the empty root node skip displaying
> > print "";
> >  else
> >print "'#ff'>";
> >
> >   // indent replies to the depth of nesting
> >
> >   print " > width=".(22*$this->m_depth)." alt='' valign = bottom>";
> >   print " m_postid > > 'view_post.php?postid=$this->m_postid'>";
> >   if ($this->m_depth == 1)
> > print " '$this->m_title' - $this->m_poster
> > (".reformat_date($this->m_posted).")";
> >   else
> > print "'$this->m_title' - $this->m_poster
> > (".reformat_date($this->m_posted).")";
> >   print "";
> >   }
> >   // increment row counter to alternate colors
> >   $row++;
> >
> >   $num_children = count($this->m_childlist);
> >   for($i = 0; ($i<$num_children); $i++)
> >   { // call display on each of this node's children
> > $row = $this->m_childlist[$i]->display($row);
> >   }
> >
> >   return ($row);
> >  }
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

> > This message is intended for the sole use of the individual and entity
to
> > whom it is addressed, and may contain information that is privileged,
> > confidential and exempt from disclosure under applicable law.  If you
are
> > not the intended addressee, nor authorized to receive for the intended
> > addressee, you are hereby notified that you may not use, copy, disclose
or
> > distribute to anyone the message or any information contained in the
> > message.  If you have received this message in error, please immediately
> > advise the sender by reply email and delete the message.  Thank you very
> > much.
>
>



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




[PHP] cookies

2002-07-10 Thread Alexander Ross

How can I set a cookie which expires when the borwser is closed??  How can I
delete a cookie via PHP?

Thanks



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




[PHP] if syntax

2002-07-10 Thread Alexander Ross

I know this is correct:

if ($something)
{
...
}
else
{
...
}

But I recently saw someone use this instead:

if($something):
 ...
else:
...

Is that also correct??   No brackets needed?



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




[PHP] session error ... I think

2002-07-10 Thread Alexander Ross

what does this mean:

Warning: Cannot send session cache limiter - headers already sent (output
started at /home/.edy/alexross/bleen.net/forum/discussion_fns.php:88) in
/home/.edy/alexross/bleen.net/forum/index.php on line 5



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




[PHP] sessions

2002-07-10 Thread Alexander Ross

I'm trying to understand sessions so I can set session variables. I set up 2
very simple pages:

Page 1:


Click here


Page 2:




This doesn't seem to work though.  $test_var doesn't seem to have a value
when I go the second page.  What am I missing.  Thanks for helping a newbie.

Alex



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




[PHP] mysql question

2002-07-11 Thread Alexander Ross

I realize this isn't a php question, but I figured that someone here knows
of a good mysql newsgroup and in the mean time someone here probaby knows
the answer to my question.

Can I set up a query like this:

select * from table where start_shot <= $current_shot and end_shot >=
$current_shot

note everything will be of type INT

Thanks ya'll



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




[PHP] Re: session error ... I think

2002-07-11 Thread Alexander Ross

I'm slowly beginning to undrestand this, but please bear with a php novice.
When/how were the headers sent?  In other words, how do I know that they
have already been sent?

Thanks for humoring me
alex


"Richard Lynch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> >what does this mean:
> >
> >Warning: Cannot send session cache limiter - headers already sent (output
> >started at /home/.edy/alexross/bleen.net/forum/discussion_fns.php:88) in
> >/home/.edy/alexross/bleen.net/forum/index.php on line 5
>
> On line 88 in discussion_fns.php there is an echo or print or even just
some
> HTML, or *EVEN* just a blank line outside of  tags.
>
> That is "content" which PHP had to send to the browser.
>
> Now, once PHP has to send content to the browser, it had to send all the
> headers first, then a blank line, then the content.
>
> Pretty much, that's why headers are called headers -- They come at the
> "head" of the HTML, with a blank line in between.
>
> Once all that went out to the browser, you can't call "header()" function,
> because, like, the train has left the station.  You can still send more
HTML
> (jump on a box car) but you can't put anything on the front of the train.
> It's gone.
>
> --
> Like Music?  http://l-i-e.com/artists.htm
> Off-Topic:  What is the moral equivalent of 'cat' in Windows?



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




Re: [PHP] Re: session error ... I think

2002-07-11 Thread Alexander Ross

ok ... but the line of code that was the culprit was simply:

print "var id = ".$id.""; //for debugging

how does that line constitute sending more header info?

Alex


"Chris Hewitt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Alexander Ross wrote:
>
> >I'm slowly beginning to undrestand this, but please bear with a php
novice.
> >When/how were the headers sent?  In other words, how do I know that they
> >have already been sent?
> >
> Because something other than a header has gone out. As something other
> has gone out, it is not possible to send more headers. Thus headers that
> were to be sent must have already been sent. I interpret this error
> message as "Something other than headers has already been sent so you
> cannot send headers now.", (but then I have been known to be wrong).
>
> HTH
> Chris
>



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




[PHP] recusive functions

2002-07-13 Thread Alexander Ross

Does  exit() in a recursive function exit the entire function, of does it
only exit that iteration of teh function??  Thanks



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




[PHP] objects in an array

2002-07-13 Thread Alexander Ross

I have an array filled with objects.  Each object has a method called
"display".

I have

$var = $arr[0];
$var->display();

but I keep getting an error.  What am I doing wrong?
(I do a print_r of the array immediately before this code and there is an
object at array[0])


Thanks
Alex



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




[PHP] mysql LIMIT

2002-07-14 Thread Alexander Ross

can I use limit to show the 2nd record on without knowing how many more
records there might be?

also, what happens if I set the limit in a mysql statement (LIMIT 5,10), but
there are only 3 results? 7 results?



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




[PHP] newbie: mysql statement

2002-07-15 Thread Alexander Ross

I want to update the most recent record (based on the timestamp in field
posted) where the parent field == a specified value (in a table called
header).

I tried the following mysql statement:

"UPDATE header WHERE parent = '$this->postid' ORDER by posted SET
parent='$this->parent' LIMIT1";

but apparently you can't use ORDER in an UPDATE statement.  If I take order
out, the statement works.  That being true (and please correct me if its
not) how can I ensure that the newest record is the one being acted upon?
Thanks.




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