php-general Digest 11 May 2011 11:38:09 -0000 Issue 7307

2011-05-11 Thread php-general-digest-help

php-general Digest 11 May 2011 11:38:09 - Issue 7307

Topics (messages 312743 through 312756):

Re: Bold links
312743 by: Stuart Dallas
312746 by: Micky Hulse
312747 by: Joshua Kehn
312748 by: Adam Richardson
312749 by: Ashley Sheridan
312751 by: tedd
312752 by: Adam Richardson

Short tag: why is it bad practice?
312744 by: Andre Polykanine
312745 by: Joshua Kehn
312756 by: Alejandro Michelin Salomon (Hotmail)

Re: Error Reporting/Display Errors Issues?
312750 by: Mike Mackintosh

How in PDOStatement-fetchAll use PDO::FETCH_GROUP for grouping more than one 
column simultaneously?
312753 by: Михаил Гаврилов

Storing indefinite arrays in database
312754 by: Benedikt Voigt
312755 by: Bastien Koert

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
On Tuesday, 10 May 2011 at 15:41, tedd wrote:
At 3:53 PM -0700 5/9/11, Micky Hulse wrote:
  On Mon, May 9, 2011 at 2:56 PM, tedd tedd.sperl...@gmail.com wrote:
Really?
How does the blind via readers, such as JAWS, understand what a B is?
First, never use B -- or I for that matter.
Second, use strong or em instead. Readers can understand and render
STRONG and EMPHASIZED text, but not B and I text -- those tags mean
nothing and that's the reason why they are not encouraged for use and 
   even
removed from XHTML.
Third, if neither of those tags (i.e., strong or em ) work for you, 
   they
try using a class (or an id) with a css rule of:
  
  [OT]
  
  Tedd, it seems like you are spreading a little bit of mis-information here.
 
 Micky:
 
 I see that you brought your authority to the argument, namely:
 
 http://html5doctor.com/i-b-em-strong-element/
 
 So, allow me to bring mine -- my information/position stems from my 
 understanding derived from both daily practice and constant reading. 
 In addition to reading links like the above (which I read btw), I 
 also read several list provided by disability concerns, such as 
 webdev.lists.d.umn.edu being the best. In addition to all that, I 
 also read several technical books each week re these subjects.
 
 For example, within this last month I've purchased and read HTML5 by 
 Lawson, Smashing CSS by Meyer, 100 Things by Weinschenk, Learning Web 
 Design by Robbins, Designing with the Mind in Mind by Johnson, Forms 
 that work by Jarret, Build your own web site the right way by Lloyd, 
 PHP 5.3 by Doyle, and Expert PHP and MySQL by Cuniosoa. That's a lot 
 of reading, -- so I think I keep up with what's going on.
 
 While it is true that html5 brought back tags such as b and i, 
 but it has also brought back table for presentation. I leave the 
 reader (and the future) to judge the wisdom of that decision.
 
 I think we all realize the problems that these tags bring to the 
 table (no pun intended). We can either continue to resolve the 
 problems they present or we can resort back to the way things were.
 
 As for me, I choose to never use b and i for anything PERIOD and 
 to speak out against their use whenever I can. As for table in 
 presentation, I am still undecided. While I would never use tables 
 for the presentation of text, I often use simple tables (i.e., no 
 nesting) for holding forms together. However, I am leaning toward not 
 using tables for that either.
 
 The world is changing and I don't think any organization can dictate 
 what is the right/wrong way to do anything. But the good thing here 
 is that we are left to our own judgement as to what we support and 
 what we condemn. In my judgment, the b and i tags present more 
 problems than they solve so I will continue to not use those tags and 
 speak against them.

While I don't necessarily disagree with your point about HTML5 bringing back 
prehistoric tags, I do think it's important to remember that the fundamental 
reason for having the spec is that everyone (developers, browsers, 
screenreaders, etc) are working from the same guidelines. You have to assume 
that HTML5 consumption devices (both software and hardware) will follow the 
spec, so as a developer I think it's important to do the same regardless of 
your philosophical arguments against the decisions made when that spec was 
written.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/




---End Message---
---BeginMessage---
[OT]

Thanks for the informative reply Tedd.

I respect your opinion and I don't think my approach is more right
than yours. I am wondering if this is just a DTD thing. I always use
an HTML 4.01 strict DTD and have not used an XHTML doctype in ages.

As far as I can tell, the specs in XHTML say not 

RES: [PHP] Short tag: why is it bad practice?

2011-05-11 Thread Alejandro Michelin Salomon (Hotmail)
Andre :

As Joshua says, the only php tags that always is enabled is ?php ?, this
is the default php tag, and never can be disabled.

This ? ? is enabled if short_open_tag is on
And this % % is enabled if asp_tags is on

But the default is off for both.

Use this ?php ?, and forgive configuration options.

Alejandro M.S.

-Mensagem original-
De: Joshua Kehn [mailto:josh.k...@gmail.com] 
Enviada em: terça-feira, 10 de maio de 2011 12:19
Para: Andre Polykanine
Cc: php-general@lists.php.net
Assunto: Re: [PHP] Short tag: why is it bad practice?

On May 10, 2011, at 11:11 AM, Andre Polykanine wrote:

 Hi everyone,
 Many  times  I heard that the following two peaces of code are written
 in a bad manner:
 1.
 ?
 echo Hello, world!;
 ?
 
 2.
 form action=script.php method=post
 pYour   e-mail:   input   type=text   id=uemail   name=uemail
 value=?=$f['Email']?/p
 ...
 /form
 
 As for now, I use both quite often. Why is this considered not kosher,
 I mean, good coding practice?
 Thanks!
 
 -- 
 With best regards from Ukraine,
 Andre
 Skype: Francophile
 Twitter: http://twitter.com/m_elensule
 Facebook: http://facebook.com/menelion


Because short tags aren't always enabled and can cause things to break when
deploying code to different environments. Best practice dictates that your
code should be as environmentally independent as possible.

It's another few characters, why neglect it?

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com


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



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



