PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : PHP-> Warum will der Vote Editor net Funktioniren?



ZeKeE
03.04.2005, 13:50
hallo ihr Liebe Community könntet ihr einen armen alten sekar helfen :D

nene spass beiseite .
Ich habe vpr einiger zeit ein Voting editor mit php gemahct.
hier der Code:


<html>
<head>
<title>
Umfrage erstellen
</title>

</head>
<body>
<?php
error_reporting(0);
$submit = $_GET["submit"];
$frage = $_GET["frage"];
$antwort1 = $_GET["antwort1"];
$antwort2 = $_GET["antwort2"];
$antwort3 = $_GET["antwort3"];
// Das Formular wurde noch nicht gesendet
if (!$submit)
{
?>

<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td>
<form action="editor_voting.php" method="get">
<table cellspacing="5">
<tr>
<td><div>Umfrage-Titel</div></td>
<td>
<input type="Text" name="frage" size="26" />
</td>
</tr>
<tr>
<td><div>Antwort 1</div></td>
<td>
<input type="Text" name="antwort1" size="26" />
</td>
</tr>
<tr>
<td><div>Antwort 2</div></td>
<td>
<input type="Text" name="antwort2" size="26" />
</td>
</tr>
<tr>
<td><div>Antwort 3</div></td>
<td>
<input type="Text" name="antwort3" size="26" />
</td>
</tr>
<td align="right" colspan="2">
<input type="submit" name="submit"
value="Umfrage erstellen" />
</td>
</table>
</form>
</td>
</tr>
</table>

<?php
}
// Das Formular wurde gesendet
else
{
// Verbindung zur Datenbank herstellen
include("include.php");
$connection = mysql_connect($server, $user, $passwort)
or die ("Konnte keine Verbindung zur Datenbank herstellen!")
$query = "INSERT INTO $tabelle (frage, antwort1, antwort2, antwort3)
VALUES ('$frage' , '$antwort1', '$antwort2', '&antwort3')";
$result = mysql_db_query($datenbank, $query, &connection) or die
("Fehler")
// &Uuml;berpr&uuml;fung, ob der Eintrag erfolgreich war
if ($result)
{
echo 'Die Umfrage wurde eingegeben.
<a href="voting.php">jezt ansehen</a>' ;
}
else
{
echo 'Fehler! <a href="editor_voting.php">Bitte neu eingeben</a>';
}
// Verbindung zur Datenbank schlie&szlig;en
mysql_close($connection);
}
?>
</body>
</html>

ja alles shcön und gut alles hat auch im editor gecklapt doch dan als iche s hochgeladen habe und es testen wollte kamm aufeinmal das:

Parse error: parse error, unexpected T_VARIABLE in /usr/export/www/vhosts/funnetwork/hosting/sekar/My SQL und meine PHP Daten/editor_voting.php on line 69



was zum henker ist der fehler?
bitte um echte mega brontale hilfe .

mfg Sekar

dead_orc
03.04.2005, 14:01
Du hast ein ; vergessen ;)

$connection = mysql_connect($server, $user, $passwort)
or die ("Konnte keine Verbindung zur Datenbank herstellen!");
Ich hoffe, das war der richtige Fehler, da ich keine Lust habe, alles nochmal durchzuparsen.

[EDIT]
Gleich danach nochmal:

$result = mysql_db_query($datenbank, $query, &connection) or die
("Fehler");

[EDIT²]
Haha, außnahmsweise war ich schneller :P

Lukas
03.04.2005, 14:01
Die Stelle im Code ist

include("include.php");
$connection = mysql_connect($server, $user, $passwort)
or die ("Konnte keine Verbindung zur Datenbank herstellen!")
$query = "INSERT INTO $tabelle (frage, antwort1, antwort2, antwort3)
VALUES ('$frage' , '$antwort1', '$antwort2', '&antwort3')";
$result = mysql_db_query($datenbank, $query, &connection) or die
("Fehler") Du hast in der ersten Zeile ein Semikolon vergessen. Der richtige Code lautet
include("include.php");
$connection = mysql_connect($server, $user, $passwort)
or die ("Konnte keine Verbindung zur Datenbank herstellen!");
$query = "INSERT INTO $tabelle (frage, antwort1, antwort2, antwort3)
VALUES ('$frage' , '$antwort1', '$antwort2', '&antwort3')";
$result = mysql_db_query($datenbank, $query, &connection) or die
("Fehler") Sonst "denkt" der Php-Interpreter, dass $connection = mysql_connect($server, $user, $passwort)
or die ("Konnte keine Verbindung zur Datenbank herstellen!")$query = "INSERT INTO $tabelle (frage, antwort1, antwort2, antwort3)
VALUES ('$frage' , '$antwort1', '$antwort2', '&antwort3')"; ein Befehl ist.

Edit:
Shice, mal wieder zu langsam.

ZeKeE
03.04.2005, 14:15
danke ^^

blos jezt kommt der fehler hier ^^

