2013-01-09 94 views
0

這是我的功能代碼,獲得和功能

function icerikduzenle($a,$b,$c) 
{ 
global $veriyolu; 
$menuid=$c; 
$icerik=$b; 
$icerik_id=$a; 
$guncelle=mysql_query("update icerik set icerik='$icerik' , menu_id='$menu_id' where icerik_id='$icerik_id'",$veriyolu); 

if($guncelle){ 
      echo "<script>alert(' İçerik düzenlendi! ')</script>"; 
      echo "<meta http-equiv='Refresh' content='0; URL=yonetim.php?menu=2'>"; 
      }else{ 
      echo "<script>alert(' !! İçerik düzenlenemedi !! ')</script>"; 
      echo "<meta http-equiv='Refresh' content='0; URL=yonetim.php?menu=2'>";    
      } 
} 

我覺得我有問題_POST瓦爾。清單DATAS沒有錯誤,但沒有更新DATAS

這是主代碼 我不喜歡的連接表中的mysql我用了2 sql語句 我想POST變量不要去任何地方

$iceriksql="select * from icerik order by menu_id asc"; 
$iceriksorgu= mysql_query($iceriksql); 
echo "<table>"; 
while($iceriksonuc=mysql_fetch_array($iceriksorgu)) 
{ 
echo "<form method='post' action='yonetim.php?menu=2&icerikid={$iceriksonuc["icerik_id"]}&git=icerikduzenle'>"; 
$menusql= "select * from menu order by menu_id asc"; 
$menusorgu = mysql_query($menusql); 
echo "<tr><td><select name='menu_id'>"; 
    while ($menusonuc=mysql_fetch_array($menusorgu)) 
    { 
    if ($menusonuc['menu_id']==$iceriksonuc['menu_id']) 
    { 
    echo "<option value='{$menusonuc["menu_id"]}' selected>{$menusonuc["menu"]}</option>"; 
    } 
    else 
    { 
    echo "<option value='{$menusonuc["menu_id"]}'>{$menusonuc["menu"]}</option>"; 
    } 
    } 
echo "</select></td>"; 
echo "<td><textarea name='icerik'>{$iceriksonuc["icerik"]}</textarea></td><td><input type='submit' name='submit' value='Düzenle' /></td></tr>"; 
echo "</form>"; 
} 
echo "</table>"; 

這是最後一部分我的代碼

switch ($_GET['git']){ 
case "icerikduzenle"; 
icerikduzenle($_REQUEST['icerik_id'],$_REQUEST['icerik'],$_REQUEST['menu_id']); 
break; 
} 
+0

你能在這裏回顯查詢嗎? – Sahal

+0

這種情況是錯誤的... – jpganz18

+0

變量'$ veriyolu'是你的資源標識符,它對於那個函數是全局的嗎? – Sahal

回答

0
case "icerikduzenle"; 

必須

case "icerikduzenle": 
0

試試這個。大小寫必須是冒號(:)

switch ($_GET['git']){ 
    case "icerikduzenle" : 
       icerikduzenle($_REQUEST['icerik_id'],$_REQUEST['icerik'],$_REQUEST['menu_id']); 
       break; 
}