Re: Fwd: [PHP] Storing indefinite arrays in database

2011-05-11 Thread Benedikt Voigt

Bastien,
thanks for the answer.
But as I understand the problem and your suggestion, this won’t work, or you 
have to explain it to me with this example.
For example, let’s reduce the function to two input fields and the following 
functioning:
InputField1=A InputField2=B OutputField=X
InputField1=A InputField2=C OutputField=Y
How can you store this in the form you suggested in a relational database?
Or would a non-relational database (e.g. an OO-database) make more sense?
Thanks,
Ben 


-Ursprüngliche Nachricht-
Von: Bastien Koert phps...@gmail.com
Gesendet: 10.05.2011 22:38:24
An: PHP General list php-general@lists.php.net
Betreff: Fwd: [PHP] Storing indefinite arrays in database

-- Forwarded message --
From: Bastien Koert phps...@gmail.com
Date: Tue, May 10, 2011 at 4:37 PM
Subject: Re: [PHP] Storing indefinite arrays in database
To: Benedikt Voigt benedikt.vo...@web.de


On Tue, May 10, 2011 at 4:16 PM, Benedikt Voigt benedikt.vo...@web.de wrote:
 Hi,
 I'am very new to PHP, so please any comment is welcome.

 I want to write a function in PHP, which takes X arguments and outputs a
 value.
 The functioning of this function should be stored in a db (mydb? or better
 alternatives?)
 The function would look up the result in the db based on the X arguments.

 But how can I store X arguments and the corresponding output value?
 If I limit the X arguments to a specific number like N=10, then I could
 create N=10 +1 columns in a table.
 But how should I do it if I don't want to limit myself to a fix number?

 Thanks for any comment!
 Ben

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



My bad, copied only the OP not the list.


Create the DB to run in a vertical format

consider the horizontal style

record_id       field1   field2   field3   fieldN


which is great for fixed designs


The vertical format would be

record_id     attribute      argument




--

Bastien

Cat, the other other white meat



--

Bastien

Cat, the other other white meat

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



___
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

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



Re: [PHP] How in PDOStatement-fetchAll use PDO::FETCH_GROUP for grouping more than one column simultaneously?

2011-05-11 Thread Gerardo Benitez
Hi Mikhail,

I think FETCH_GROUP not work in these way, anyway, do you need work with
arrays? you can do the same with a simple record, i think...

Gerardo.




On Tue, May 10, 2011 at 5:03 PM, Михаил Гаврилов 
mikhail.v.gavri...@gmail.com wrote:

 How in PDOStatement-fetchAll use PDO::FETCH_GROUP for grouping more
 than one column simultaneously?

 For example

 col1  col2  col3  col4
 13 p1   1 boroda
 13 p1   1 boroda 2
 13 p1   2 boroda 3
 13 p2   2 boroda 4
 13 p2   2 boroda 5
 14 p3   2 boroda 6
 14 p4   2 boroda 7
 14 p4   2 boroda 8

 $data = $sth-fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_GROUP, 2);

 Expected result for $data:

 Array
 (
[13] = Array
(
 [p1] = Array
   (
 [0] = Array
 (
[col3] = 1
[col4] = boroda
 )
 [1] = Array
 (
[col3] = 1
[col4] = boroda 2
 )
 [2] = Array
 (
[col3] = 2
[col4] = boroda 3
 )
)
[p2] = Array
(
 [0] = Array
 (
[col3] = 2
[col4] = boroda 4
 )
 [1] = Array
 (
[col3] = 2
[col4] = boroda 5
 )
   )
 )
[14] = Array
(
 [p3] = Array
   (
 [0] = Array
 (
[col3] = 2
[col4] = boroda 6
 )
   )
 [p4] = Array
   (
 [0] = Array
 (
[col3] = 2
[col4] = boroda 7
 )
 [1] = Array
 (
[col3] = 2
[col4] = boroda 8
 )

   )
 )

 --
 Best Regards,
 Mike Gavrilov.

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




-- 
Gerardo Benitez
-
www.webseficientes.com.ar
Diseño web, programación, Seo


[PHP] mysql problems

2011-05-11 Thread Curtis Maurand


I'm running PHP 5.3.6, Mysql 5.1.51 and Apache 2.2.17

I have
code that does a simple mysql_query();  the query on the commandline
returns an empty set.  when run via PHP and the web server, the page
hangs, it never gets to the if (mysql_num_rows($result)  0) {}. and
the queries per second on mysql goes from roughly 4 per second to about
12,000.

Does anyone have any ideas?

Thanks,
Curtis


Re: [PHP] mysql problems

2011-05-11 Thread Marc Guay
 Does anyone have any ideas?

Sounds like it's getting caught in a loop.  Post the whole script for
best results.

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



Re: [PHP] How in PDOStatement-fetchAll use PDO::FETCH_GROUP for grouping more than one column simultaneously?

2011-05-11 Thread Михаил Гаврилов
Hi Gerardo.

Of course I can make grouping array by using PHP functions, but if
function fetchAll with parameter PDO::FETCH_GROUP  will be have this
feature. The described variant will be more clean and beautiful.

--
Best Regards,
Mike Gavrilov.

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



[PHP] Re: Storing indefinite arrays in database

2011-05-11 Thread Shawn McKenzie
On 05/10/2011 03:16 PM, Benedikt Voigt wrote:
 Hi,
 I'am very new to PHP, so please any comment is welcome.
 
 I want to write a function in PHP, which takes X arguments and outputs a
 value.
 The functioning of this function should be stored in a db (mydb? or
 better alternatives?)
 The function would look up the result in the db based on the X arguments.
 
 But how can I store X arguments and the corresponding output value?
 If I limit the X arguments to a specific number like N=10, then I could
 create N=10 +1 columns in a table.
 But how should I do it if I don't want to limit myself to a fix number?
 
 Thanks for any comment!
 Ben

Two ways that come to mind:

1. If you don't need to search, join, etc. on any of the arguments in
the DB (*and never will need to*), then serialize the array and store it
in one column and the result in another.

2. Use two tables:

results
id  result
1   50
2   99

arguments
id  results_id  argument
1   1   800
2   1   999
3   1   3.14

Then you just join results.id on arguments.results_id in your query.

If you actually need to store the argument name then just add another
column called variable and change the argument column's name to value.


id  results_id  variable  value


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] mysql problems

