[PHP] tracking the current url

2001-02-09 Thread McShen


hi

Can you tell me how to  track the current url by using PHP? for example,
Mike is visiting http://www.celebritieszones.com/showthumb/britney_spears/1/
and i wanna make a PHP script so it tells Mike that he is currently browing
http://www.celebritieszones.com/showthumb/britney_spears/1/

I tried to use

$url_array=explode("\",$REQUEST_URI);

But it didn't work. It showed Array instead of the URL when i tried to
display it.

Please help. Thanks

---
free celebritieszones email:
http://www.celebrititeszones.com/login.php






-- 
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] way to save data

2001-02-11 Thread McShen

hi

I realized that there are 2 ways to save data. Using mySQL or a textfile.
Which do you think is better? i like using myysql instead a textfile cuz
it's faster and it's securier.



-- 
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] newbie---cookie help

2001-03-04 Thread McShen

hi

Please help a newbie.

I have 2 links on my website. It wil show  "NEW" if my visitors have only
visited my site once in 24h. If my visitors visit my site for more than once
in 24h, i wanna show "OLD".   I know cookie can do it. but i don't know how,
Please help. Any script will be greatly appreciately.

Thank You.



-- 
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] PHP news groups

2001-02-03 Thread McShen

hi

I am just wondering if there are any PHP newsgroups like this one. I am
looking for PHP newgroups so that i can ask people questions.


mick
http://www.celebritieszones.com



-- 
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] mysql help!! urgent!

2001-03-10 Thread McShen

hi

i get this message when i am trying to load some data from mysql.

Warning: Unable to jump to row 0 on MySQL result index 2 in
/home/sites/site3/web/showthumb on line 71

--here is my code
$connetion = mysql_connect("localhost","cel34243","s2343223");
$query = "select images from celeb where name=\"$dir.\" ";
$result = mysql_db_query("celebzone", $query);
$imagesnum= mysql_result($result,  "images");

can you please tell me why?

Thank you.



-- 
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] reset in mysql?

2001-03-12 Thread McShen

hi

I have a database which tracks how many hits a website has sent me. I wanna
write a script to reset this particular field so that it will be zero at
12:00 in the morning. How do i do it? Any suggestion would be appreciated.

my database is kinda like this(mysql

url | hits
---
http://www.yahoo.com  | 100
--

Thank You!



-- 
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] sort in mysql

2001-03-14 Thread McShen

hi

I have a database with some urls and numbers. There are currently 2 records
in the database. I wanna sort them by the numbers. How should i do it?
my table is like

name hits
john 343
scott   3423

any suggestions would be greatly appreciated!




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

2001-03-15 Thread McShen

I am looking for good php editors. Currently, i am using PHP coder. It
highlights syntax and checks my syntax. It's also executes my PHP codes. Are
there any editors like that? I just want a editor that highlights my code
and check my syntax.

regards



-- 
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] load DB from other server

2001-03-20 Thread McShen

hi

is it possible to load my DB from other servers? if yes, how?
like
mysql_connect("http://blah.com","username","pass");

thanks.



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

2001-03-21 Thread McShen

hi

how do i back up a mysql DB table? Can you please write me the code?

Thanks.



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

2001-03-30 Thread McShen

hi

i have a table named "refer"
I wanna duplicate a table name "refer2" so that i can mess around with it.

Thanks.



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

2001-03-31 Thread McShen

that didn't work. I tried that.
"CC Zona" <[EMAIL PROTECTED]> wrote in message
9a3hk3$bn7$[EMAIL PROTECTED]">news:9a3hk3$bn7$[EMAIL PROTECTED]...
> In article <9a3fme$4hg$[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED] ("McShen") wrote:
>
> > i have a table named "refer"
> > I wanna duplicate a table name "refer2" so that i can mess around with
it.
>
> Have you checked the manual for your DBMS?  Something like "create table
> refer2 select * from refer" should work with MySQL (assuming that were
your
> DBMS).
>
> --
> CC
>
> --
> 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] duplicate a table

2001-04-02 Thread McShen


how do i duplicate a table?
i tried
create table refer2 select * from refer;
create table refer2 as select * from refer;