Parse error: parse error, unexpected T_STRING, expecting T_VARIABLE or '$' in /usr/export/www/vhosts/funnetwork/hosting/sekar/My SQL und meine PHP Daten/editor_voting.php on line 71

Tomarus
03.04.2005, 14:20
include("include.php");
$connection = mysql_connect($server, $user, $passwort)
or die ("Konnte keine Verbindung zur Datenbank herstellen!");
$query = "INSERT INTO $tabelle (frage, antwort1, antwort2, antwort3)
VALUES ('$frage' , '$antwort1', '$antwort2', '&antwort3')";
$result = mysql_db_query($datenbank, $query, &connection) or die
("Fehler")

Da soll vor das connection in der letzten Zeile wohl eher ein $, oder? ;)

ZeKeE
03.04.2005, 14:45
Danke jezt klappt alles ^.^

dead_orc
03.04.2005, 14:52
Oh mann...

error_reporting(0);

Edit:
Hey, editiere doch nicht einfach deinen Edit wiede weg! Jetzt ist mein Post total zusammenhangslos :(

ZeKeE
03.04.2005, 17:08
allllsooo.
1. Tshculdigung ork ^^

2.
Die probleme gehen weiter also:
hier erstmal der link: http://sekar.se.funpic.de/Sekar/Admin/AdminOptionen_Sekar/Voting/editor_voting.php

alles funktioniert aber wen ich nun was shrieben will komt der große fehler....
woran kann DAS nun wieder ligen=? (wen ein ***** da ist ^^. das ist nur zur sicherheit eine zensirung ^^)

hier der code:


<html>
<head>
<title>
Umfrage erstellen
</title>

</head>
<body>
<?php
error_reporting(0);
$submit = $_GET["submit"];
$frage = $_GET["frage"];
$antwort1 = $_GET["antwort1"];
$antwort2 = $_GET["antwort2"];
$antwort3 = $_GET["antwort3"];
// Das Formular wurde noch nicht gesendet
if (!$submit)
{
?>

<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td>
<form action="editor_voting.php" method="get">
<table cellspacing="5">
<tr>
<td><div>Umfrage-Titel</div></td>
<td>
<input type="Text" name="frage" size="26" />
</td>
</tr>
<tr>
<td><div>Antwort 1</div></td>
<td>
<input type="Text" name="antwort1" size="26" />
</td>
</tr>
<tr>
<td><div>Antwort 2</div></td>
<td>
<input type="Text" name="antwort2" size="26" />
</td>
</tr>
<tr>
<td><div>Antwort 3</div></td>
<td>
<input type="Text" name="antwort3" size="26" />
</td>
</tr>
<td align="right" colspan="2">
<input type="submit" name="submit"
value="Umfrage erstellen" />
</td>
</table>
</form>
</td>
</tr>
</table>

<?php
}
// Das Formular wurde gesendet
else
{
// Verbindung zur Datenbank herstellen
include("include.php");
$connection = mysql_connect(localhost, ******, *********)
or die ("Konnte keine Verbindung zur Datenbank herstellen!");
$query = "INSERT INTO `umfrage` (frage, antwort1, antwort2, antwort3)
VALUES ('$frage' , '$antwort1', '$antwort2', '$antwort3')";

// &Uuml;berpr&uuml;fung, ob der Eintrag erfolgreich war
if (@mysql_query ("$query"))
{
echo 'Die Umfrage wurde eingegeben.
<a href="voting.php">jezt ansehen</a>' ;
}
else
{
echo 'Fehler! <a href="editor_voting.php">Bitte neu eingeben</a>';
}
// Verbindung zur Datenbank schlie&szlig;en
mysql_close($connection);
}
?>
</body>
</html>

dead_orc
03.04.2005, 17:24
Versuchs mal so:

$query = "INSERT INTO `umfrage` (`frage`, `antwort1`, `antwort2`, `antwort3`)
VALUES ('".$frage."' , '".$antwort1."', '".$antwort2."', '".$antwort3."')";

// &Uuml;berpr&uuml;fung, ob der Eintrag erfolgreich war
if (@mysql_query ("$query"))
{
// ...
}
else
{
echo 'Fehler! <a href="editor_voting.php">Bitte neu eingeben</a><br />'.mysql_error();
}

Durch das mysql_error() wird bei einem Fehlschlag die Ursache ausgegeben.

ZeKeE
03.04.2005, 17:34
ah cool danke ^^
Aber ich bin mir sicher da kommt noch was deswegen als ich hier






---->>> <<<----


noch platz frei ^^

Manni
03.04.2005, 18:16
Du hast vergessen eine Datenbak auszuwähle.
schreib vor deine query noch den Befehl mysql_select_db("NameDeinerDatenbank");
Dann müsste eigentlich alle funtkionieren...

ZeKeE
09.04.2005, 21:08
Ach ich dussel XD

jo jezt gehts aber da wahr auch noch irgendwo so ein Leerzeichen XD.

Naja danke euch allen ^^.


mvvvvvvfg sekar