2011-05-11 Thread Curtis Maurand


Marc Guay wrote:
 Does anyone have any ideas?
 
 Sounds like it's getting caught in a loop.  Post the whole script
for
 best results.
 
It looks like the site is
under attack, because I keep seeing the query, SELECT catagory_parent FROM 
t_catagories where catagory_ID= .
$_currentCat

where $_currentCat is equal to a
value not in the database.  The only way that this can happen is if
the page is called directly without going through the default page.


the script follows.  its called leftNav.php



?php
include
'media/includes/productDetail.php';

//$username =
alaric;
$username = pinetree;
//$password = password_removed;
$password =
password_removed;
$hostname = 127.0.0.1;
//$hostname = www.superseeds.com;

if($_SESSION[u_id]==){
$_SESSION[u_id] = uniqid();
}

//
$_cartTotal=$0.00;
$_cartCount=0;





function tallyCart($_u_id){
    global $username;
    global
$password;
    global $hostname; 
    global $_cartTotal; 
    global
$_cartCount; 
    
    $dbhandle =
mysql_connect($hostname, $username, $password) 
   
     or die(Unable to connect to
MySQL);
         
    $selected =
mysql_select_db(pinetree,$dbhandle) 
   
  or die(Could not select examples);
    
    //execute the SQL query and
return records
    $result = mysql_query(SELECT
* from tbl_Cart where u_ID='.$_u_id.');
    $_holder=;
    
    $_counter=0;
   
$_getSubTotal=0;
    $_showCheckOut=0;
    while ($row = mysql_fetch_array($result)) {
        $_showCheckOut=1;
        $_pdetail=new
ProductDetail($row{'product_ID'}, $row{'product_Quantity'}, $_u_id);
         $_getSubTotal +=
$_pdetail-_subTotal;
       
 $_counter++;
 }
   
$_cartTotal = $.number_format($_getSubTotal,2);
    $_cartCount = $_counter;
   
mysql_close($dbhandle);
}

tallyCart($_SESSION[u_id]);
?





div id=div_cartCall
    div id=div_cartCall_head
    You have ?php echo $_cartCount? items in your
cart.br/br/
    Cart total: ?php
echo $_cartTotal?
    /div
    div id=div_cartCall_foot
    a href=cart.php#65533; Go to
cart/a
    /div
/div
p





  ?php

//$username = alaric;
$username = pinetree;
//$password =
removed;
$password = removed;
//$hostname = 127.0.0.1;
$hostname =
www.superseeds.com;

$_parents = array();  
$counter=0;

if($_GET[cat]!=){
    $_parent =$_GET[cat];
}
else{
    $_parent =0;
}


$dbhandle2 = mysql_connect($hostname, $username, $password) 
 or die(Unable to connect to MySQL);
//echo
Connected to MySQLbr;

//select a database
to work with
$selected =
mysql_select_db(pinetree,$dbhandle2) 
  or
die(Could not select examples);

   
while ($_parent !=0) {
   
    $result_2 = mysql_query(SELECT catagory_parent
FROM t_catagories where catagory_ID= .$_parent);
        $num_rows_2 =
mysql_num_rows($result_2);
       
if($num_rows_2  0)
   
    {
       
    while ($row = mysql_fetch_array($result_2)) {
           
    $_parent= $row{'catagory_parent'};
           
    $_parents[$counter] = $row{'catagory_parent'};
           
    $counter++;
       
    }
        }
    }
    mysql_close($dbhandle2);
    



function getParent($catID,
$matchingID){

//$username = alaric;
$username
= pinetree;
//$password = removed;
$password = removed;
//$hostname =
127.0.0.1;
$hostname = www.superseeds.com;
    
    
   
$_parent=1;
    $_currentCat=$catID;
    $dbhandle2 = mysql_connect($hostname, $username,
$password) 
     or die(Unable to connect
to MySQL);
    //echo Connected to
MySQLbr;
    
   
//select a database to work with
    $selected =
mysql_select_db(pinetree,$dbhandle2) 
   
  or die(Could not select examples);
    
        while
($_parent !=0) {
       
    $result_2 = mysql_query(SELECT catagory_parent
FROM t_catagories where catagory_ID= . $_currentCat);
              while
($row = mysql_fetch_array($result_2)) {
   
           
$_parent=$row{'catagory_parent'};
   
           
if($row{'catagory_parent'}==$matchingID){
   
           
    mysql_close($dbhandle2);
   
           
 return true;
   
             }
   
 
}
        }
   
mysql_close($dbhandle2);
    return false;
    
}

?
  
  
  
  ?php






function getRowCount($_catID){

    global
$_parents;
    global $username;
    global $password;
    global
$hostname; 
     
   
$dbhandle = mysql_connect($hostname, $username, $password) 
     or die(Unable to connect to
MySQL);
     
   
$selected = mysql_select_db(pinetree,$dbhandle) 
      or die(Could not select
examples);
     
   
$result = mysql_query(SELECT COUNT(*) as theCount FROM t_catagories
where catagory_parent=.$_catID);
     
    while ($row = mysql_fetch_array($result)) {
       
if($row{'theCount'}==0){
   
        mysql_close($dbhandle);
            return
0;
        }
        else{
   
        mysql_close($dbhandle);
            return
.$row{'theCount'};
       
}
    }
}