they didn't work.
my mysql version is  mysql 3.22.28,



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

2001-05-17 Thread McShen

i was trying to install php on windows 2k pro.
i got this message when i was trying to run the test scrpt

"PHP CGI binary (\php) is not executable. Please compile PHP as a CGI
executable and try again. "

why is that?

and should i read the instruction for IIS 4.0+ (isapi) or  IIS 4.0+ (CGI)





-- 
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] newbie algorithm help!!!!!

2001-06-20 Thread McShen

hi
i have a mysql table with approx. 30 entries.

I wanna get them(i know how to do that) and list them in a 2-column table. I
have been trying to use a loop to do it. But it will only produce a 1-column
table. it's like

entry 1
entey 2
entry 3
entry 4
etc

Please help me so that i can get this :

entry1 entry2
entry3 entry4

Thanks in advanced.



-- 
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] newbie algorithm help!!!!!

2001-06-23 Thread McShen

please share if you know hwo to di it. thanks you

""McShen"" <[EMAIL PROTECTED]> wrote in message
9gqm6o$g6n$[EMAIL PROTECTED]">news:9gqm6o$g6n$[EMAIL PROTECTED]...
> hi
> i have a mysql table with approx. 30 entries.
>
> I wanna get them(i know how to do that) and list them in a 2-column table.
I
> have been trying to use a loop to do it. But it will only produce a
1-column
> table. it's like
>
> entry 1
> entey 2
> entry 3
> entry 4
> etc
>
> Please help me so that i can get this :
>
> entry1 entry2
> entry3 entry4
>
> Thanks in advanced.
>
>
>
> --
> 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] ->>coding help

2001-06-23 Thread McShen

Hi

I have a script which queries mySQL and outputs 32 links at once. Here is my
scipt

\n";
echo "\n";
while ($j!=$num)
{
@$r = mysql_fetch_array($result);
@$id = $r[id];
@$title = $r[title];

  echo "\n";
  echo "$title";
  echo "\n";
// new row in table every other link
$i++;
 if (($i % 2) < 1)
  {
  echo "\n\n";
  }

$j++;
}
echo "";

echo "\n";


?>
---
And here is the link to see it in action
http://www.celebritieszones.com/ln.php?list=0

If you check my HTML source, at the end, right before , you will see
an extra . I know the cause of this. It's because of this
---
"
$i++;
 if (($i % 2) < 1)
  {
  echo "\n\n";
  }
"
-

I don't know how to fix the problem. Please help me re-write the script a
bit so that it doesn't add the extra .

Thanks in advance.



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

2001-06-24 Thread McShen

