ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-db
php-db
RE: [PHP-DB] problem of transmiting variabl into another page?
by Mike Ford other posts by this author
Dec 7 2005 9:40AM messages near this date
Re: [PHP-DB] problem of transmiting variabl into another page? | RE: [PHP-DB] problem of transmiting variabl into another page?
On 02 December 2005 13:06, Bastien Koert wrote:

>  <?php for ($j=ord('A'); $j <= ord('Z'); $j++) {
>      echo "| <b><a
>  href='alpha.php?artist=".chr($j)."'>".chr($j)."</a></b> ";
>  
>    } ?>
>  
>  You need to use the ORD function to get the numerical ascii
>  equivalent of the letter and the CHR function to go back the other
>  way.

Gak! That's almost worse than the original!!

>  
>  Bastien
>  
>  
>  > From: Mohamed Yusuf <myainab@[...].com>
>  > To: php-db@[...].net
>  > Subject: [PHP-DB] problem of transmiting variabl into another page?
>  > Date: Fri, 2 Dec 2005 12:30:12 +0200
>  > 
>  > I am transmitting variable from one of my pages and I would like to
>  > match that variable into mysql data. it won't return data.
>  > my code is this.
>  > 
>  > <?php for ($j=A; $j <= Z; $j++) {
>  >    echo "| <b><a href='alpha.php?artist=$j'>$j</a></b> |";
>  >    if  ($j == Z) {
>  >      break;
>  >   }
>  >  } ?>

1. You have unquoted strings -- should be 'A' and 'Z'.

2. The test condition in your for is wrong (and either that or the break is redundant).

Here's how I'd write it:

   for ($j='A'; $j!='AA'; $j++):
     echo "| <b> <a href='alpha.php?artist=$j'>$j</a></b> |";
   endfor;

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@[...].uk
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 



To view the terms under which this email is distributed, please go to http://disclaimer.leed
smet.ac.uk/email.htm

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Mohamed Yusuf
Cal Evans
Mike Ford
Bastien Koert

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved