|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: php-general-digest-help
lists.php.netDate: Sun Apr 22 2001 - 04:39:44 CDT
php-general Digest 22 Apr 2001 09:39:44 -0000 Issue 642
Topics (messages 49704 through 49733):
Redirection II
49704 by: Wade
49706 by: Wade
Re: [Apache] Win32 Virtual Host - Sub Domain
49705 by: Andrew Braund
Re: Buggy Java GUI? (just a tad OT)
49707 by: Seung-woo Nam
49710 by: Plutarck
Incrementing dates
49708 by: Martin Skjöldebrand
49712 by: James, Yz
49724 by: Martin Skjöldebrand
49728 by: PHPBeginner.com
49730 by: PHPBeginner.com
49732 by: Martin Skjöldebrand
Re: Cool
49709 by: Pank Floyd
Connecting to a MS Access database
49711 by: Søren Soltveit
49714 by: Andrew Hill
help!! newbie
49713 by: McShen
49715 by: Plutarck
49717 by: McShen
49722 by: Chris Adams
UUdecode
49716 by: Paul A. Owen
what's wrong with this?
49718 by: McShen
49723 by: CC Zona
49729 by: PHPBeginner.com
File Download With A Twist....
49719 by: Donovan J. Edye
Re: I don't get it ... suddenly my script doesn't work ...
49720 by: Tim Thorburn
Re: Recursive Childs
49721 by: Joe Conway
49733 by: mukul.wwli.com
Re: pumping database dump in mysql
49725 by: Christian Reiniger
[php] what creates an Transport endpoint is not connected
49726 by: ruud habets
49727 by: Brian Clark
49731 by: ruud habets
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
I am submitting a form to a PHP page. I would like to check the form
variables before I load the page, and redirect them to another page if they
variables are incorrect -- so they can fix them.
Any ideas how I do this?
My idea was to start out the PHP with an if statement, and redirect in the
case something was wrong. But I'm really having a hard time finding a way to
do this.
Thank you!
Wade
attached mail follows:
I got it! :-)
""Wade"" <wwilliams
myoptionvalue.com> wrote in message
news:9bsudp$g23$1
toye.p.sourceforge.net...
> I am submitting a form to a PHP page. I would like to check the form
> variables before I load the page, and redirect them to another page if
they
> variables are incorrect -- so they can fix them.
>
> Any ideas how I do this?
> My idea was to start out the PHP with an if statement, and redirect in the
> case something was wrong. But I'm really having a hard time finding a way
to
> do this.
>
> Thank you!
> Wade
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
> -----Original Message-----
> From: Jon Shoberg [mailto:jshoberg
cbd.net]
> Sent: Sunday, 22 April 2001 00:39
> To: phpgeneral
> Subject: [PHP] [Apache] Win32 Virtual Host - Sub Domain
>
>
> Sorry for the OT post but this has me stumped and Google is
> not giving me
> any good leads.
A good lead is the Apache manual on virtual hosting;
http://httpd.apache.org/docs/vhosts/index.html
in particular;
http://httpd.apache.org/docs/vhosts/name-based.html
in the examples shown there you will notice the virtualHost line is;
<VirtualHost 111.22.33.44>
ie it uses an IP address, your config uses a host name;
> <VirtualHost test.localhost>
so on startup Apache will try to resolve test.localhost to an IP
address.
It fails so ignores the virtual host entry.
You could probably fix it by adding an entry to you hosts file like
127.0.0.1 test.localhost
but I think this would only be good for requests coming from a browser
on the server machine.
For simple installations I think you will find an entry like;
<VirtualHost *>
will work well (it also allows you to use dynamic DNS without changing
your config file).
The example in the documentation also does not use a trailing slash in
the document root. I don't know if this is important but with some
config directives it is so I generally follow the documentation
*exactly*.
So the complete virtual host entry would be;
<VirtualHost *>
ServerAdmin webmaster
localhost
DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs/test"
ServerName test.localhost
ErrorLog logs/test.localhost-error_log
CustomLog logs/test.localhost-access_log common
</VirtualHost>
HTH
Andrew Braund
>
> I am trying to setup Apache with PHP on Win32 (don't ask
> why). Anyhow, PHP
> is working great but virtual hosting is not going so well.
> When the browser
> brings up http://localhost/ it reads from [Apache
> Root]/apache/htdocs as
> defined by:
>
> #*** Good Virtual **********************************
>
> <VirtualHost *>
> ServerAdmin webmaster
localhost
> DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs/"
> ServerName localhost
> ErrorLog logs/error_log
> CustomLog logs/access_log common
> </VirtualHost>
>
> #***************************************************
>
> What are are tring to do is setup http://test.localhost/
> and it is not
> working here is the virtual host and apache restart ...
>
> #*** Bad Virtual ***********************************
>
> [Sat Apr 21 09:55:33 2001] [error] Cannot resolve host name
> est.localhost --- ignoring!
> The Apache service is restarting.
> The Apache service has restarted.
>
> <VirtualHost test.localhost>
> ServerAdmin webmaster
localhost
> DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs/test/"
> ServerName test.localhost
> ErrorLog logs/test.localhost-error_log
> CustomLog logs/test.localhost-access_log common
> </VirtualHost>
>
> #***************************************************
>
> Any thoughts on getting Win32 to resolve that test.localhost name ?
>
> Thanks
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin
lists.php.net
>
>
attached mail follows:
Hi:
If you don't have plenty of ram on your machine, forget about running
Forte. Java applications that use swing look nice but they use a lot of
systems resources. It's not a bug, per se, but whenever your systems
runs out of physical memory and start writing stuff on the virtual
memory, that's what you get. I have 224MB on my machine and Forte is
still slow.
Seung-woo Nam
Plutarck wrote:
>
> I've been toying around with Java to possibly interface with PHP, but I have
> a question about it.
>
> Is it just me, or is the GUI in most standalone java applications remarkably
> (and annoyingly) buggy?
>
> I downloaded Forte for Java by Sun, and after the 45 second loading time I
> noticed that if you click around the menus or move your cursor too fast, a
> menu will become temporarily "burned" into the frame of the page. Same if
> you hover on one button till a message comes up, then switch over to another
> button, a portion of the original message will still be shown.
>
> Same goes for Limewire and other 100% java apps I've tried.
>
> I was just wondering if it's just my machine, or because I use the windows98
> VM, or if everyone experiences the same thing.
>
> I'm guessing the horrendous starting load time is native to java, but at
> least it runs ok once you get the thing to start.
>
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
>
attached mail follows:
Hm, that would probably explain it.
I assumed it wasn't it because the programs are so comparitively
small...then again, it's not the size that counts blah blah...
Since it loads so much up at one time rather than a little bit at a time, it
probably eats a huge amount of ram. Forte probably loads the majority of the
JDK, the virtual machine, all it's neccessary system files and the majority
of it's class files, plus any files the user opens/builds.
I suppose Java's lack of programmer defined memory management is probably
the cause, since in other languages the programmer explicitly says what to
load and what to unload.
Ah well, I suppose that's the price of simplicity.
Thanks for your answer. I feel better about Java now...but now I have issues
about the size of my RAM. ;)
-- Plutarck Should be working on something... ...but forgot what it was."Seung-woo Nam" <snam1343
home.com> wrote in message news:3AE20352.3621233E
home.com... > Hi: > If you don't have plenty of ram on your machine, forget about running > Forte. Java applications that use swing look nice but they use a lot of > systems resources. It's not a bug, per se, but whenever your systems > runs out of physical memory and start writing stuff on the virtual > memory, that's what you get. I have 224MB on my machine and Forte is > still slow. > > Seung-woo Nam > > Plutarck wrote: > > > > I've been toying around with Java to possibly interface with PHP, but I have > > a question about it. > > > > Is it just me, or is the GUI in most standalone java applications remarkably > > (and annoyingly) buggy? > > > > I downloaded Forte for Java by Sun, and after the 45 second loading time I > > noticed that if you click around the menus or move your cursor too fast, a > > menu will become temporarily "burned" into the frame of the page. Same if > > you hover on one button till a message comes up, then switch over to another > > button, a portion of the original message will still be shown. > > > > Same goes for Limewire and other 100% java apps I've tried. > > > > I was just wondering if it's just my machine, or because I use the windows98 > > VM, or if everyone experiences the same thing. > > > > I'm guessing the horrendous starting load time is native to java, but at > > least it runs ok once you get the thing to start. > > > > -- > > Plutarck > > Should be working on something... > > ...but forgot what it was. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net > For additional commands, e-mail: php-general-help
lists.php.net > To contact the list administrators, e-mail: php-list-admin
lists.php.net >
attached mail follows:
How do I increment dates past the turn of the month (or year)? Say I've got a booking of equipment A for the 28 April to 5 May and want to add each instance to a calendar (mysql table). Can I increment the variable (format 2001-04-28) holding the date ($txtDate++) somehow so that it doesn't add the 31, 32 and 33 of April?
Martin S.
attached mail follows:
Hiya Martin.
You'd probably be better working around a database solution to your needs, but I am a bit drunk (and probably can't sensibly attempt to answer your question properly), but it got me thinking, so I decided to have a play with date incrementations. If anyone has any comments on this, I'd like to hear them (there's probably a simpler way around what I have done). Here's the URL:
http://www.yorkshire-zone.co.uk/date_increment.php
And here's the code that powers it:
<HTML> <BODY>
<?
$date = date("2001-04-28"); list($year, $month, $day) = explode("-", $date);
$actual_date = mktime(0,0,0,$month,$day,$year);
$days_to_add = 7;
$x = 1;
while($x <= $days_to_add) {
$make_date = getdate($actual_date);
echo "Day $x: $make_date[mday] $make_date[month], $make_date[year]<BR><BR>";
$actual_date = $actual_date + (3600 * 24);
$x++;
}
?>
</body> </html>
Cheers, James
----- Original Message -----
From: "Martin Skjöldebrand" <chimbis
skjoldebrand.org>
Newsgroups: php.general
Sent: Saturday, April 21, 2001 11:06 PM
Subject: [PHP] Incrementing dates
> How do I increment dates past the turn of the month (or year)?
> Say I've got a booking of equipment A for the 28 April to 5 May and want
to
> add each instance to a calendar (mysql table).
> Can I increment the variable (format 2001-04-28) holding the date
> ($txtDate++) somehow so that it doesn't add the 31, 32 and 33 of April?
>
> Martin S.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
James, Yz wrote:
>If anyone has any comments on this, I'd like to > hear > them (there's probably a simpler way around what I have done). Here's the > URL: > > http://www.yorkshire-zone.co.uk/date_increment.php > > And here's the code that powers it: > > <HTML> > <BODY> > > <? > > $date = date("2001-04-28"); > list($year, $month, $day) = explode("-", $date); > > $actual_date = mktime(0,0,0,$month,$day,$year); > > $days_to_add = 7; > > $x = 1; > > while($x <= $days_to_add) { > > $make_date = getdate($actual_date); > > echo "Day $x: $make_date[mday] $make_date[month], > $make_date[year]<BR><BR>"; > > $actual_date = $actual_date + (3600 * 24); > > $x++; > > } > > ?> > > </body> > </html>
Thanks James!
You started me off in the right direction. And ... with a few beers less in the brain (and a look at php.net and PHP Developers Cookbook) I finally found that mktime actually increments dates correctly. So, given that $month, $day and $year are valid and that we want to add 10 days to the output we can do:
echo date ("Y-m-d", mktime (0,0,0,$month, $day, $year)) . "<br>"; for($i=1; $i<=9; $i++) { $day++; echo date ("Y-m-d", mktime (0,0,0,$month, $day, $year)) . "<br>"; }
Cheers,
Martin S.
attached mail follows:
You can (mySQL, right?) do the following:
UPDATE table SET date=(date+INTERVAL 10 DAYS);
so if date there was 04-28, it will be added 10 more days and so will become 05-08
Use SQL for this things, it treats dates as 'dates' while PHP treats them as integers and strings.
Sincerely,
Maxim Maletsky Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
maxim
phpbeginner.com
www.phpbeginner.com
-----Original Message-----
From: Martin Skjoldebrand [mailto:chimbis
skjoldebrand.org]
Sent: Sunday, April 22, 2001 7:13 AM
To: php-general
lists.php.net
Subject: [PHP] Incrementing dates
How do I increment dates past the turn of the month (or year)? Say I've got a booking of equipment A for the 28 April to 5 May and want to add each instance to a calendar (mysql table). Can I increment the variable (format 2001-04-28) holding the date ($txtDate++) somehow so that it doesn't add the 31, 32 and 33 of April?
Martin S.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
I am not sure on how your possibilities are, but doing this in PHP means literally "adding useless lines and loops"
If possible, do it with SQL queries. Read the documentations on date datatypes, this is so much easier... almost magic.
Sincerely,
Maxim Maletsky Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
maxim
phpbeginner.com
www.phpbeginner.com
-----Original Message-----
From: Martin Skjoldebrand [mailto:chimbis
skjoldebrand.org]
Sent: Sunday, April 22, 2001 4:15 PM
To: php-general
lists.php.net
Subject: Re: [PHP] Incrementing dates
James, Yz wrote:
>If anyone has any comments on this, I'd like to > hear > them (there's probably a simpler way around what I have done). Here's the > URL: > > http://www.yorkshire-zone.co.uk/date_increment.php > > And here's the code that powers it: > > <HTML> > <BODY> > > <? > > $date = date("2001-04-28"); > list($year, $month, $day) = explode("-", $date); > > $actual_date = mktime(0,0,0,$month,$day,$year); > > $days_to_add = 7; > > $x = 1; > > while($x <= $days_to_add) { > > $make_date = getdate($actual_date); > > echo "Day $x: $make_date[mday] $make_date[month], > $make_date[year]<BR><BR>"; > > $actual_date = $actual_date + (3600 * 24); > > $x++; > > } > > ?> > > </body> > </html>
Thanks James!
You started me off in the right direction. And ... with a few beers less in the brain (and a look at php.net and PHP Developers Cookbook) I finally found that mktime actually increments dates correctly. So, given that $month, $day and $year are valid and that we want to add 10 days to the output we can do:
echo date ("Y-m-d", mktime (0,0,0,$month, $day, $year)) . "<br>"; for($i=1; $i<=9; $i++) { $day++; echo date ("Y-m-d", mktime (0,0,0,$month, $day, $year)) . "<br>"; }
Cheers,
Martin S.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
PHPBeginner.com wrote:
> I am not sure on how your possibilities are, > but doing this in PHP means literally "adding useless lines and loops" > > If possible, do it with SQL queries. Read the documentations on date > datatypes, this is so much easier... almost magic. >
AND
> You can (mySQL, right?) do the following:
>UPDATE table SET date=(date+INTERVAL 10 DAYS);
>so if date there was 04-28, it will be added 10 more days and so will >become >05-08
>Use SQL for this things, it treats dates as 'dates' while PHP treats them >as >integers and strings.
Sounds even easier. But what if I'm not doing an UPDATE but an INSERT? Can it read the previous date? I am inserting a batch of bookings at one time.
Martin S.
attached mail follows:
-----BEGIN PGP MESSAGE----- Version: PGP 6.5.8ckt (Build 04) Comment: Encryption is my right.....PGP-6.5.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wCFM10dVqvf/W54DhUcCnjx3J2HjsQ50lLsZgLMuws1G8AGjitk2MVgCA6KBm 75mlovouLR1kJKOaKyu/m3M8WLi4Bsx8jLKkgR4OnVBIrIeAJHky8wG0d2+n6K+R OF52L3E39fayh8msN82AbWvaFnwCHPH4gwXgNmN++yQjAp7qrid3ftA4csm98iXc Fi3UUCSFsERPummHIerWLLr0iHiQ7HAxwDiXEZ6xtOtubgl19Zyrxi+SbjogWQu6 BgBZU+e63g+HHDdNIXLLtEVViEGvHSwpeADLH6SneMQIzcP3s52laB7kcJZaAJRV AE9CsHFT5LgJ9i7mdmI46rE= =Kp1T -----END PGP MESSAGE-----
attached mail follows:
How can I connect to a Microsoft Access database, whitout using ODBC??
attached mail follows:
The Access native driver IS an ODBC driver. That is, I believe, your only option.
Best regards, Andrew -------------------------------------------- Andrew Hill - OpenLink Software Directory of Technology Evangelism Internet Data Integration Technology http://www.openlinksw.com
On Saturday, April 21, 2001, at 07:00 PM, Søren Soltveit wrote:
> How can I connect to a Microsoft Access database, whitout using ODBC??
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
attached mail follows:
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. ------ <?php
$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 "<a href=\"http://www.celebritieszones.com/jump.php?id=$id\">$title</a><br>\n";
} else { echo "<!-- Cute Celebrities Links -->"; $i = 288; // this forces it to quit the loop
} } echo "<br>";
$check = floor($rows/$num_of_page); // this finds how many pages it should generate if ( $check>0 ) {
if (($i-1)==288) { echo "<!-- Cute Celebrities Links !-->"; } else { $num_of_page = $i; echo "<a href=\"http://www.celebritieszones.com/links/index.php?list=$num_of_page\">Next Link Page</a>"; }
} ?> ------- 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.
attached mail follows:
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"" <webmaster
celebritieszones.com> wrote in message news:9btbqt$t79$1
toye.p.sourceforge.net... > 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. > ------ > <?php > > $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 "<a href=\"http://www.celebritieszones.com/jump.php?id=$id\">$title</a><br>\n"; > > } > else > { > echo "<!-- Cute Celebrities Links -->"; > $i = 288; // this forces it to quit the loop > > } > } > echo "<br>"; > > $check = floor($rows/$num_of_page); // this finds how many pages it should generate > if ( $check>0 ) > { > > if (($i-1)==288) > { > echo "<!-- Cute Celebrities Links !-->"; > } > else > { > $num_of_page = $i; > echo "<a href=\"http://www.celebritieszones.com/links/index.php?list=$num_of_page\">N ext Link Page</a>"; > } > > } > ?> > ------- > 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: php-general-unsubscribe
lists.php.net > For additional commands, e-mail: php-general-help
lists.php.net > To contact the list administrators, e-mail: php-list-admin
lists.php.net >
attached mail follows:
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 "<a
href=\"http://www.celebritieszones.com/jump.php?id=$id\">$title</a><br>\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"" <aemuli
spamclause-yahoo.com> wrote in message
news:9bte0p$53d$1
toye.p.sourceforge.net...
> 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"" <webmaster
celebritieszones.com> wrote in message
> news:9btbqt$t79$1
toye.p.sourceforge.net...
> > 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.
> > ------
> > <?php
> >
> > $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 "<a
>
href=\"http://www.celebritieszones.com/jump.php?id=$id\">$title</a><br>\n";
> >
> > }
> > else
> > {
> > echo "<!-- Cute Celebrities Links -->";
> > $i = 288; // this forces it to quit the loop
> >
> > }
> > }
> > echo "<br>";
> >
> > $check = floor($rows/$num_of_page); // this finds how many pages it
should
> generate
> > if ( $check>0 )
> > {
> >
> > if (($i-1)==288)
> > {
> > echo "<!-- Cute Celebrities Links !-->";
> > }
> > else
> > {
> > $num_of_page = $i;
> > echo "<a
>
href=\"http://www.celebritieszones.com/links/index.php?list=$num_of_page\">N
> ext Link Page</a>";
> > }
> >
> > }
> > ?>
> > -------
> > 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: php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail: php-general-help
lists.php.net
> > To contact the list administrators, e-mail: php-list-admin
lists.php.net
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
On 21 Apr 2001 19:26:03 -0700, McShen <webmaster
celebritieszones.com> wrote:
>then, should i do this?
>---
>$query = "SELECT * FROM refer ORDER BY hits desc LIMIT $i,$end";
Is $end set at this point? Also, if you always want to display 15 records, this could just be LIMIT $i, 15.
attached mail follows:
Is there an UUdecode function in PHP? If not then how would I implement this under NT?
Thanks, Paul.
attached mail follows:
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.
attached mail follows:
In article <9btgks$fc6$1
toye.p.sourceforge.net>,
webmaster
celebritieszones.com ("McShen") wrote:
> $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.
Perhaps if you were more specific about what you were expecting to happen and what *actually happened when "it didn't work"...? Meantime note that the 2nd parameter to LIMIT is not an end point but a count of total rows to be shown. So "limit 0,15" translates to "show the first 15 rows" while "limit 15,15" and "limit 30,15" would be the correct way to get the next two groups of 15 rows each.
-- CC
attached mail follows:
$end should be 15.
ie: LIMIT 50, 10
will display 10 rows starting from 51.
so, it will show rows 51-60 (included)
Sincerely,
Maxim Maletsky Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
maxim
phpbeginner.com
www.phpbeginner.com
-----Original Message-----
From: McShen [mailto:webmaster
celebritieszones.com]
Sent: Sunday, April 22, 2001 3:00 PM
To: php-general
lists.php.net
Subject: [PHP] what's wrong with this?
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: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
G'Day,
I would like to do the following when a user clicks on a link to this PHP script. The script would be located on www.myserver.com but the page with the link would be on a mirror say in Australia (www.someserver.com.au):
- Log info about the user download request to a text file - Display a page ("Thankyou for downloading xxxx. If you download does not start automatically..... etc.) - Start a download of a file from a remote server based on the parameters to the script
Eg: Suppose that the page on www.someserver.com.au contained the following link http://www.myserver.com/dnld.php?loc=au&file=somefile.zip
- Log info about the user download request to a text file
Write this info into a text file on www.myserver.com
- Display a page ("Thankyou for downloading xxxx. If you download does not start automatically..... etc.)
Display the page in the user's browser
- Start a download of a file from a remote server based on the parameters to the script
Essentially initiate http://www.someserver.com.au/somefile.zip
TIA
-- Donovan ----------------------------------------------------------------------------
---- E-Mail: d.edyebigfoot.com Web: www.edye.wattle.id.au "If I throw a stick will you go away?" "Very funny Scotty. Now beam down my pants!" GXExplorer - Freeware Delphi Windows Explorer Replacement and Delphi Components www.gxexplorer.org ---------------------------------------------------------------------------- ----
attached mail follows:
Hi all,
Just to let you know, I found out my problem with my PHP script ... I had installed the self installer version of PHP on my system this time around, rather than installing the full version - now the script works great.
Thanks again
-Tim
attached mail follows:
>Subject: [PHP] Recursive Childs
<snip>
> like hotscripts.com too, so i thought if someone could tell me how to use get all the children : > > ID | NAME | PARENT > 1 X 0 > 2 Y 1 > 3 Z 2 > 4 A 2 > 5 F 1 > 6 G 5 > if i want to get all children of 1, i want to get 2, 3, 4, 5, 6! > > how do i get this, thanks! >
Hi Natasha,
As your subject implies, the way to do this is with a recursive function call. Assuming your data is in a PostgreSQL database table, you could use something like the following (*untested* -- modify as required if you are using MySQL or something else)
Hope this helps!
Joe
*************************************************
<?PHP function getChildren($conn,$parent,$level,&$currentrecord,&$rowclr) { $level += 1; $levelpad = ""; for($counter = 0; $counter < $level - 1; $counter++) { $levelpad = $levelpad . "->"; }
$levelpad = $levelpad . ""; If (! empty($parent)) { $sql = "select id, name, parent from mytable where parent =$parent order by id"; $rs = pg_exec($conn,$sql); for ($row = 0; $row <= pg_numrows($rs) - 1; $row++) { $currentrecord += 1; if ($rowclr == "#d7d7d7") { $rowclr = "#ffffff"; } else { $rowclr = "#d7d7d7"; } for ($field = 0; $field <= pg_numfields($rs) - 1; $field++) { $rsf[pg_fieldname($rs,$field)] = pg_result($rs,$row,$field); } print("<tr bgcolor=\"" . $rowclr . "\">\n"); print("<td align=\"left\">" . $levelpad . $rsf["id"] . " </td>\n"); print("<td align=\"left\">" . $rsf["name"] . " </td>\n"); print("<td align=\"center\">" . $level . " </td>\n"); print("</tr>\n"); $newparent = $rsf["parent"]; getChildren($conn,$newparent,$level,$currentrecord,$rowclr); }; pg_freeresult($rs); } else { print("<h3>No information found.</h3>\n"); } }
$conn = pg_connect("dbname=mydb user=postgres"); $parent = 0; $level = 0; $currentrecord = 0;
$rowclr = "#e7e7e7";
print("<HTML><BODY>\n");
print("<table cellspacing=\"1\" cellpadding=\"1\" width=\"100%\">\n"); print("<tr bgcolor=\"#BBBBBB\">\n"); print("<th align=\"left\">ID</th>\n"); print("<th align=\"left\">Name</th>\n"); print("<th align=\"center\">Level</th>\n"); print("</tr>\n");
getChildren($conn,$parent,$level,$currentrecord,$rowclr);
print("</TABLE>\n"); if ($currentrecord == 0) { print("<H3>No matches found.</H3>\n"); } print("</BODY></HTML>\n");
?>
attached mail follows:
Hi,
thanks for that, could you just explain how it should start, should i just call the function, how does the level get determined ???
attached mail follows:
On Saturday 21 April 2001 15:39, Peter Van Dijck wrote: > Hi, > I want to write a script that takes a mysql dump file and pumps it into > the database.
What about simply using phpMyAdmin?
-- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/)"Software is like sex: the best is for free" -- Linus Torvalds
attached mail follows:
a perfectly working website suddenly went dead yesterday the resulting error is: Transport endpoint is not connected i have no idea what can be the cause of that.
the error can be viewed at www.kgv.nl (just wait 30 seconds)
any ideas?
thanks ruud habets
attached mail follows:
Hi ruud,
4:05:08 AM on 4/22/2001, ruud habets wrote:
> a perfectly working website suddenly went dead yesterday > the resulting error is: Transport endpoint is not connected > i have no idea what can be the cause of that.
http://www.google.com/search?q="Transport+endpoint+is+not+connected"
-Brian
-- PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies.
attached mail follows:
"Brian Clark" <brianj
fusionwerks.com> schreef in bericht
news:10098457333.20010422040920
fusionwerks.com...
> Hi ruud,
>
>
4:05:08 AM on 4/22/2001, ruud habets wrote:
>
> > a perfectly working website suddenly went dead yesterday
> > the resulting error is: Transport endpoint is not connected
> > i have no idea what can be the cause of that.
>
> http://www.google.com/search?q="Transport+endpoint+is+not+connected"
>
> -Brian
thanks brian
i understand it has to do with a change of rights on the file.
i will try to find out what went wrong.
ruud
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]