11. januar 2005 - 20:21
Der er
4 kommentarer og
2 løsninger
Parse error: i linie 130 ved et update script
Hejsa Håber der er nogle der kan hjælpe... jeg få en parse error: ved linie 130 kan ikke lige se fejlen, men nu er jeg også ret ny til php/mysql :-)
127 mysql_select_db($database_connect, $connect);
128 $Result1 = mysql_query($updateSQL, $connect) or die(mysql_error())
129
130 $updateGoTo = "thanks.html";
131 if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
132 $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
133 $updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
134 }
135 header(sprintf("Location: %s", $updateGoTo));
}
hvis i skal bruge hele koden må i lige sige til.
11. januar 2005 - 20:38
#2
Takker det hjælp men nu kommer der en fejl i 176
som ser sådan ud
<td width="189"><input type="text" name="sponser" value="<?= $row_update['sponser']; ?>" size="25" maxlegth="100"</p>
hele min form ser sådan her ud, har snart brugt 3 afterner på det her
<form method="POST" action="<?php echo $editFormAction; ?>" name="form1">
<table border="0" width="355" cellspacing="0" cellpadding="0" id="table1">
<tr>
<td width="166">Valgt brugernavn:</td>
<td width="189"> <input type="text" name="valgtbrugernavn" value="<?= $row_update['valgtbrugernavn']; ?>" size="25" maxlegth="100"</p>
</td>
</tr>
<tr>
<td width="166">godkendt:</td>
<td width="189"> <input type="text" name="godkendt" value="<?= $row_update['godkendt]; ?>" size="25" maxlegth="100"</p>
</td>
</tr>
<tr>
<td width="166">sponser:</td>
<td width="189"><input type="text" name="sponser" value="<?= $row_update['sponser']; ?>" size="25" maxlegth="100"</p>
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2">
<p align="center">
<input type="submit" name="send" value="Send dine oplysninger" style="float: left"></td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="svarID" value="<?php echo $row_update['svarID']; ?>">
</form>
</body>
</html>
11. januar 2005 - 20:48
#4
JA det var lige det der skulle til, nu vil den da vise siden. Men den ville ikke update i felterne hvad har jeg gjort galt??
<?php require_once('connect.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE wgi_dansk SET valgtbrugernavn=%s, godkendt=%s, sponser=%s WHERE svarID=%s",
GetSQLValueString(str_replace('.', '', $_POST['valgtbrugernavn']), "text"),
GetSQLValueString(str_replace('.', '', $_POST['godkendt']), "text"),
GetSQLValueString(str_replace('.', '', $_POST['sponser']), "text"),
GetSQLValueString(str_replace('.', '', $_POST['svarID']), "int"));
mysql_select_db($database_connect, $connect);
$Result1 = mysql_query($updateSQL, $connect) or die(mysql_error());
$updateGoTo = "thanks.html";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_connect, $connect);
$query_update = "SELECT * FROM `wgi_dansk` WHERE svarID = '$_GET[id]' ORDER BY svarID desc";
$update = mysql_query($query_update) or die(mysql_error());
$row_update = mysql_fetch_assoc($update);
$totalRows_update = mysql_num_rows($update);
?>