table
--------------------
products= productid,name,author,description,price,category
category= categoryid,parentcategoryid,name,description
---------------------
code
--------
. . . html code. . .
. . . .
<?php
$database = "book";
$link = mysql_connect("localhost","root","password");
$x = mysql_select_db($database);
if(empty($category))
{
$category=1;
}
$childval = $category;
..the rest of code
what the coding here perform ???? is that the $category = variable from the table product (categery field) for counting any value inside or the statement $category = table category ? if so what = perform....???
need someone explain....thanks
Moderator: General Moderators
hi,
really need to see more of the code, however the first part:
Just seems to be making sure that the category variable has no value -although I suggest you read the manual for the full description of this function as empty is not always 'empty'.
http://uk.php.net/manual/en/function.empty.php
It then will execute the code in the first parentheses, which then sets the category variable to a value of 1.
As to why $childval is being assigned the same value as $category I would not know without seeing more of the code. I could guess but it would not be helpful and most likely wrong.
really need to see more of the code, however the first part:
Code: Select all
if(empty($category))http://uk.php.net/manual/en/function.empty.php
It then will execute the code in the first parentheses, which then sets the category variable to a value of 1.
Code: Select all
{ // is that the $category = variable from the
$category=1; // table product for counting any value inside or
}