Autor Zpráva
Cup
Profil
zdarec lidi ... mam tu kosek kodu ... teprve se ucim a tak sem si skusil vytvorit kousek kodu na pridavani do clanku z jinyho kodu ... ale jaksy mi to nefunguje .. kdo je znaly tak tu chybu uvidi hned ... je mozny ze je to nesmyslna spatlanina ale fakt nevim ... skuste poradit .. diky


<?php
include 'db.inc';
include 'error.inc';

if (empty($_POST["date_added"]) || empty($_POST["nadpis"]) || empty($_POST["gif"]) ||
empty($_POST["info"]) || empty($_POST["clanek"]) || empty($_POST["sestava"]) )
{
?>
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Přidej článek</title>
</head>
<body>

<form enctype="multipart/form-data"
action="add_clanek.php" method="post">
<table>
<col span="1" align="right">
<tr>
<td><font color="red">Datum přidání ( dd/mm/rrrr ):</font> </td>
<td><input type="text" name="date_added" size=10></td>
</tr>
<tr>
<td><font color="red">Xx kolo, soupeř X soupeř,<br> (x:x, x:x, x:x) = třetiny:</font> </td>
<td><textarea name="nadpis" rows=3 cols=60></textarea></td>
</tr>
<tr>
<td><font color="red">Obrazek (GIF format):</font> </td>
<td><input type="hidden" name="MAX_FILE_SIZE" value="30000">
<input name="gif" type="file"></td>
</tr>
<tr>
<td><font color="red">Info vedle gifu</font> </td>
<td><textarea name="info" rows=4 cols=60></textarea></td>
</tr>
<tr>
<td><font color="red">Článek</font> </td>
<td><textarea name="clanek" rows=4 cols=60></textarea></td>
</tr>
<tr>
<td><font color="red">Sestava</font> </td>
<td><textarea name="sestava" rows=4 cols=60></textarea></td>
</tr>


<tr>
<td><input type="submit"> </td>
</tr>


</form>
</body>
</html>
<?php
}
else
{


$date_added = $_POST["date_added"];
$nadpis = $_POST["nadpis"];
$info = $_POST["info"];
$clanek = $_POST["clanek"];
$sestava = $_POST["sestava"];



if (!($connection = @ mysql_connect($hostName,
$username,
$password)))
die("nemohu se pripojit k databazi");

if (!mysql_select_db($databaseName, $connection))
showerror();



// Was an image file uploaded?
if (is_uploaded_file($_FILES["gif"]["tmp_name"]))
{
// Open the uploaded file
$file = fopen($_FILES["gif"]["tmp_name"], "r");

// Read in the uploaded file
$gif =
fread($file, $_FILES["gif"]["size"]);

// Escape special charcters in the file
$fileContents = AddSlashes($fileContents);
}
else
$fileContents = NULL;



$insertQuery = "INSERT INTO clanek VALUES (NULL, " .
""" . $date_added . "", " .
""" . $nadpis . "", " .
""" . $fileContents . "")" .
""" . $info . "", " .
""" . $clanek . "", " .
""" . $sestava . "")";

if ((@ mysql_query ($insertQuery,
$connection))
&& @ mysql_affected_rows() == 1)
header("Location: potvrd.php?" .
"clanek=". mysql_insert_id($connection) .
"&status=T");
else
header("Location: potvrd.php?" .
"status=F");
}
?>
Cup
Profil
dole u toho sql prikazu maj bejt zpetny lomitka ale ty to nevypsalo, jiste to chapete :)
djlj
Profil
ale jaksy mi to nefunguje .. kdo je znaly tak tu chybu uvidi hned
Nikdo ti to nebude detailně prohlížet, prostě sem napiš, co ti nefunguje.
Cup
Profil
jo sory, .... vubec to nereaguje, nepridava do databaze
djlj
Profil
A co ti vypisuje mysql_error?
Cup
Profil
nic, vrati to praznej formular ... zadny chybovy hlasky
djlj
Profil
Cup
echo mysql_error();
Cup
Profil
aha ale to si mi moc nepomohl .... kam to mam napsat nebo co s tim ... :(
djlj
Profil
Za ten SQL dotaz.
tiso
Profil
vyhoď empty($_POST["gif"]) v podmienke...
Toto téma je uzamčeno. Odpověď nelze zaslat.