Dreamweaver PHP problems
Posted: Sat Oct 10, 2009 12:13 pm
Okay...I have a page to delete a record. Heres the code:
My problem is that when I hit my delete link, the dynamic data is not being added to the url properly. I just get an error that says: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/a/d/v/advemark/html/delete_trip_data.php on line 39
Line 39 is: $deleteGoTo = "trip_data.php?VehicleID=<?php echo $row_Recordset1['VehicleID']; ?>";
What is wrong here?
Code: Select all
<?php require_once('Connections/tester.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
if ((isset($_GET['TripID'])) && ($_GET['TripID'] != "")) {
$deleteSQL = sprintf("DELETE FROM tripdata WHERE TripID=%s",
GetSQLValueString($_GET['TripID'], "int"));
mysql_select_db($database_tester, $tester);
$Result1 = mysql_query($deleteSQL, $tester) or die(mysql_error());
$deleteGoTo = "trip_data.php?VehicleID=<?php echo $row_Recordset1['VehicleID']; ?>";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
$colname_Recordset1 = "-1";
if (isset($_GET['TripID'])) {
$colname_Recordset1 = $_GET['TripID'];
}
mysql_select_db($database_tester, $tester);
$query_Recordset1 = sprintf("SELECT * FROM tripdata WHERE TripID = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $tester) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_free_result($Recordset1);
?>Line 39 is: $deleteGoTo = "trip_data.php?VehicleID=<?php echo $row_Recordset1['VehicleID']; ?>";
What is wrong here?