need someone explain....thanks

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
loongest
Forum Commoner
Posts: 25
Joined: Wed Apr 07, 2004 12:23 pm

need someone explain....thanks

Post 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....???
phait
Forum Commoner
Posts: 46
Joined: Wed Apr 07, 2004 4:41 am
Location: watford / leicester, UK

Post 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.
loongest
Forum Commoner
Posts: 25
Joined: Wed Apr 07, 2004 12:23 pm

Post 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.
Post Reply