This topic is locked

Syntax error in events.php

10/22/2008 2:51:59 AM
PHPRunner General questions
D
dbex author

The following code, produced by PHPRunner5, returns the following error
Parse error: syntax error, unexpected $end in F:\\\\include\c_books_events.php on line 286
None of the application code has been altered and line 286 conssts of just the ?> tag. (I have stripped out most of the blank lines from the code below)
[codebox]

<?php
// After record updated

function AfterEdit(&$values, $where, &$oldvalues, &$keys,$inline)

{

// Parameters:

// $values - Array object.

// Each field on the Edit form is represented as a 'Field name'-'Field value' pair

// $where - string with WHERE clause pointing to record to be edited

// $oldvalues - Array object with existing data record content

// $keys - Array object with added record key column values
//**
Display a message on the Web page ****

echo "Your message here".$values["Title"];
} // function AfterEdit
// After record deleted

function AfterDelete($where,&$deleted_values)

{

// Parameters:

// $deleted_values - Array object.

// Each field on the List page is represented as a 'Field name'-'Field value' pair

// $where - string with WHERE clause pointing to record to be deleted.
//** Custom code ****

// put your custom code here

$BookID=$deleted_values["BookID"];
$query = "UPDATE products SET products_status = 0 WHERE products_id = '$BookID'";
mysql_query($query) or die('Error, query failed');
} // function AfterDelete
// After record added

function AfterAdd(&$values,&$keys,$inline)

{

// Parameters:

// $values - Array object.

// Each field on the Add form is represented as a 'Field name'-'Field value' pair

// $keys - Array object with added record key column values
//** Display a message on the Web page ****
//mysql_insert_id ([ resource $link_identifier ] )
$quantity=1;

$nothing=0;

$coderef = mysql_insert_id();

$entry_date = date('Y-m-d H:m:s');
$sql = "Select * from c_books where BookID = $coderef";
$result = @mysql_query($sql);

$now_date = date('Y-m-d H:i:s');
while($row = mysql_fetch_row($result))

{
$BookID = "$row[0]";

$SellerID = "$row[1]";

$Title = addslashes("$row[2]");
$Author = addslashes( "$row[3]");

If ($Author == "")

{

$Author = "-";

}

//echo $Author;

$pub_date = "$row[4]";

if ($pub_date < 1500)

{

$pub_date = "N/A";

}

$publisher = addslashes("$row[5]");

$isbn = "$row[6]";

if ($isbn < 1)

{

$isbn = "-";

}

$description = addslashes("$row[8]");

$SKU = addslashes("$row[9]");

$price = "$row[10]";

$type = "$row[7]";
$cat_id = "$row[11]";

$entry_date = "$row[12]";
$bindingquery = "select Description from c_types where TypeID = $type";

$result5 = mysql_query($bindingquery);

$binding = mysql_result($result5,0,"Description");

$blurb2 = "Binding:- ".$binding."
";

echo $binding."
";

$blurb ="Book Ref:- ".$SKU."
";

$blurb0= "Author:- ".$Author."
";

$blurb1 = "Published by ".$publisher;

If ($pub_date > 1)

{

$blurb1.= " in ".$pub_date."
";

}

else

{

$blurb1.= "
";

}

$blurb2a="ISBN:- ".$isbn."
";
//now the book description from field 8

$blurb8 = addslashes("$row[8]")."
";

$blurb.=$blurb0.$blurb1.$blurb2.$blurb2a.$blurb8;
$quantity=1;

$nothing=0;
$query = "insert into products values (

'".$BookID."',

'".$quantity."',

'".$quantity."',

NULL,

NULL,

'".$price."',

'".$nothing."',

'".$entry_date."',

NULL,

'".$entry_date."',

'".$nothing."',

'".$quantity."',

'".$nothing."',

'".$SellerID."',

'".$nothing."',

'".$quantity."',

'".$quantity."',

'".$nothing."',

'".$nothing."',

'".$nothing."',

'".$quantity."',

'".$nothing."',

'".$nothing."',

'".$nothing."',

'".$nothing."',

'".$nothing."',

'".$nothing."',

'".$price."',

'".$cat_id."',

'".$quantity."',

'".$nothing."',

'".$nothing."',

'".$nothing."',

'".$nothing."',

'".$nothing."'
)";

$result2 = mysql_query($query);

if (!$result2)

{

echo $result2." - ". $coderef."
";

}
} // function AfterAdd
?>

[/codebox]
Any help gratefully received as I have now come to a complete halt.

Sergey Kornilov admin 10/22/2008

You need to remove events one by one to find what causes the syntax error.