Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Błąd w dodawaniu redorku do bazy
sigal2006
post
Post #1





Grupa: Zarejestrowani
Postów: 71
Pomógł: 0
Dołączył: 17.02.2010

Ostrzeżenie: (10%)
X----


Mam taki kod


if($_GET['actie'] == "verzenden")
{

if(empty($_POST['titel']))
{
echo "Brak tytulu";
}
elseif(empty($_POST['link']))
{
echo "Brak linku";
}
elseif(empty($_POST['image']))
{
echo "Brak foto";
}
elseif(empty($_POST['cat']))
{
echo "Brak kategori";
}
elseif(empty($_POST['beschrijving']))
{
echo "Brak opisu";
}
else
{
$titel = mysql_real_escape_string($_POST['titel']);
$link = mysql_real_escape_string($_POST['link']);
$img = mysql_real_escape_string($_POST['img']);
$cat = mysql_real_escape_string($_POST['cat']);
$beschrijving = mysql_real_escape_string($_POST['beschrijving']);

$sql = "
INSERT INTO
radio
(
titel,
link,
img,
cat,
beschrijving
)
VALUES
(
'".$titel."',
'".$link."',
'".$img."',
'".$cat."',
'".$bescrijving."'
)
";
$query = mysql_query($sql) or die(mysql_error());

echo "Kanal zostal dodany";
}
}

a formularze wygladaja tak




Dodaj foto <a onClick="java script:window.open('upload.php', '_blank','width=600,height=250,top=150,left=790'); return false;" href="#">Kliknij tutaj.</a>
<br />
<br />
<form action="toevoegen.php?actie=verzenden" method="post">
<table width="100%">
<tr>
<td>Kategoria:</td>
<td>
tutaj działa
</td>
</tr>
<tr>
<td>Tytul: </td>
<td><input type="text" name="titel" maxlength="25" value=""> </td>
</tr>
<tr>
<td>Link: </td>
<td><input type="text" name="link" maxlength="75" value="http://"> </td>
</tr>
<tr>
<td>Foto: </td>
<td><input type="text" name="img" maxlength="75" value=""> </td>
</tr>
<tr>
<td>Opis: </td>
<td><textarea name="beschrijving" cols="30" rows="5"></textarea>
<br />
<input type="submit" NAME="verzenden" value="Dodaj"> </td>
</tr>
</table>
</form>

i nie wiem czemu zero odezwy z strony bazy mysql (IMG:style_emoticons/default/questionmark.gif) co robię nie tak ?

Ten post edytował sigal2006 23.02.2011, 12:09:13
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
sniver
post
Post #2





Grupa: Zarejestrowani
Postów: 159
Pomógł: 5
Dołączył: 31.08.2007

Ostrzeżenie: (0%)
-----


po 1 to sobie może dodaj na początek mysql_connect() i po 2 wygenerowane zapytanie przekopiuj i wklej do np. phpmyadmin i zobacz czy jest ok.

warto też zamieścić mysql_escape_string bo sie może zapytanie sypać jak wystąpią apostrofy w ciągach znaków
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 20:01