function
generateNav($_parent, $_style){

   
if(getRowCount($_parent)0){
    
        global $_parents;
        global $username;
        global $password;
        global $hostname; 
         
   
    $dbhandle3 = 

Re: [PHP] mysql problems

2011-05-11 Thread Curtis Maurand


Marc Guay wrote:
 Does anyone have any ideas?
 
 Sounds like it's getting caught in a loop.  Post the whole script
for
 best results.
 
It looks like the site is
under attack, because I keep seeing the query, SELECT catagory_parent FROM 
t_catagories where catagory_ID= .
$_currentCat

where $_currentCat is equal to a
value not in the database.  The only way that this can happen is if
the page is called directly without going through the default page.


the script follows.  its called leftNav.php



?php
include
'media/includes/productDetail.php';

//$username =
alaric;
$username = pinetree;
//$password = password_removed;
$password =
password_removed;
$hostname = 127.0.0.1;
//$hostname = www.superseeds.com;

if($_SESSION[u_id]==){
$_SESSION[u_id] = uniqid();
}

//
$_cartTotal=$0.00;
$_cartCount=0;





function tallyCart($_u_id){
    global $username;
    global
$password;
    global $hostname; 
    global $_cartTotal; 
    global
$_cartCount; 
    
    $dbhandle =
mysql_connect($hostname, $username, $password) 
   
     or die(Unable to connect to
MySQL);
         
    $selected =
mysql_select_db(pinetree,$dbhandle) 
   
  or die(Could not select examples);
    
    //execute the SQL query and
return records
    $result = mysql_query(SELECT
* from tbl_Cart where u_ID='.$_u_id.');
    $_holder=;
    
    $_counter=0;
   
$_getSubTotal=0;
    $_showCheckOut=0;
    while ($row = mysql_fetch_array($result)) {
        $_showCheckOut=1;
        $_pdetail=new
ProductDetail($row{'product_ID'}, $row{'product_Quantity'}, $_u_id);
         $_getSubTotal +=
$_pdetail-_subTotal;
       
 $_counter++;
 }
   
$_cartTotal = $.number_format($_getSubTotal,2);
    $_cartCount = $_counter;
   
mysql_close($dbhandle);
}

tallyCart($_SESSION[u_id]);
?





div id=div_cartCall
    div id=div_cartCall_head
    You have ?php echo $_cartCount? items in your
cart.br/br/
    Cart total: ?php
echo $_cartTotal?
    /div
    div id=div_cartCall_foot
    a href=cart.php#65533; Go to
cart/a
    /div
/div
p





  ?php

//$username = alaric;
$username = pinetree;
//$password =
removed;
$password = removed;
//$hostname = 127.0.0.1;
$hostname =
www.superseeds.com;

$_parents = array();  
$counter=0;

if($_GET[cat]!=){
    $_parent =$_GET[cat];
}
else{
    $_parent =0;
}


$dbhandle2 = mysql_connect($hostname, $username, $password) 
 or die(Unable to connect to MySQL);
//echo
Connected to MySQLbr;

//select a database
to work with
$selected =
mysql_select_db(pinetree,$dbhandle2) 
  or
die(Could not select examples);

   
while ($_parent !=0) {
   
    $result_2 = mysql_query(SELECT catagory_parent
FROM t_catagories where catagory_ID= .$_parent);
        $num_rows_2 =
mysql_num_rows($result_2);
       
if($num_rows_2  0)
   
    {
       
    while ($row = mysql_fetch_array($result_2)) {
           
    $_parent= $row{'catagory_parent'};
           
    $_parents[$counter] = $row{'catagory_parent'};
           
    $counter++;
       
    }
        }
    }
    mysql_close($dbhandle2);
    



function getParent($catID,
$matchingID){

//$username = alaric;
$username
= pinetree;
//$password = removed;
$password = removed;
//$hostname =
127.0.0.1;
$hostname = www.superseeds.com;
    
    
   
$_parent=1;
    $_currentCat=$catID;
    $dbhandle2 = mysql_connect($hostname, $username,
$password) 
     or die(Unable to connect
to MySQL);
    //echo Connected to
MySQLbr;
    
   
//select a database to work with
    $selected =
mysql_select_db(pinetree,$dbhandle2) 
   
  or die(Could not select examples);
    
        while
($_parent !=0) {
       
    $result_2 = mysql_query(SELECT catagory_parent
FROM t_catagories where catagory_ID= . $_currentCat);
              while
($row = mysql_fetch_array($result_2)) {
   
           
$_parent=$row{'catagory_parent'};
   
           
if($row{'catagory_parent'}==$matchingID){
   
           
    mysql_close($dbhandle2);
   
           
 return true;
   
             }
   
 
}
        }
   
mysql_close($dbhandle2);
    return false;
    
}

?
  
  
  
  ?php






function getRowCount($_catID){

    global
$_parents;
    global $username;
    global $password;
    global
$hostname; 
     
   
$dbhandle = mysql_connect($hostname, $username, $password) 
     or die(Unable to connect to
MySQL);
     
   
$selected = mysql_select_db(pinetree,$dbhandle) 
      or die(Could not select
examples);
     
   
$result = mysql_query(SELECT COUNT(*) as theCount FROM t_catagories
where catagory_parent=.$_catID);
     
    while ($row = mysql_fetch_array($result)) {
       
if($row{'theCount'}==0){
   
        mysql_close($dbhandle);
            return
0;
        }
        else{
   
        mysql_close($dbhandle);
            return
.$row{'theCount'};
       
}
    }
}




function
generateNav($_parent, $_style){

   
if(getRowCount($_parent)0){
    
        global $_parents;
        global $username;
        global $password;
        global $hostname; 
         
   
    $dbhandle3 = 

RE: [PHP] Short tag: why is it bad practice?

2011-05-11 Thread Daevid Vincent
 -Original Message-
 From: Joshua Kehn [mailto:josh.k...@gmail.com]
 Sent: Tuesday, May 10, 2011 8:19 AM
 To: Andre Polykanine
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Short tag: why is it bad practice?
 
 On May 10, 2011, at 11:11 AM, Andre Polykanine wrote:
 
  Hi everyone,
  Many  times  I heard that the following two peaces of code are written
  in a bad manner:
  1.
  ?
  echo Hello, world!;
  ?
 
  2.
  form action=script.php method=post
  pYour   e-mail:   input   type=text   id=uemail   name=uemail
  value=?=$f['Email']?/p
  ...
  /form
 
  As for now, I use both quite often. Why is this considered not kosher,
  I mean, good coding practice?
  Thanks!
 
  --
  With best regards from Ukraine,
  Andre
  Skype: Francophile
  Twitter: http://twitter.com/m_elensule
  Facebook: http://facebook.com/menelion
 
 
 Because short tags aren't always enabled and can cause things to break
when
 deploying code to different environments. Best practice dictates that your
 code should be as environmentally independent as possible.
 
 It's another few characters, why neglect it?

This is always a source of confusion.

http://www.bin-co.com/php/articles/using_php_short_tags.php

?= $foo ? is generally NOT what the short tags controversy are about.

It's the use of ? Some php here ?  vs. ?php some php here ?

While it is true that the 'short_open_tag' directive enables both (for some
stupid reason), the issue is that it's poor form to use JUST ? And not
?php just as it's a bad idea to use % % (asp tags).

Using ?= is perfectly fine and in my personal and professional opinion,
preferred to the uglier ?php echo $foo; ? way

This topic was very heated when the core PHP developers were going to remove
the ? Form all together in future PHP 6  versions and everyone got their
panties in a bunch because they assumed it meant the ?= form too (which it
did not).

http://php.net/manual/en/ini.core.php

http://www.php.net/~derick/meeting-notes.html#remove-support-for-and-script-
language-php-and-add-php-var





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



Re: [PHP] Short tag: why is it bad practice?

2011-05-11 Thread Andre Polykanine
Hello,

 So, as I've understood, the only issue with ? // blah-blah ? is
the ?xml version 1.0? thing?
Thanks!



-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Daevid Vincent dae...@daevid.com
To: php-general@lists.php.net
Date created: , 9:55:23 PM
Subject: [PHP] Short tag: why is it bad practice?


   -Original Message-
 From: Joshua Kehn [mailto:josh.k...@gmail.com]
 Sent: Tuesday, May 10, 2011 8:19 AM
 To: Andre Polykanine
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Short tag: why is it bad practice?
 
 On May 10, 2011, at 11:11 AM, Andre Polykanine wrote:
 
  Hi everyone,
  Many  times  I heard that the following two peaces of code are written
  in a bad manner:
  1.
  ?
  echo Hello, world!;
  ?
 
  2.
  form action=script.php method=post
  pYour   e-mail:   input   type=text   id=uemail   name=uemail
  value=?=$f['Email']?/p
  ...
  /form
 
  As for now, I use both quite often. Why is this considered not kosher,
  I mean, good coding practice?
  Thanks!
 
  --
  With best regards from Ukraine,
  Andre
  Skype: Francophile
  Twitter: http://twitter.com/m_elensule
  Facebook: http://facebook.com/menelion
 
 
 Because short tags aren't always enabled and can cause things to break
when
 deploying code to different environments. Best practice dictates that your
 code should be as environmentally independent as possible.
 
 It's another few characters, why neglect it?

This is always a source of confusion.

http://www.bin-co.com/php/articles/using_php_short_tags.php

?= $foo ? is generally NOT what the short tags controversy are about.

It's the use of ? Some php here ?  vs. ?php some php here ?

While it is true that the 'short_open_tag' directive enables both (for some
stupid reason), the issue is that it's poor form to use JUST ? And not
?php just as it's a bad idea to use % % (asp tags).

Using ?= is perfectly fine and in my personal and professional opinion,
preferred to the uglier ?php echo $foo; ? way

This topic was very heated when the core PHP developers were going to remove
the ? Form all together in future PHP 6  versions and everyone got their
panties in a bunch because they assumed it meant the ?= form too (which it
did not).

http://php.net/manual/en/ini.core.php

http://www.php.net/~derick/meeting-notes.html#remove-support-for-and-script-
language-php-and-add-php-var





-- 
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] Re: Storing indefinite arrays in database

2011-05-11 Thread Benedikt Voigt

Thanks Shawn,

yes, your second idea works for me. The first one not, as I need to 
search and join on it.

To continue your second idea with your example:

Arguments:
id  results_id  variablevalue
1   1   1   800
2   1   2   999
3   1   3   3.14

Results:
id  result
1   50
2   99

The Arguments and Results table would be filled dynamically by user content.
In order to run a function, I have to do N times a join, whereas N is the 
number of arguments:

select result
from Results join Arguments as A1 join Arguments as A2 join Arguments as A3
on Results.id=A1.results_id and
on Results.id=A2.results_id and
on Results.id=A3.results_id and
where
A1.variable=1 and A1.value=800 and
A2.variable=2 and A2.value=999 and
A3.variable=3 and A3.value=3.14 and
A1.results_id=Results.results_id and
A2.results_id=Results.results_id and
A3.results_id=Results.results_id

Theoretically this works, but how good will be the performance if there are 
Thousands of entries?
Anyway, I will try out.
Thanks again,
Ben




Shawn McKenzie schrieb:


On 05/10/2011 03:16 PM, Benedikt Voigt wrote:
   

Hi,
I'am very new to PHP, so please any comment is welcome.

I want to write a function in PHP, which takes X arguments and outputs a
value.
The functioning of this function should be stored in a db (mydb? or
better alternatives?)
The function would look up the result in the db based on the X arguments.

But how can I store X arguments and the corresponding output value?
If I limit the X arguments to a specific number like N=10, then I could
create N=10 +1 columns in a table.
But how should I do it if I don't want to limit myself to a fix number?

Thanks for any comment!
Ben
 

Two ways that come to mind:

1. If you don't need to search, join, etc. on any of the arguments in
the DB (*and never will need to*), then serialize the array and store it
in one column and the result in another.

2. Use two tables:

results
id  result
1   50
2   99

arguments
id  results_id  argument
1   1   800
2   1   999
3   1   3.14

Then you just join results.id on arguments.results_id in your query.

If you actually need to store the argument name then just add another
column called variable and change the argument column's name to value.


id  results_id  variable  value


   



--
Benedikt Voigt

Tucholskystrasse 33
10117 Berlin
Mobile: 0049/1775902210
GERMANY

25 Carter House
Brune Street
E1 7NN London
Mobile: 0044 7800744839
GREAT BRITAIN


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



[PHP] Odd array_push issue

2011-05-11 Thread Richard S. Crawford
I'm encountering what appears to be a bug in array_push when I try using
that function to add objects to an array. For example...

A = Object 1
B = Object 2

If I execute the following code:

array_push(objectarray, A);
array_push(objectarray, B);

...I expect the contents of $objectarray to be:

[0] = A
[1] = B

Instead, the last object pushed onto the array is repeated throughout the
array. In other words, instead of the above, I get this:

[0] = B
[1] = B

Can anyone enlighten me as to why this is happening? I've looked through bug
reports but haven't found anything, which leads me to think that perhaps my
own code is at fault.

-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com


Re: [PHP] Short tag: why is it bad practice?

2011-05-11 Thread David Harkness
On Wed, May 11, 2011 at 11:55 AM, Daevid Vincent dae...@daevid.com wrote:

 ?= $foo ? is generally NOT what the short tags controversy are about.


 It's the use of ? Some php here ?  vs. ?php some php here ?


This is the same thing my colleague told me when I first joined and began
learning PHP and is the reason we use ?= and ?php.

While it is true that the 'short_open_tag' directive enables both (for some
 stupid reason), the issue is that it's poor form to use JUST ? And not
 ?php just as it's a bad idea to use % % (asp tags).


This is what doesn't make sense to me. One camp says that short open tags
are bad because the option is not always enabled, but that would include ?=
as well. And if ? is only a problem when mixing PHP and XML--and you can
always echo the XML directive anyway--I don't see that ? is actually a
problem once you decide that ?= is okay (short_open_tags is enabled). The
file extension is .php so it should be safe to assume that ? means PHP
code follows just as ?= means a PHP expression follows.

There must be some other reason why ? is bad while ?= is okay. If not, no
big deal, and I'll probably keep using ?php anyway, but it seems odd that
there would be so much controversy over it.

This topic was very heated when the core PHP developers were going to remove
 the ? Form all together in future PHP 6  versions and everyone got their
 panties in a bunch because they assumed it meant the ?= form too (which it
 did not).


Out of curiosity, did the original proposal for PHP 6 remove the
short_open_tags setting (and thus ?= as well) or did it redefine ?= not to
be a short open tag?

David


Re: [PHP] Odd array_push issue

2011-05-11 Thread Peter Lind
On 11 May 2011 22:23, Richard S. Crawford rich...@underpope.com wrote:
 I'm encountering what appears to be a bug in array_push when I try using
 that function to add objects to an array. For example...

 A = Object 1
 B = Object 2

 If I execute the following code:

 array_push(objectarray, A);
 array_push(objectarray, B);

 ...I expect the contents of $objectarray to be:

 [0] = A
 [1] = B

 Instead, the last object pushed onto the array is repeated throughout the
 array. In other words, instead of the above, I get this:

 [0] = B
 [1] = B

 Can anyone enlighten me as to why this is happening? I've looked through bug
 reports but haven't found anything, which leads me to think that perhaps my
 own code is at fault.


If you could post some more of your code, it would be easier to check
if your code is at fault or not.

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

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



Re: [PHP] Odd array_push issue

2011-05-11 Thread David Harkness
On Wed, May 11, 2011 at 1:23 PM, Richard S. Crawford
rich...@underpope.comwrote:

 If I execute the following code:

 array_push(objectarray, A);
 array_push(objectarray, B);

 ...I expect the contents of $objectarray to be:

 [0] = A
 [1] = B

 Instead, the last object pushed onto the array is repeated throughout the
 array. In other words, instead of the above, I get this:

 [0] = B
 [1] = B


It appears to be a problem with references. Are you using a reference in a
loop? Can you paste your actual code? It works fine for me:

php  class Foo { public $name; function __construct($name) { $this-name =
$name; } function __toString() { return $this-name; } }
php  $a = new Foo('A');
php  $b = new Foo('B');
php  $x = array();
php  array_push($x, $a);
php  array_push($x, $b);
php  var_dump($x);

array(2) {
  [0]=
  object(Foo)#1 (1) {
[name]=
string(1) A
  }
  [1]=
  object(Foo)#2 (1) {
[name]=
string(1) B
  }
}

David


Re: [PHP] Odd array_push issue

2011-05-11 Thread Richard S. Crawford
On Wed, May 11, 2011 at 1:30 PM, Peter Lind peter.e.l...@gmail.com wrote:

 On 11 May 2011 22:23, Richard S. Crawford rich...@underpope.com wrote:
  I'm encountering what appears to be a bug in array_push when I try using
  that function to add objects to an array. For example...
 
  A = Object 1
  B = Object 2
 
  If I execute the following code:
 
  array_push(objectarray, A);
  array_push(objectarray, B);
 
  ...I expect the contents of $objectarray to be:
 
  [0] = A
  [1] = B
 
  Instead, the last object pushed onto the array is repeated throughout the
  array. In other words, instead of the above, I get this:
 
  [0] = B
  [1] = B
 
  Can anyone enlighten me as to why this is happening? I've looked through
 bug
  reports but haven't found anything, which leads me to think that perhaps
 my
  own code is at fault.
 

 If you could post some more of your code, it would be easier to check
 if your code is at fault or not.

 Regards
 Peter


Here's some more sample code, then:


function retrieve_records ($where) {
 (Returns an array of objects which represent rows from a database
query)
}

$records = retrieve_records($condition);

$recordlist  = array();

foreach ($records as $record) {

 array_push ($recordlist, $record)

}


I know this code isn't very useful, but these are the conditions which cause
the issue I've mentioned.

-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com


Re: [PHP] Odd array_push issue

2011-05-11 Thread Peter Lind
On 11 May 2011 22:39, Richard S. Crawford rich...@underpope.com wrote:
 On Wed, May 11, 2011 at 1:30 PM, Peter Lind peter.e.l...@gmail.com wrote:

 On 11 May 2011 22:23, Richard S. Crawford rich...@underpope.com wrote:
  I'm encountering what appears to be a bug in array_push when I try using
  that function to add objects to an array. For example...
 
  A = Object 1
  B = Object 2
 
  If I execute the following code:
 
  array_push(objectarray, A);
  array_push(objectarray, B);
 
  ...I expect the contents of $objectarray to be:
 
  [0] = A
  [1] = B
 
  Instead, the last object pushed onto the array is repeated throughout
  the
  array. In other words, instead of the above, I get this:
 
  [0] = B
  [1] = B
 
  Can anyone enlighten me as to why this is happening? I've looked through
  bug
  reports but haven't found anything, which leads me to think that perhaps
  my
  own code is at fault.
 

 If you could post some more of your code, it would be easier to check
 if your code is at fault or not.

 Regards
 Peter

 Here's some more sample code, then:

 
 function retrieve_records ($where) {
      (Returns an array of objects which represent rows from a database
 query)
 }

 $records = retrieve_records($condition);

 $recordlist  = array();

 foreach ($records as $record) {

  array_push ($recordlist, $record)

 }
 

 I know this code isn't very useful, but these are the conditions which cause
 the issue I've mentioned.

class a {
public function __construct() {
$this-rand = mt_rand();
}
}

function retrieve_records () {
return array(
new a,
new a,
new a,
new a,
new a,
);
}

$records = retrieve_records();

$recordlist  = array();

foreach ($records as $record) {
 array_push ($recordlist, $record);
}

die(var_dump($recordlist));

gives me:

array(5) {
  [0]=
  object(a)#1 (1) {
[rand]=
int(515141845)
  }
  [1]=
  object(a)#2 (1) {
[rand]=
int(804365869)
  }
  [2]=
  object(a)#3 (1) {