Jason, your scripts works prefectly in creating a table. But, It only ouputs
the first query from the databse. Others are not shown.
""Jason Lotito"" <[EMAIL PROTECTED]> wrote in message
000f01c0fc67$abfe3a90$72003bd0@genric">news:000f01c0fc67$abfe3a90$72003bd0@genric...
> This should work...
>
> 
> $connection = mysql_connect("***","","");
> if ($connection==false)
>{
> echo mysql_errno().":".mysql_error()."";
> exit;
>}
>
> $end = $list + 16;
>
> $query = "SELECT * FROM refer ORDER BY hits desc LIMIT $list, $end";
> $result = mysql_db_query ("celebzone", $query);
>
> $num = mysql_num_rows($result);
>
> $j=0;
> $i=0;
> echo "\n";
>
> for ($j = 0; $j < $num; $j++)
> {
> echo '\n';
> for ($i = 0; $i <= 1; $i++)
> {
> @$result = mysql_fetch_array($result);
> @$id = $result[id];
> @$title = $result[title];
>
> echo "\n";
> echo "$title";
> echo "\n";
> }
> echo "\n";
> }
>
> echo "";
> echo "\n";
>
>
> ?>
>
> Jason Lotito
> www.NewbieNetwork.net
> PHP Newsletter: http://www.newbienetwork.net/ciao.php
> PHP, MySQL, PostgreSQL Tutorials, Code Snippets, and so much more
>
>
> > -Original Message-
> > From: McShen [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, June 23, 2001 11:22 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] ->>coding help
> >
> >
> > Hi
> >
> > I have a script which queries mySQL and outputs 32 links at
> > once. Here is my scipt
> > 
> >  >
> > $connection = mysql_connect("***","","");
> > if ($connection==false)
> >{
> > echo mysql_errno().":".mysql_error()."";
> > exit;
> >}
> >
> > $end = $list + 16;
> >
> > $query = "SELECT * FROM refer ORDER BY hits desc LIMIT $list,
> > $end"; $result = mysql_db_query ("celebzone", $query);
> >
> > $num = mysql_num_rows($result);
> >
> > $j=0;
> > $i=0;
> > echo "\n";
> > echo "\n";
> > while ($j!=$num)
> > {
> > @$r = mysql_fetch_array($result);
> > @$id = $r[id];
> > @$title = $r[title];
> >
> >   echo "\n";
> >   echo "$title";
> >   echo "\n";
> > // new row in table every other link
> > $i++;
> >  if (($i % 2) < 1)
> >   {
> >   echo "\n\n";
> >   }
> >
> > $j++;
> > }
> > echo "";
> >
> > echo "\n";
> >
> >
> > ?>
> > ---
> > And here is the link to see it in action
> > http://www.celebritieszones.com/ln.php?list=0
> >
> > If you check
> > my HTML source, at the end, right before , you will
> > see an extra . I know the cause of this. It's because of this
> > ---
> > "
> > $i++;
> >  if (($i % 2) < 1)
> >   {
> >   echo "\n\n";
> >   }
> > "
> > -
> >
> > I don't know how to fix the problem. Please help me re-write
> > the script a bit so that it doesn't add the extra .
> >
> > Thanks in advance.
>
>
> --
> 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] newbie help!

2001-06-30 Thread McShen

hi

I wrote a script to display all file in a directory. Here is my script
---



This is working fine. But it displays all files in 1 single page. Here is
what i wanna do, but i don't know how to do it.
I wanna display 15 files names at once, and have prev. and next buttons and
the end, when i click on next, it will display the next 15 files.

Please help me.
Thanks in advance.



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

2001-07-05 Thread McShen

where are u guys?



-- 
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] chdir() help

2001-07-07 Thread McShen

hi

Currently, i am working in e:\work, and there is a folder named "image" under e:\work, 
so, the path to image is e:\work\image.

I have a script under e:\work, and i wanna display all images under the folder 
e:\work\image, I use chdir() to change the directory. but it wouldn't work. it still 
displays the images under e:\work. Why is that? Does chdir() work under win2k pro? 
here is my script

---
";
 }
}
closedir($dir);
?>
-

Please help me to fix the problem. Thanks.



Re: [PHP] chdir() help

2001-07-07 Thread McShen

by the way, what do u guys use as your news reader client?
how do u reply to my post and send me an email at the same time? Do u
manually add my email to Cc: or you just hit "reply to group"? I don't know
how to do this.

"Kurt Lieber" <[EMAIL PROTECTED]> wrote in message
0c7f01c106fc$9c32e170$[EMAIL PROTECTED]">news:0c7f01c106fc$9c32e170$[EMAIL PROTECTED]...
> Look at your code -- where do you tell it to set $file_name equal to the
> file handles within e:\work\images?  $file_name is only being set to the
> values within e:\work -- not e:\work\images.
>
> If you only need to display the images within e:\work\images, then why not
> just set $dir_name to that in the first place?  Otherwise (I believe)
you're
> going to have to use two separate while ($file_name=readdir($dir))
clauses
> (or nest them, depending on what you really want to output)
>
> hth
>
> --kurt
> - Original Message -
> From: "McShen" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, July 07, 2001 8:38 AM
> Subject: [PHP] chdir() help
>
>
> hi
>
> Currently, i am working in e:\work, and there is a folder named "image"
> under e:\work, so, the path to image is e:\work\image.
>
> I have a script under e:\work, and i wanna display all images under the
> folder e:\work\image, I use chdir() to change the directory. but it
wouldn't
> work. it still displays the images under e:\work. Why is that? Does
chdir()
> work under win2k pro? here is my script
>
> ---
> 
>
> $dir_name = "e:\work";
> $dir = opendir($dir_name);
> while ($file_name=readdir($dir)) {
>
>  if (($file_name!="." && $file_name!="..")) {
>   echo $file_name."\n  ";
>
>   if (chdir('e:\work\image')) {
>echo "current dir is e:\work\image";
>   }
>   echo "";
>  }
> }
> closedir($dir);
> ?>
> -
>
> Please help me to fix the problem. Thanks.
>
>



