CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 a strong developper check this master/detail code?

Print topic Send  topic

Author Message
fracnk
Posted: 08/08/2002, 3:05 AM

//BindEvents Method @1-2931AA87
function BindEvents()
{
global $category;
$category->CCSEvents["BeforeShowRow"] = "category_BeforeShowRow";
}
//End BindEvents Method

function category_BeforeShowRow() { //category_BeforeShowRow @4-2AF00873

global $category;
$c = new clsDBconnection1;
$number = CCDLookUp("count(*)", "speciality", "category_id=" . $category->category_id->Value, $c);
$category->CATEGORY_FR->SetValue($category->CATEGORY_FR->Value. " (" . $number. ")");
//Custom Code @31-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
//End Custom Code

speciality is the table of specialities , a category can have many specialities it's a one to many relation
any support please



} //Close category_BeforeShowRow @4-FCB6E20C

?>

after this I always got the underneath error
Database error: Invalid SQL: SELECT count(*) FROM speciality WHERE category_id=
MySQL Error: 1064 (Something is wrong in your syntax pres de '' a la ligne 1)
Session halted.
Brent
Posted: 08/08/2002, 7:08 AM

It's been a while since I did any weight lifting, but I'll give it a try. :)

The dead giveaway is the error message "category_id=" and it is missng the value.
Always, always, always use ToSQL on any value in an SQL statement. Your $category->category_id->Value
is empty for some reason. By using ToSQL it would have substituted in NULL instead of
an empty value which means the SQL would still execute, but not return any records.

Why your $category->category_id->Value is empty is what you need to look into.
I hope this helps. BTW, get yourself a PHP debugger so you can track these problems down
quicker.
Nicole
Posted: 08/08/2002, 7:15 AM

Hello,
have you added category_id field to the form? Print its value before using in the look up:
echo "category ". $category->category_id->Value;
Do you see correct category value?

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.