• 20-03-2013, 18:07:03
    #1
    Arkadaşlar saatlerdir googleyi talan ettim bu sorunu bir türlü çözemiyorum yardım edin

    Hata:

    Bir Sorun Oluştu!
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1'' at line 1


    Kodlar

    <html>
    <head>
    	<title>test</title>
    	<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
    </head>
    <body>
    <?php
    
    include("ayar.php");
    
    $id = @$_GET["id"];
    
    if ($_POST){
    
    	$adsoyad = $_POST["adsoyad"];
    	$eposta = $_POST["eposta"];
    	$mesaj = $_POST["mesaj"];
    	$onay = $_POST["onay"];
    	
    	$guncelle = mysql_query("UPDATE mesajlar SET yazan='$adsoyad', eposta='$eposta', mesaj='$mesaj', onay='$onay' WHERE id '$id'");
    	if ($guncelle){
    		echo '<font color="green">Başarıyla Güncellendi!</font>';
    	
    	}else {
    		echo '<font color="red">Bir Sorun Oluştu!<br />'.mysql_error().'</font>';
    	}
    	
    	
    }else {
    
    	$bul = mysql_query("select * from mesajlar where id='$id'");
    	$goster = mysql_fetch_array($bul);
    	extract($goster);
    	echo '<h1>Mesaj Güncelle</h1>
    	<form action="" method="post">
    	<table cellpadding="5" cellspacing="5">
    		<tr>
    			<td>Ad Soyad:</td>
    			<td><input type="text" name="adsoyad" value="'.$yazan.'"></td>
    		</tr>
    		<tr>
    			<td>E Posta:</td>
    			<td><input type="text" name="eposta" value="'.$eposta.'"></td>
    		</tr>
    		<tr>
    			<td>Mesaj:</td>
    			<td><textarea rows="5" cols="30" name="mesaj">'.$mesaj.'</textarea></td>
    		</tr>
    		<tr>
    			<td>Onaylı mı?</td>
    			<td><select name="onay">
    			<option value="1"';
    			if ($onay == 1){echo ' selected';}
    			echo '>Evet</option>
    			<option value="0"';
    			if ($onay == 0){echo ' selected';}
    			echo '>Hayır</option>
    			</select></td>
    		</tr>
    		<tr>
    			<td>Güncelle:</td>
    			<td><input type="submit" value="Guncelle" /></td>
    		</tr>
    	</table>
    	</form>';
    
    }
    
    ?>
    </body>
    </html>
  • 20-03-2013, 18:09:36
    #2
    WHERE id='$id'
    olmalı hocam
  • 20-03-2013, 18:09:44
    #3
    hocam sql sorgusunda su var
    WHERE id '$id'"
    bunu
    WHERE id = '$id'"
    yap bakalm
  • 20-03-2013, 18:17:06
    #4
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Konuyu ikinci defa açmışsınız.

    Arkadaşların dediği gibi düzenlerseniz sorun ortadan kalkar.