-- 
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] ereg() help, plz

2001-07-14 Thread McShen

hi,

I wanna print out all files in a directory. But i wanna exclude ".", "..",
"head.jpg", and all files that start with tn_

Here is my script, but it didn't work. Please help me to solve this problem.
Thank You.

-my script-
while ($file_name = readdir($dir2))

if (($file_name!="." && $file_name!=".." && $file_name!="head.jpg" &&
$file_name!=ereg(^tn_,$file_name) ))

$files[]=$file_name;
}

$numfiles = count($files);

for ($i=$g; $i<$numfiles; $i++){
echo $files[$i];
}

-





-- 
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] please help.

2001-07-18 Thread McShen

hi

I wanna see how long my scripts load. So, i copied this script from
phpbuilder
---

--

But i am not sure where to put that part. Can i put it anywhere within my
script?  And bcsub() is not install on my server. What other fuctions can i
use? can i just use $endtime-$starttime?



-- 
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] please help.

2001-07-18 Thread McShen

ok thx
"Michael Geier" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> try using the attached class.
>
>  $time = new timer;
> $time->start();
>
> // some code
>
> $time->stop();
> $total = $time->gettime();
> echo $total;
> ?>
>
> -Original Message-
> From: McShen [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 18, 2001 11:08 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] please help.
>
>
> hi
>
> I wanna see how long my scripts load. So, i copied this script from
> phpbuilder
> ---
>$timeparts = explode(" ",microtime());
>   $starttime = $timeparts[1].substr($timeparts[0],1);
>   $timeparts = explode(" ",microtime());
>   $endtime = $timeparts[1].substr($timeparts[0],1);
>   echo bcsub($endtime,$starttime,6)
> ?>
> --
>
> But i am not sure where to put that part. Can i put it anywhere within my
> script?  And bcsub() is not install on my server. What other fuctions can
i
> use? can i just use $endtime-$starttime?
>
>
>
> --
> 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] whatever.php

2001-07-18 Thread McShen

yea, make your whatever.php as a php file. that happened to me before. :)

"Chris Schneck" <[EMAIL PROTECTED]> wrote in message
002101c10fb4$252cafa0$[EMAIL PROTECTED]">news:002101c10fb4$252cafa0$[EMAIL PROTECTED]...
> Did you make sure you had the  tags in the whatever.php enclosing the
> content?
>
>



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

2001-07-24 Thread McShen

in order to prevent my visitors from seeing more than one popup in less than
120 second, I added this to my php page(index.php)
--
setcookie("popup",1,time()+120);
if ($popup!=1)

  echo "http://www.peel.net/frames/PMNforce.js>";
}
-

When I reload index.php, i see popups everytime. I am pretty sure that I
enabled cookies in IE and Netscape.

Please help. thanks



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

2001-07-24 Thread McShen

thanks!

"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > in order to prevent my visitors from seeing more than one popup in less
than
> > 120 second, I added this to my php page(index.php)
> > --
> > setcookie("popup",1,time()+120);
> > if ($popup!=1)
> >
> >   echo "http://www.peel.net/frames/PMNforce.js>";
> > }
> > -
> >
> > When I reload index.php, i see popups everytime. I am pretty sure that I
> > enabled cookies in IE and Netscape.
> >
> > Please help. thanks
>
> Do you really think that people will have their system clocks set
> accurately to within 120 seconds of your server's system clock?  Heck, you
> are lucky if they have their clock set to the right year, never mind the
> right date and time down to the minute.
>
> To do this reliably, encode your system time in the cookie value and use
> that to determine whether the cookie is valid.  And use a session cookie.
> Like this:
>
> $value = 1;
> $time = time() + 120;
> setcookie('popup',"$time:$value");
> if(isset($popup)) {
> list($time,$value) = explode(':',$popup);
> if($time > time()) $popup = false;
> else $popup = true;
> }
>
> if($popup)
> echo "http://www.peel.net/frames/PMNforce.js>";
>
> -Rasmus
>