[rand]=
int(32698894)
  }
  [3]=
  object(a)#4 (1) {
[rand]=
int(1375725959)
  }
  [4]=
  object(a)#5 (1) {
[rand]=
int(100662005)
  }
}


I'd say there's a problem in your code. Check where you might be using
references, chances are you're using one somewhere and not unsetting
it afterwards.

Regards
Peter
-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

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



Re: [PHP] Odd array_push issue

2011-05-11 Thread David Harkness
On Wed, May 11, 2011 at 1:50 PM, Peter Lind peter.e.l...@gmail.com wrote:

 I'd say there's a problem in your code. Check where you might be using
 references, chances are you're using one somewhere and not unsetting
 it afterwards.


Also make sure that the code that receives the final array isn't modifying
the objects in a way to make it *appear* that you have the same object
multiple times when in fact you have multiple unique instances containing
duplicate values.

David


RE: [PHP] Re: Storing indefinite arrays in database

2011-05-11 Thread Jasper Mulder


 Date: Wed, 11 May 2011 22:15:21 +0200
 From: benedikt.vo...@web.de
 To: nos...@mckenzies.net
 CC: php-general@lists.php.net
 Subject: Re: [PHP] Re: Storing indefinite arrays in database

 Thanks Shawn,

 yes, your second idea works for me. The first one not, as I need to
 search and join on it.
 To continue your second idea with your example:

 Arguments:
 id results_id variable value
 1 1 1 800
 2 1 2 999
 3 1 3 3.14

 Results:
 id result
 1 50
 2 99

 The Arguments and Results table would be filled dynamically by user content.
 In order to run a function, I have to do N times a join, whereas N is the 
 number of arguments:

 select result
 from Results join Arguments as A1 join Arguments as A2 join Arguments as A3
 on Results.id=A1.results_id and
 on Results.id=A2.results_id and
 on Results.id=A3.results_id and
 where
 A1.variable=1 and A1.value=800 and
 A2.variable=2 and A2.value=999 and
 A3.variable=3 and A3.value=3.14 and
 A1.results_id=Results.results_id and
 A2.results_id=Results.results_id and
 A3.results_id=Results.results_id

 Theoretically this works, but how good will be the performance if there are 
 Thousands of entries?
 Anyway, I will try out.
 Thanks again,
 Ben

