• 18-12-2010, 16:41:12
    #19
    Eposta Aktivasyonu Gerekmekte
    En Sonunda Oldu

    Db latin1_swedish_ci
    Sayfa Türkçe Windows(iso-8859-9)


    Arama yapan sayfa
    <?php	include("ayar.php");?>
    <?php
    $ara = $_POST['veri'];
    $secim = $_POST['select'];
    
    if($secim == "no") { 
        $anahtar = "OgrNo"; 
    }elseif($secim == "sinif"){
        $anahtar = "SinifNo";
    }elseif($secim == "adi"){
        $anahtar = "Ad";
    }elseif($secim == "soyadi"){
        $anahtar = "Soyad";
    }
    
    
    $sorgu = mysql_query("select * from deneme2 WHERE ".$anahtar." LIKE '%".$ara."%'");
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
    <title>Telefon Rehberi</title>
    <style type="text/css">
    <!--
    .style1 {font-weight: bold}
    .style2 {font-weight: bold}
    -->
    </style>
    </head>
    
    <body>
    <form id="form1" name="form1" method="post" action="#">
      <table width="1278" border="0">
        <tr>
          <th width="346" scope="col"><div align="left">
            <input type="text" name="veri" />
            <select name="select">
              <option value="adi" selected="selected">Adı</option>
              <option value="soyadi">Soyadı</option>
              <option value="sinif">Sınıf</option>
              <option value="no">No</option>
            </select>
            <input type="submit" name="Submit" value="Ara" />
          </div></th>
          <th width="922" scope="col"></th>
        </tr>
      </table>
    </form>
    
    
    <table width="1275" border="1">
      <tr>
        <th width="43" bgcolor="#999999" scope="col"> No </th>
        <th width="54" bgcolor="#999999" scope="col">Sınıf  </th>
        <th width="157" bgcolor="#999999" scope="col"> Adı </th>
        <th width="155" bgcolor="#999999" scope="col">Soyadı</th>
        <th width="139" bgcolor="#999999" scope="col">Telefon No </th>
        <th width="153" bgcolor="#999999" scope="col">Mobil No </th>
        <th width="151" bgcolor="#999999" scope="col">Anne Mobil </th>
        <th width="114" bgcolor="#999999" scope="col">Anne Adı </th>
        <th width="105" bgcolor="#999999" scope="col">Baba Mobil </th>
        <th width="140" bgcolor="#999999" scope="col">Baba Adı </th>
      </tr>
    <?php 
    
    while($veri = mysql_fetch_assoc($sorgu)){?>
      <tr>
        <th height="2" bgcolor="#CCCCCC" scope="row"><?php echo $veri[OgrNo]; ?></th>
        <td bgcolor="#CCCCCC"><?php echo $veri[SinifNo]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Ad]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Soyad]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Tel]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Mobil]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[AnneMobil]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[AnneAd]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[BabaMobil]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[BabaAd]; ?></td>
      </tr>
      <?php } ?>
    </table>
    </body>
    
    </html>
    ayar.php
    <?
    mysql_connect("localhost","xxxxxxx","xxxxxxxxx") or die(mysql_error());
    mysql_select_db("xxxxxxx") or die (mysql_error());
    
    
    function l_link($deger) {
    	$bozuk=array("Ö","ö","Ç","ç","Ð","ð","Ü","ü","Ý","ý",",",".",";",":","!","\"","'","^","+","-","_"," ","/","(",")","Þ","þ","?");
    	$duzgun=array("o","o","c","c","g","g","u","u","i","i","","","","","","","","","-","-","-","-","","","","s","s","");
    	$deger=str_replace($bozuk,$duzgun,$deger);
    	$deger=strip_tags($deger);
    	$deger=strtolower($deger);
    	$deger=trim($deger);
    	return $deger;
    }
    function koruma($deger) {
    	$deger=trim($deger);
    	$deger=strip_tags($deger);
    	$deger=mysql_escape_string($deger);
    	return $deger;
    }
    ?>

    Şimdi yen birşey eklemek istiyorum. öğrenci resmi veri tabanında image tipinde resim bilgisi var fakat ben bunu sql2005 den nasıl cıkaracağımı bilemiyorum
  • 18-12-2010, 18:37:54
    #20
    Eposta Aktivasyonu Gerekmekte
    Sayfaya güvenlik için şu şekilde bi giriş koydum çalışıyor fakat sürekli hata veriyor

    error_log
    [18-Dec-2010 18:32:14] PHP Warning:  mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/xxxxx/public_html/rehber/index.php on line 145
    index.php içeriği

    <?php
    $ourLogin = "altan";
    $ourPassword = "101010";
    
    session_start();
    
    if ($_SESSION['login']!=$ourLogin && $_SESSION['password']!=$ourPassword) {
    
    
    if ($_POST['login']==$ourLogin && $_POST['password']==$ourPassword) {
    
    
    $_SESSION['login'] = $_POST['login'];
    $_SESSION['password'] = $_POST['password'];
    header("Location: index.php");
    
    
    }
    else {
    
    
    echo "
    <form action=index.php method=post>
    
    
    Login:<br>
    <input type=text name=login value=''><br>
    
    Password:<br>
    <input type=password name=password value=''><br>
    
    <input type=submit value=Giriş >
    
    
    </form>
    ";
    
    exit;
    
    }
    
    }
    ?>	<?php include("ayar.php");?>
    <?php
    $ara = $_POST['veri'];
    $secim = $_POST['select'];
    
    if($secim == "no") { 
        $anahtar = "OgrNo"; 
    }elseif($secim == "sinif"){
        $anahtar = "SinifNo";
    }elseif($secim == "adi"){
        $anahtar = "Ad";
    }elseif($secim == "soyadi"){
        $anahtar = "Soyad";
    }
    
    
    $sorgu = mysql_query("select * from deneme2 WHERE ".$anahtar." LIKE '%".$ara."%'");
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
    <title>Telefon Rehberi</title>
    <style type="text/css">
    <!--
    .style1 {font-weight: bold}
    .style2 {font-weight: bold}
    body {
    	background-image: url(arka2.png);
    }
    a:link {
    	color: #FFFFFF;
    	text-decoration: none;
    }
    a:visited {
    	text-decoration: none;
    	color: #FFFFFF;
    }
    a:hover {
    	text-decoration: none;
    	color: #FFFFFF;
    }
    a:active {
    	text-decoration: none;
    	color: #FFFFFF;
    }
    -->
    </style>
    </head>
    
    <body><table align="center">
    <form id="form1" name="form1" method="post" action="#">
      <table width="1278" border="0" align="center">
        <tr align="center">
          <th width="346" scope="col"><div align="center">
    
            <div align="right">
              <input type="text" name="veri" />
              <select name="select">
                <option value="adi" selected="selected">Adı</option>
                <option value="soyadi">Soyadı</option>
                <option value="sinif">Sınıf</option>
                <option value="no">No</option>
              </select>
              <input type="submit" name="Submit" value="Ara" />
              </div>
        </form><?php
    $get = $_GET["id"];
    ?><a href="javascript:print('sayfa.php?id<?= $get; ?>' )">Yazdır</a>
          </th>
          <th width="922" scope="col"></th>
        </tr>
      </table>
    
    
    
    <table width="1070" border="1" align="center">
      <tr>
        <th width="44" bgcolor="#CCCCCC" scope="col"> No </th>
        <th width="47" bgcolor="#CCCCCC" scope="col">Sınıf  </th>
        <th width="143" bgcolor="#CCCCCC" scope="col"> Adı </th>
        <th width="95" bgcolor="#CCCCCC" scope="col">Soyadı</th>
        <th width="120" bgcolor="#CCCCCC" scope="col">Telefon No </th>
        <th width="120" bgcolor="#CCCCCC" scope="col">Mobil No </th>
        <th width="119" bgcolor="#CCCCCC" scope="col">Anne Mobil </th>
        <th width="91" bgcolor="#CCCCCC" scope="col">Anne Adı </th>
        <th width="120" bgcolor="#CCCCCC" scope="col">Baba Mobil </th>
        <th width="107" bgcolor="#CCCCCC" scope="col">Baba Adı </th>
      </tr>
    <?php 
    
    while($veri = mysql_fetch_assoc($sorgu)){?>
      <tr>
        <th height="2" bgcolor="#FFFFFF" scope="row"><?php echo $veri[OgrNo]; ?></th>
        <td bgcolor="#FFFFFF"><?php echo $veri[SinifNo]; ?></td>
        <td bgcolor="#FFFFFF"><?php echo $veri[Ad]; ?></td>
        <td bgcolor="#FFFFFF"><?php echo $veri[Soyad]; ?></td>
        <td bgcolor="#FFFFFF"><?php echo $veri[Tel]; ?></td>
        <td bgcolor="#FFFFFF"><?php echo $veri[Mobil]; ?></td>
        <td bgcolor="#FFFFFF"><?php echo $veri[AnneMobil]; ?></td>
        <td bgcolor="#FFFFFF"><?php echo $veri[AnneAd]; ?></td>
        <td bgcolor="#FFFFFF"><?php echo $veri[BabaMobil]; ?></td>
        <td bgcolor="#FFFFFF"><?php echo $veri[BabaAd]; ?></td>
      </tr>
      <?php } ?>
    </table>
    </body>
    
    </html>

    hata olduğunu bildirilen satır
    while($veri = mysql_fetch_assoc($sorgu)){?>
  • 19-12-2010, 00:12:51
    #21
    Üyeliği durduruldu
    genelde o hatayı sql sorgunda hata varsa yapar ama mysql_query() or die(mysql_error()); olarak değiştirip denesene hata alıcak mısın
  • 19-12-2010, 00:25:09
    #22
    Eposta Aktivasyonu Gerekmekte
    $anahtar'ı if içerisinde tanımlamışsın dışarıdan almaya çalışıyorsun.

    $anahtar = "";
    if($secim == "no") { 
        $anahtar = "OgrNo"; 
    }elseif($secim == "sinif"){
        $anahtar = "SinifNo";
    }elseif($secim == "adi"){
        $anahtar = "Ad";
    }elseif($secim == "soyadi"){
        $anahtar = "Soyad";
    }
    olarak dene.

    Kodları çok karışık yazmışsın biraz düzenlemen senin faydana.
  • 19-12-2010, 12:06:39
    #23
    Eposta Aktivasyonu Gerekmekte
    adamlar şu adresde aynı sorunu yaşamış ve sql sorgularını düzenliyerek sonuc elde etmişler


    NiZZo_ adlı üyeden alıntı: mesajı görüntüle
    $anahtar'ı if içerisinde tanımlamışsın dışarıdan almaya çalışıyorsun.

    $anahtar = "";
    if($secim == "no") { 
        $anahtar = "OgrNo"; 
    }elseif($secim == "sinif"){
        $anahtar = "SinifNo";
    }elseif($secim == "adi"){
        $anahtar = "Ad";
    }elseif($secim == "soyadi"){
        $anahtar = "Soyad";
    }
    olarak dene.

    Kodları çok karışık yazmışsın biraz düzenlemen senin faydana.
    bunu denedim değişen bişey olmadı.

    yanlız dikaktimi çeken birşey var sadece giriş yaparken hata veriyor.
    yanlış bilgiler ile giriş yapmaya calıştığımda hata vermiyor

    MrHades dediğini tam anlayamadım
  • 19-12-2010, 16:15:38
    #24
    Eposta Aktivasyonu Gerekmekte
    arkadaşlar sorunu araştırken buldum. hatanın sebepi sistem ilk acıldığında arama yapmış gibi calışıyor ve bi sonuc bulamayınca hata veriyor. küçük bi ekleme ile hatasız hale geliyor. aslında sistemi butonu tıkladık sonra çalışmaya başlasa hiç sorun olmuyacak ama biz ona hata raporu ile bi çıkış verdik


    if ($sorgu) {
    $veri = mysql_fetch_assoc($sorgu) ?>
      <tr>
        <th height="2" bgcolor="#CCCCCC" scope="row"><?php echo $veri[OgrNo]; ?></th>
        <td bgcolor="#CCCCCC"><?php echo $veri[SinifNo]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Ad]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Soyad]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Tel]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Mobil]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[AnneMobil]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[AnneAd]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[BabaMobil]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[BabaAd]; ?></td>
      </tr>
      <?php  }
      else{
      echo("hangi alanda arama yapacaksanız seciniz Ad ,Soyad.... ");}?>
  • 19-12-2010, 16:44:59
    #25
    Eposta Aktivasyonu Gerekmekte
    Butona tıklanıp tıklanmadığını kontrol edeceksin o zaman

    if(isset($_POST['button']))
    {
      //butona tıklanmış arama yapılsın
    }
    else
    {
       //Arama formu gösterilecek
    }
  • 19-12-2010, 18:05:26
    #26
    Eposta Aktivasyonu Gerekmekte
    if ($sorgu) {
    $veri = mysql_fetch_assoc($sorgu) ?>
      <tr>
        <th height="2" bgcolor="#CCCCCC" scope="row"><?php echo $veri[OgrNo]; ?></th>
        <td bgcolor="#CCCCCC"><?php echo $veri[SinifNo]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Ad]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Soyad]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Tel]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Mobil]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[AnneMobil]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[AnneAd]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[BabaMobil]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[BabaAd]; ?></td>
      </tr>
      <?php  }
      else{
      echo("hangi alanda arama yapacaksanız seciniz Ad ,Soyad.... ");}?>

    bu geçici bi çözümmüş yeni yöntem
    while ($veri = mysql_fetch_assoc($sorgu)) {?>
      <tr>
        <th height="2" bgcolor="#CCCCCC" scope="row"><?php echo $veri[OgrNo]; ?></th>
        <td bgcolor="#CCCCCC"><?php echo $veri[SinifNo]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Ad]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Soyad]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Tel]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[Mobil]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[AnneMobil]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[AnneAd]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[BabaMobil]; ?></td>
        <td bgcolor="#CCCCCC"><?php echo $veri[BabaAd]; ?></td>
      </tr>
     <?php } mysql_close(); ?>
    %100 kesin çözüm