• 04-04-2010, 18:26:07
    #1
    arkadaşlar php kitapdan öğrenen biriyim. özellikle bu kaddaki hatamı bulmam gerekiyr.
    mysql23.php de sql listesini çağırıyourm ve değiştir linkine tıklandığında ekteki hata veriyor. yardımınız için teşekkürler


    hata kodu:
    Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in E:\EasyPHP 2.0b1\www\kitap\mysql23.php on line 4

    mysql23.php
    <h2>Değiştirme Formu</h2>
    <form action="./kitap/mysql24.php" method="post">
    <?php
    echo '<INPUT type=hidden name=sira VALUE=\"$_GET['sira']\"><br>';
    
    
    echo "Öğrenci Numarası:<br>";
    echo "<INPUT type="text" name="no" VALUE=\"($_GET['no'])\"><br>";
    
    echo "Öğrencinin Adı Soyadı:<br>";
    echo "<INPUT type="text" name =ad VALUE=\"$_GET['ad']\"><br>";
    
    echo "Öğrencinin 1.yazılısı:<br>";
    echo "<INPUT type="text" name =not1 VALUE=\"$_GET['not1']\"><br>";
    
    echo "Öğrencinin 2.yazılısı:<br>";
    echo "<INPUT type="text" name =not2 VALUE=\"$_GET['not2']\"><br>";
    
    ?>
        <input type="submit" value="değiştir">
    
    </form>
    mysql22.php
    <?php
    $host="localhost";
    $vt_adi="kitap";
    $kullanici="root";
    $sifre="";
    
    $db=@mysql_connect($host,$kullanici,$sifre);
    if (!$db){echo "mySQL kapalı veya hesap bilgileri kapalı";exit;}
    
    $test=@mysql_select_db($vt_adi,$db);
    if (!$test){echo "VERİ TABANI ADI YANLIŞ"; exit;}
    
    $sorgu=mysql_query("SELECT * FROM ilktablo");
    $kayit= mysql_num_rows($sorgu);
    	echo "$kayit bulunmaktadır.<BR>"; 
    while ($veri=mysql_fetch_row ($sorgu)){
    echo "$veri[0],$veri[1],$veri[2],$veri[3],$veri[4]";
    echo "<A href='./mysql23.php?sira=$veri[0]&no=$veri[1]&ad=$veri[2]&not1=$veri[3]&not2=$veri[4]'>[Değiştir]</a>";
    echo "<BR>";
    }
    ?>
  • 04-04-2010, 18:30:22
    #2
    Üyeliği durduruldu
    <h2>Değiştirme Formu</h2>
    <form action="./kitap/mysql24.php" method="post">
    <?php
    echo '<INPUT type=hidden name=sira VALUE="'.$_GET['sira'].'"><br>';
    
    
    echo 'Öğrenci Numarası:<br>';
    echo '<INPUT type="text" name="no" VALUE="'.($_GET['no']).'"><br>';
    
    echo 'Öğrencinin Adı Soyadı:<br>';
    echo '<INPUT type="text" name =ad VALUE="'.$_GET['ad'].'"><br>';
    
    echo 'Öğrencinin 1.yazılısı:<br>';
    echo '<INPUT type="text" name =not1 VALUE="'.$_GET['not1'].'"><br>';
    
    echo 'Öğrencinin 2.yazılısı:<br>';
    echo '<INPUT type="text" name =not2 VALUE="'.$_GET['not2'].'"><br>';
    
    ?>
        <input type="submit" value="değiştir">
    
    </form>
  • 04-04-2010, 19:18:38
    #3
    teşkkür ederim
  • 04-04-2010, 19:35:05
    #4
    hocam ekteki mysql_query satırında sanırım yazımhatası var bakarmısın

    tablo kayıt yapılamadı. hata var.hata no:1064hatanın açıklamasıs.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 '' at line 1


    Alıntı
    <?php
    $host="localhost";
    $vt_adi="kitap";
    $kullanici="root";
    $sifre="";
    $no=$_POST['no'];
    $ad=$_POST['ad'];
    $not1=$_POST['not1'];
    $not2=$_POST['not2'];
    if (!$no&&!$ad&&!$not1&&!$not2){echo "<h1>lütfen formu doldurunuz</h1>"; exit;}

    $db=@mysql_connect($host,$kullanici,$sifre);
    if (!$db){echo "mySQL kapalı veya hesap bilgileri kapalı";exit;}

    $test=@mysql_select_db($vt_adi,$db); if (!$test){echo "VERİ TABANI ADI YANLIŞ"; exit;}

    $sorgu=@mysql_query("UPDATE ilktablo SET no=$no, adsoyad='$ad', yazili1=$not1, yazili2=$not2 WHERE sira=$sira", $db);

    if($sorgu){
    echo "tabloya kayıt degişitirlid";
    echo "degişitililenler:$no $ad $not1 $not2 ";
    } else {
    echo "tablo kayıt yapılamadı. hata var.";
    echo "hata no:".mysql_errno();
    echo "hatanın açıklamasıs.".mysql_error();
    }
    ?>
  • 04-04-2010, 19:41:28
    #5
    justgo hocam çözdüm, degiskenleri tek tırnak içine alarak.

    eyvallah
  • 04-04-2010, 19:41:58
    #6
    Üyeliği durduruldu
    Yalnız $sira boş hani buna değer nerden geliyor?
    <?php
    $host="localhost";
    $vt_adi="kitap";
    $kullanici="root";
    $sifre="";
    $no=$_POST['no'];
    $ad=$_POST['ad'];
    $not1=$_POST['not1'];
    $not2=$_POST['not2'];
    if (empty($no) and empty($ad) and empty($not1) and empty($not2)){ echo '<h1>lütfen formu doldurunuz</h1>'; exit;}
    
    $db=@mysql_connect($host,$kullanici,$sifre);
    if (!$db){ die('mysql bağlantısı yapılamadı'); }
    
    $test=@mysql_select_db($vt_adi,$db); if (!$test) { die('Veritabanı seçilemedi'); }
    
    $sorgu=@mysql_query("UPDATE ilktablo SET no=$no, adsoyad=$ad, yazili1=$not1, yazili2=$not2 WHERE sira='".$sira."'");
    
    if($sorgu){
    echo "tabloya kayıt degişitirlid";
    echo "degişitililenler:$no $ad $not1 $not2 ";
    } else {
    echo "tablo kayıt yapılamadı. hata var.";
    echo "hata no:".mysql_errno();
    echo "hatanın açıklamasıs.".mysql_error();
    }
    ?>
  • 05-04-2010, 01:53:29
    #7
    evet hocam orda $sira boş hata veriyor çalışınca
  • 05-04-2010, 01:55:24
    #8
    Üyeliği durduruldu
    Doldur işte $sira boş olunca hata vermemesi lazım mysql de ne kadar veri varsa hepsini son girdiğin veriler ile günceller.
  • 05-04-2010, 02:06:06
    #9
    hocam bu sayfadanın 41. satırında hataya bakarmısın "
    Warning: Unexpected character in input: '\' (ASCII=92) state=1 in E:\EasyPHP 2.0b1\www\kitap\mysql28.php on line 40

    Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in E:\EasyPHP 2.0b1\www\kitap\mysql28.php on line 41"


    <?php
    
    $host="localhost"; $vt_adi="kitap"; $kullanici="root"; $sifre="";
    
    $hareket=$_GET['hareket'];
    $hareket2=$_POST['hareket'];
    $sira=$_GET['sira'];
    $db = mysql_select($server, $kullaniciadi, $sifre)or die("sunucu kapalı veya hesap bilgileri yanlış");
    $test=@mysql_select_db($vt_adi, $db)or die("veritabnı adı yanlış");
    if ($hareket=='guncelle' or $hareket2=='ekle'){
    	if ($hareket == 'ekle'){ 
    	include("./form3.php"); 
    	print "<input type = hidden name=ekle1 value=1>\n";
    	}else{
    		$sorgu= mysql_query("SELECT * FROM ilktablo WHERE (sira=$sira)",$db);
    		$sonuc=mysql_fetch_array($sorgu);
    		include("./form3.php");
    		print "<input type = hidden name=guncelle1 value=1>\n"; 
    		}
    	print "</table><input type=submit value=KAYDET></form>\n";
    	exit;
    	}
    	
    if ($hareket==sil){
    		$q="DELETE FROM ilktablo WHERE (sira=$sira)";
    		$sorgu=mysql_query($q);
    		print"<meta http-equiv='refresh' content=\"0; URL=$PHP_SELF\">";
    		}elseif($guncelle1){
    		$q="UPDATE  ilktablo SET sira='$sira' no='$no' adsoyad='$adsoyad' yazili1='$yazili1' yazili2='$yazili2' WHERE (sira=$sira)";
    		$sorgu=mysql_query($q);
    		print"<meta http-equiv='refresh' content=\"0; URL=$PHP_SELF\">";	
    		}
    print "<TABLE border=1><tr><td>sıra</td> <td>no</td> <td>adsoyad</td><td>yazılı1</td><td>yazılı2</td> <td></td>  <td></td> <tr>\n";
    $sorgu=mysql_query("SELECT*FROM ilktablo",$db);
    while ($s=mysql_fetch_row($sorgu)){
    echo"<TR><td>".$s[0]."</td> <td>.$s[1].</td> <td>.$s[2].</td> <td>.$s[3].</td> <td>.$s[4].</td><td>\n";
    echo "<a href=\"$PHP_SELF?hareket=guncelle&sira=".$s[0]."\">Guncelle</a></td></td>";
    echo "<a href=\"$PHP_SELF?hareket=sil&sira=".$s[0]."\">sil</a></td></tr>\n";
    }		
    print "</table><form action=\" $PHP_SELF \" method=POST">\n";
    print "<input type=\"hidden"\ name=\"hareket"\ value=\"ekle\">\n";
    
    print "<INPUT type=submit value=\"EKLE\"></form>";
    mysql_close($db);
    
    
    ?>