Dear Ben,

Firstly, as this is my first post to this list I apologize for any etiquette 
mistakes.

I would like to suggest to you a different approach, which would be more 
dynamical:
First, you would have a table which stores the number of arguments of a certain 
entry, something like

   record_id   num_of_arg

You would store the num_of_arg entry in a PHP variable, say $num.
Then you would proceed to use 

  CREATE TABLE IF NOT EXISTS \'entries_.$num.\' ...some more code... 

to create a table which can store precisely $num arguments per record.
Then you add it to that table using standard MySQL.
Effectively this groups all records into tables according to $num.

The only thing here is that you probably need to call the database two times:
 - first to get num_of_arg to be able to call onto the right table
 - second to get the data

But as the number of arguments would go into the thousands, no huge join would 
be necessary.
Only thing is, that you would have very wide tables (I don't know how wide 
MySQL can go).

Creating tables on-the-fly as necessary seems to be something you could 
consider,
but again I stress that I don't know performance details. There might be 
something quicker.

So far for my 2c. Hopefully, it is of some help.

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



Re: [PHP] Re: Storing indefinite arrays in database

2011-05-11 Thread Benedikt Voigt

Thank you Jasper,

this also sounds like an interesting approach.
But creating tables on the fly brings me to the idea, that I can also 
enlarge one table on the fly.
Then I could consider the function as a matrice and store it in only one 
table, which can be enlarged dynamically.


