Hallo,
bin neu und schraube an einer Site rum und nutze das Programm
DBSUITE WEBBUILDER. Es wirft mir einen netten Code raus. Doch
leider ist irgendwas mit dem "where clause" nicht im Lack.
Da ich nicht so recht weiss wo der fehler liegt schreib ich mal
unverschämter weisse den kompletten Quellcode rein:
Ist da irgendwo ne Variable am fehlen???? Hilfeee und Danke an den finder des Fehlers
Habe scheinbar auch irgendwas falsch bei schreiben gemacht, hoffe ihr könnt das hier trotzdem lesen :-)
bin neu und schraube an einer Site rum und nutze das Programm
DBSUITE WEBBUILDER. Es wirft mir einen netten Code raus. Doch
leider ist irgendwas mit dem "where clause" nicht im Lack.
Da ich nicht so recht weiss wo der fehler liegt schreib ich mal
unverschämter weisse den kompletten Quellcode rein:
PHP-Code:
<?php
$db_hostname = "localhost";
$db_database = "raccoon";
$db_username = "root";
$db_password = "";
$dbconnection = mysql_pconnect($db_hostname, $db_username, $db_password) or die(mysql_error());
$dbloadvalues = false;
$error = false;
$errormessage = "";
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;
}
if ((isset($HTTP_POST_VARS["WB_ACTION"])) && (($HTTP_POST_VARS["WB_ACTION"] == "ADD") || ($HTTP_POST_VARS["WB_ACTION"] == "EDIT") || ($HTTP_POST_VARS["WB_ACTION"] == "DELETE"))) {
}
if ((isset($HTTP_POST_VARS["WB_ACTION"])) && ($HTTP_POST_VARS["WB_ACTION"] == "ADD")) {
if (!$error) {
$sqlcommand = sprintf("insert into `raccoon`.`aktions` (`id`, `date`, `text`, `file`) values (%s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['id'], "int" ),
GetSQLValueString($HTTP_POST_VARS['date'], "date" ),
GetSQLValueString($HTTP_POST_VARS['text'], "text" ),
GetSQLValueString($HTTP_POST_VARS['file'], "text" ));
mysql_select_db($db_database, $dbconnection);
$dbresult = mysql_query($sqlcommand, $dbconnection) or die(mysql_error());
$goto = "summ.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$goto .= (strpos($goto, '?')) ? "&" : "?";
$goto .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $goto));
}
} else if ((isset($HTTP_POST_VARS["WB_ACTION"])) && ($HTTP_POST_VARS["WB_ACTION"] == "EDIT") && (isset($HTTP_POST_VARS["WB_ACTION_ID"]))) {
if (!$error) {
$idval = $HTTP_POST_VARS["WB_ACTION_ID"];
$sqlcommand = sprintf("update `raccoon`.`aktions` set `id`=%s, `date`=%s, `text`=%s, `file`=%s where ``='$idval'",
GetSQLValueString($HTTP_POST_VARS['id'], "int" ),
GetSQLValueString($HTTP_POST_VARS['date'], "date" ),
GetSQLValueString($HTTP_POST_VARS['text'], "text" ),
GetSQLValueString($HTTP_POST_VARS['file'], "text" ));
mysql_select_db($db_database, $dbconnection);
$dbresult = mysql_query($sqlcommand, $dbconnection) or die(mysql_error());
$goto = "summ.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$goto .= (strpos($goto, '?')) ? "&" : "?";
$goto .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $goto));
}
} else if ((isset($HTTP_POST_VARS["WB_ACTION"])) && ($HTTP_POST_VARS["WB_ACTION"] == "DELETE") && (isset($HTTP_POST_VARS["WB_ACTION_ID"]))) {
if (!$error) {
$idval = $HTTP_POST_VARS["WB_ACTION_ID"];
$sqlcommand = "delete from `raccoon`.`aktions` where ``='$idval'";
mysql_select_db($db_database, $dbconnection);
$dbresult = mysql_query($sqlcommand, $dbconnection) or die(mysql_error());
$goto = "summ.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$goto .= (strpos($goto, '?')) ? "&" : "?";
$goto .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $goto));
}
}
if (isset($HTTP_POST_VARS["actionid"])) {
$actionid = $HTTP_POST_VARS["actionid"];
$dbloadvalues = true;
} else if (isset($HTTP_GET_VARS["actionid"])) {
$actionid = $HTTP_GET_VARS["actionid"];
$dbloadvalues = true;
}
if ($dbloadvalues) {
$sqlcommand = "select * from `raccoon`.`aktions` where ``='$actionid'";
mysql_select_db($db_database, $dbconnection);
$dbrecordset = mysql_query($sqlcommand, $dbconnection) or die(mysql_error());
$dbrow = mysql_fetch_assoc($dbrecordset);
$dbtotalrows = mysql_num_rows($dbrecordset);
}
?>
<html>
<head>
<title>Form generated with dbSuite WebBuilder</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.searchHeadline {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #000000;
background-color: #E6E6E6;
margin: 2px;
padding: 2px;
}
.searchLabel {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #000000;
text-align: right;
}
.searchField {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
}
.searchText {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
color: #333333;
margin: 2px;
padding: 2px;
}
.mandatoryFlag {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #660000;
margin: 2px;
text-align: center;
}
.errorTitle {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #FFFFFF;
margin: 2px;
padding: 2px;
background-color: #660000;
}
.errorText {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #333333;
}
.contentHeadline {
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
color: #000000;
margin: 2px;
padding: 2px;
}
.contentText {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
color: #333333;
margin: 2px;
padding: 2px;
}
.contentSubHeadline {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #333333;
margin: 2px;
padding: 2px;
}
-->
</style>
</head>
<body>
<?php
if ($error) {
?>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="errorTitle">Error processing form</td>
</tr>
<tr>
<td class="errorText">Please check the following fields:
<ul>
<?php echo $errormessage; ?></ul></td>
</tr>
<tr>
<td class="contentText"> </td>
</tr>
</table>
<?php
}
?>
<form action="" method="post" enctype="multipart/form-data" name="request" id="request">
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" class="searchHeadline">Autoform: raccoon.aktions</td>
</tr>
<tr>
<td width="180"> </td>
<td width="5"> </td>
<td width="395"> <p> </p></td>
</tr>
<tr>
<td class="searchLabel">id</td>
<td class="mandatoryFlag"> </td>
<td class="searchText"><input name="id" type="text" maxlength="11" size="11" value="<?php if ($error) { echo $HTTP_POST_VARS['id']; } else { echo $dbrow['id']; } ?>" > </td>
</tr>
<tr>
<td class="searchLabel">date</td>
<td class="mandatoryFlag"> </td>
<td class="searchText"><input name="date" type="text" maxlength="22" size="11" value="<?php if ($error) { echo $HTTP_POST_VARS['date']; } else { echo $dbrow['date']; } ?>" > </td>
</tr>
<tr>
<td class="searchLabel">text</td>
<td class="mandatoryFlag"> </td>
<td class="searchText"><input name="text" type="text" value="<?php if ($error) { echo $HTTP_POST_VARS['text']; } else { echo $dbrow['text']; } ?>" > </td>
</tr>
<tr>
<td class="searchLabel">file</td>
<td class="mandatoryFlag"> </td>
<td class="searchText"><input name="file" type="text" value="<?php if ($error) { echo $HTTP_POST_VARS['file']; } else { echo $dbrow['file']; } ?>" > </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td class="searchText"><input type="hidden" value="DELETE" name="WB_ACTION"><input type="hidden" value="<?php echo $actionid; ?>" name="WB_ACTION_ID"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Delete Entry >>"></td>
</tr>
</table>
</form>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="searchHeadline">Form usage</td>
</tr>
<tr>
<td class="contentText">The fields marked with * are mandatory. If you do not enter mandatory values or enter wrong values the form is displayed again with an error message indicating the fields you have to check.</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<p class="contentText"> </p>
</body>
</html>
<?
$abfrage = "SELECT date,text,file FROM aktions";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
echo "__________________________________<br>";
echo $row->date;
echo "<br><b>";
echo $row->text;
echo "a href=\"datapool/"; echo $row->file; echo"\"> Download </a>";
echo "</b><br><br>";
}
?>
Habe scheinbar auch irgendwas falsch bei schreiben gemacht, hoffe ihr könnt das hier trotzdem lesen :-)
Kommentar