Page 1 of 1

need someone explain....thanks

Posted: Wed Apr 07, 2004 12:23 pm
by loongest
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....???

Posted: Wed Apr 07, 2004 12:33 pm
by phait
hi,
really need to see more of the code, however the first part:

Code: Select all

if(empty($category))
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.

Code: Select all

&#123; // is that the $category = variable from the 
$category=1; // table product for counting any value inside or 
&#125;
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.

Posted: Wed Apr 07, 2004 1:06 pm
by loongest
Thanks phait, but i actually learning by reference PHP PROFESSIONAL PROJECT this book(1-931841-53-5) and when i study until chapter14 it make me stuck in there, bcos the code provide does not run and i have to request for somehelp.