I am very new to PHP and havn't programmed for a decade now.
But thank you all (Bastien, Shawn, Jasper) for your comments. Probably I 
will implement all and run then some articifial performance tests agains 
the different versions.

But this will take me weeks or months until I am so far.

And I hoped some new non-relational DB technology could solve the 
challenges I described, but probably not.

Cheers,
Ben


Jasper Mulder schrieb:


   

Date: Wed, 11 May 2011 22:15:21 +0200
From: benedikt.vo...@web.de
To: nos...@mckenzies.net
CC: php-general@lists.php.net
Subject: Re: [PHP] Re: Storing indefinite arrays in database

Thanks Shawn,

yes, your second idea works for me. The first one not, as I need to
search and join on it.
To continue your second idea with your example:

Arguments:
id results_id variable value
1 1 1 800
2 1 2 999
3 1 3 3.14

Results:
id result
1 50
2 99

The Arguments and Results table would be filled dynamically by user content.
In order to run a function, I have to do N times a join, whereas N is the 
number of arguments:

select result
from Results join Arguments as A1 join Arguments as A2 join Arguments as A3
on Results.id=A1.results_id and
on Results.id=A2.results_id and
on Results.id=A3.results_id and
where
A1.variable=1 and A1.value=800 and
A2.variable=2 and A2.value=999 and
A3.variable=3 and A3.value=3.14 and
A1.results_id=Results.results_id and
A2.results_id=Results.results_id and
A3.results_id=Results.results_id