-- 
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] counter reseting help!

2001-04-14 Thread McShen

hi

I am writing a small counter for my site. But i am not sure how to reset the
counter every 24h. How should i do it? any suggestions would be much
appreaciated!



-- 
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] what's wrong with this?

2001-04-22 Thread McShen

this is something related to my last post.

$start is passed by the url. like http://mydomain.com/links.ph?start=0;
$end =$start+15;

$query = "SELECT * FROM refer ORDER BY hits desc LIMIT $start,$end";

it didn't work. Please help.



-- 
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] help!! newbie

2001-04-22 Thread McShen

then, should i do this?
---
$query = "SELECT * FROM refer ORDER BY hits desc LIMIT $i,$end";
$result = mysql_db_query ("celebzone", $query);

$num = mysql_num_rows($result);
echo $num;

 for ($i; $i < $end; $i++)
   {
$r = mysql_fetch_array($result,$i);

  $id = $r[id];
  $title = $r[title];

  // $id = mysql_result($result, $i, "id"); // check this later
  // $title = mysql_result($result, $i, "title"); // check this later
  echo "http://www.celebritieszones.com/jump.php?id=$id\">$title\n";

 }
--

it didn't work. it says "Warning: Supplied argument is not a valid MySQL
result resource in /home/sites/site3/web/links/index.php on line 15"

why?

""Plutarck"" <[EMAIL PROTECTED]> wrote in message
9bte0p$53d$[EMAIL PROTECTED]">news:9bte0p$53d$[EMAIL PROTECTED]...
> You'll want to use the LIMIT option in SQL. So on the end of your query
add:
>
> "LIMIT 0,10" to get the first ten results.
>
> The first number is the "offset", and the last is the max amount to
> retrieve. To get links 20 through 40 you'd use:
>
> "LIMIT 19, 39"
>
> The offset is refering to an array, so offset 0 is actually the first
link.
>
>
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
>
>
> ""McShen"" <[EMAIL PROTECTED]> wrote in message
> 9btbqt$t79$[EMAIL PROTECTED]">news:9btbqt$t79$[EMAIL PROTECTED]...
> > hi
> >
> > I have 30 links stored in a table(mysql) now. I wanna show them
accorging
> to
> > the traffic they send. But i don't want to list all of them in just 1
page
> > because i will be adding 300 links soon. (I don't want my visitors to
wait
> 3
> > minutes to load the links)How should i do it? I wanna do it like this
> > http://mydomain.com/links?list=0
> > shows only links from 0-15
> > and
> > http://mydomain.com/links?list=15
> > shows links from 15-30
> > etc.
> >
> > here is my code.
> > --
> >  >
> > $connection = mysql_connect("localhost","","");
> > if ($connection==false)
> > {
> > echo mysql_errno().":".mysql_error()."";
> > exit;
> > }
> > $query = "SELECT * FROM refer ORDER BY hits desc ";
> > $result = mysql_db_query ("celebzone", $query);
> >
> > $rows = mysql_num_rows($result);
> > $num_of_page = floor($rows/15)+1;
> >
> > $i=$list;
> >
> > for ($i = $list; $i < $list+15; $i++)
> > {
> >
> > if ($i <= $rows)
> > {
> > @$id = mysql_result($result, $i, "id"); // check this later
> > @$title = mysql_result($result, $i, "title"); // check this later
> > echo "
href=\"http://www.celebritieszones.com/jump.php?id=$id\">$title\n";
> >
> > }
> > else
> > {
> > echo "";
> > $i = 288; // this forces it to quit the loop
> >
> > }
> > }
> > echo "";
> >
> > $check = floor($rows/$num_of_page); // this finds how many pages it
should
> generate
> > if ( $check>0 )
> > {
> >
> > if (($i-1)==288)
> > {
> > echo "";
> > }
> > else
> > {
> > $num_of_page = $i;
> > echo "
href=\"http://www.celebritieszones.com/links/index.php?list=$num_of_page\">N
> ext Link Page";
> > }
> >
> > }
> > ?>
> > ---
> > It's not good though and it's kinda stupid. :( When it loads the last
page
> of my links, it will show this
> > "Warning: Unable to jump to row 48 on MySQL result index 2 in
> /home/sites/site3/web/links/index.php on line 22
> >
> > Warning: Unable to jump to row 48 on MySQL result index 2 in
> /home/sites/site3/web/links/index.php on line 23"
> >
> > You see the @? I am using it to supress the error messasges cuz i don't
> know how to fix this error. Please help. :)
> > Thank You.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > 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 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] help!! newbie