Theoretically this works, but how good will be the performance if there are 
Thousands of entries?
Anyway, I will try out.
Thanks again,
Ben

 

Dear Ben,

Firstly, as this is my first post to this list I apologize for any etiquette 
mistakes.

I would like to suggest to you a different approach, which would be more 
dynamical:
First, you would have a table which stores the number of arguments of a certain 
entry, something like

record_id   num_of_arg

You would store the num_of_arg entry in a PHP variable, say $num.
Then you would proceed to use

   CREATE TABLE IF NOT EXISTS \'entries_.$num.\' ...some more code...

to create a table which can store precisely $num arguments per record.
Then you add it to that table using standard MySQL.
Effectively this groups all records into tables according to $num.

The only thing here is that you probably need to call the database two times:
  - first to get num_of_arg to be able to call onto the right table
  - second to get the data

But as the number of arguments would go into the thousands, no huge join would 
be necessary.
Only thing is, that you would have very wide tables (I don't know how wide 
MySQL can go).

Creating tables on-the-fly as necessary seems to be something you could 
consider,
but again I stress that I don't know performance details. There might be 
something quicker.

So far for my 2c. Hopefully, it is of some help.

Best regards,
Jasper Mulder

   




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



Re: [PHP] Re: Storing indefinite arrays in database

2011-05-11 Thread Shawn McKenzie


On 05/11/2011 03:15 PM, Benedikt Voigt wrote:
 Thanks Shawn,

 yes, your second idea works for me. The first one not, as I need to
 search and join on it.
 To continue your second idea with your example:

 Arguments:
 idresults_idvariablevalue
 111800
 212999
 3133.14

 Results:
 idresult
 150
 299

 The Arguments and Results table would be filled dynamically by user
 content.
 In order to run a function, I have to do N times a join, whereas N is
 the number of arguments:

 select result
 from Results join Arguments as A1 join Arguments as A2 join Arguments
 as A3
 on Results.id=A1.results_id and
 on Results.id=A2.results_id and
 on Results.id=A3.results_id and
 where
 A1.variable=1 and A1.value=800 and
 A2.variable=2 and A2.value=999 and
 A3.variable=3 and A3.value=3.14 and
 A1.results_id=Results.results_id and
 A2.results_id=Results.results_id and
 A3.results_id=Results.results_id

 Theoretically this works, but how good will be the performance if
 there are Thousands of entries?
 Anyway, I will try out.
 Thanks again,
 Ben




 Shawn McKenzie schrieb:

 On 05/10/2011 03:16 PM, Benedikt Voigt wrote:
   
 Hi,
 I'am very new to PHP, so please any comment is welcome.

 I want to write a function in PHP, which takes X arguments and
 outputs a
 value.
 The functioning of this function should be stored in a db (mydb? or
 better alternatives?)
 The function would look up the result in the db based on the X
 arguments.

 But how can I store X arguments and the corresponding output value?
 If I limit the X arguments to a specific number like N=10, then I could
 create N=10 +1 columns in a table.
 But how should I do it if I don't want to limit myself to a fix number?

 Thanks for any comment!
 Ben
  
 Two ways that come to mind:

 1. If you don't need to search, join, etc. on any of the arguments in
 the DB (*and never will need to*), then serialize the array and store it
 in one column and the result in another.

 2. Use two tables:

 results
 id  result
 1   50
 2   99

 arguments
 id  results_id  argument
 1   1   800
 2   1   999
 3   1   3.14

 Then you just join results.id on arguments.results_id in your query.

 If you actually need to store the argument name then just add another
 column called variable and change the argument column's name to value.


 id  results_id  variable  value





I just read your post quickly so maybe I'm off, but your query makes no
sense.

What is known (to use in the where clause to limit by) and what do you
want to retrieve?

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



Re: [PHP] mysql problems

2011-05-11 Thread Sean Greenslade
On Wed, May 11, 2011 at 2:25 PM, Curtis Maurand cur...@maurand.com wrote:



 Marc Guay wrote:
  Does anyone have any ideas?
 
  Sounds like it's getting caught in a loop.  Post the whole script
 for
  best results.
 
 It looks like the site is
 under attack, because I keep seeing the query, SELECT catagory_parent FROM
 t_catagories where catagory_ID= .
 $_currentCat

 where $_currentCat is equal to a
 value not in the database.  The only way that this can happen is if
 the page is called directly without going through the default page.


 the script follows.  its called leftNav.php


[MASSIVE SNIP]

Well, from what I saw while wading through your code, you allow unsanitized
variables to be concatenated to your queries. Big no-no! For ANY
client-generated variable, always sanitize with mysql_real_escape_string. In
fact, sanitize all your variables. It can't hurt.

Also, please don't take a request for your entire code too literally. We
don't like to see pages and pages and pages of code, just the pertinent
bits.
-- 
--Zootboy

Sent from my PC.