2001-04-22 Thread McShen

hi

I have 30 links stored in a table(mysql) now. I wanna show them accorging to
the traffic they send. But i don't want to list all of them in just 1 page
because i will be adding 300 links soon. (I don't want my visitors to wait 3
minutes to load the links)How should i do it? I wanna do it like this
http://mydomain.com/links?list=0
shows only links from 0-15
and
http://mydomain.com/links?list=15
shows links from 15-30
etc.

here is my code.
--
http://www.celebritieszones.com/jump.php?id=$id\">$title\n"; 

} 
else 
{ 
echo ""; 
$i = 288; // this forces it to quit the loop 

} 
} 
echo ""; 

$check = floor($rows/$num_of_page); // this finds how many pages it should generate 
if ( $check>0 ) 
{ 

if (($i-1)==288) 
{ 
echo ""; 
} 
else 
{ 
$num_of_page = $i; 
echo "http://www.celebritieszones.com/links/index.php?list=$num_of_page\">Next Link 
Page"; 
} 

} 
?> 
--- 
It's not good though and it's kinda stupid. :( When it loads the last page of my 
links, it will show this 
"Warning: Unable to jump to row 48 on MySQL result index 2 in 
/home/sites/site3/web/links/index.php on line 22 

Warning: Unable to jump to row 48 on MySQL result index 2 in 
/home/sites/site3/web/links/index.php on line 23" 

You see the @? I am using it to supress the error messasges cuz i don't know how to 
fix this error. Please help. :) 
Thank You. 









-- 
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] chdir() help

2001-07-07 Thread McShen-CelebritieZones.com

Chris,
I do that because i wanna have control of how many images will be displayed at once. I 
understand what you are doing, but, you script will just display all images at once, 
right? I wanna display like 20 images, then have a next button,, you know what i mean?

- Original Message - 
From: "Chris Lambert - WhiteCrown Networks" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: "McShen" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, July 07, 2001 11:44 AM
Subject: Re: [PHP] chdir() help


> I'm not sure I know exactly what you want, as the script isn't clear on its
> purpose. If you simply want to print out all the images in e:\work\image,
> and nothing else, the code would be much simpler.
> 
>  $dir = opendir("e:/work/image");
> while ($file_name=readdir($dir)) {
> if ($file_name <> "." && $file_name <> "..") {
> echo "";
> }
> }
> ?>
> 
> /* Chris Lambert, CTO - [EMAIL PROTECTED]
> WhiteCrown Networks - More Than White Hats
> Web Application Security - www.whitecrown.net
> */
> 
> - Original Message -
> From: McShen <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, July 07, 2001 11:38 AM
> Subject: [PHP] chdir() help
> 
> 
> hi
> 
> Currently, i am working in e:\work, and there is a folder named "image"
> under e:\work, so, the path to image is e:\work\image.
> 
> I have a script under e:\work, and i wanna display all images under the
> folder e:\work\image, I use chdir() to change the directory. but it wouldn't
> work. it still displays the images under e:\work. Why is that? Does chdir()
> work under win2k pro? here is my script
> 
> ---
>  
> 
> $dir_name = "e:\work";
> $dir = opendir($dir_name);
> while ($file_name=readdir($dir)) {
> 
>  if (($file_name!="." && $file_name!="..")) {
>   echo $file_name."\n  ";
> 
>   if (chdir('e:\work\image')) {
>echo "current dir is e:\work\image";
>   }
>   echo "";
>  }
> }
> closedir($dir);
> ?>
> -
> 
> Please help me to fix the problem. Thanks.
> 
>