Zoque.Forum
Dirsek Teması:
Geri Dön Zoque.Forum » Webmaster Kaynaklari » Sunucu Tabanlı Programlama (Server Side) » PHP » php + mysql'de bir sorunum var


Yanıt
 
LinkBack Seçenekler
Old 01.10.2003   #1 (permalink)
 
Firan Zal'honan's Avatar
 
Üyelik Tarihi: 06.06.2001
Yer: istanbul
Yaş: 31
Mesaj: 697
php + mysql'de bir sorunum var


Merhaba arkadaşlar

next ve previous sorunu olarak daha önce önünüze gelen sorunumu sonunda dün akşam aşmış bulunmaktayım fakat şimdi farklı bir sorun ile karşı karşıyayım... aşağıdaki imajlar ile elimden geldiğince sorunumu anlatmaya çalışayım

http://www.designsofme.com/hayalmahs...si/urunler.jpg

adresinde görüleceği üzere 5 hane ürün bilgim var.. ürünler benim belirlediğim en sağdaki siraid ile sıralanıyorlar... buraya kadar tamam

http://www.designsofme.com/hayalmahs...fisi/detay.jpg

burada görüleceği üzere de bir ürünün detayı 2-3 hane ile dolduruluyor...

http://www.designsofme.com/hayalmahs...fisi/sayfa.jpg

fakat asıl sorun burada... ürünün id'sine bağlı olarak ürün özellikleri gelmesi gerekirken, bilgi bulunamadığı zaman çıkması gereken "there is no data" ibaresini alıyorum...

kod'um aşağıdaki şekilde düzenlenmiştir.. :

PHP Code:
<table width="329" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="329" height="90" align="right" valign="top"> 
       <table width="143" height="30" border="0" cellpadding="0" cellspacing="0" bgcolor="#FF0000">
         <tr> 
            <td align="center" valign="middle" class="tepebaslik">
               <?PHP
               
if(strlen($sh)<1){
                  
// sh means SECTION HEADERorder

                  
echo "Mainpage";
           }
           else {
                  echo 
$sh;
               }
               
?>
            </td>
         </tr>
       </table>
    </td>
  </tr>
  <tr> 
    <td align="center" valign="top" class="maintext"> 
      <?PHP
        
if($cid=='cat'){
        
// cid means CONTENT ID
                
echo '<table width="329" border="0" cellspacing="0" cellpadding="0">';
        
mysql_connect("localhost""root""root") or die("dbase Conneciton Failed!");
        
mysql_select_db("bishop");

                if(
strlen($next)<1){
                    
$next=0;
                }

        
$query="SELECT * FROM items where cat_id=".$cat_id." order by siraid";
        
$result mysql_query($query);    
        
$count=0;
                
$count2=0;
                
// bir sayfada kac item listelenecegini page_limit belirliyor
                
$page_limit=12;
        while (
$row mysql_fetch_array($result)) {
                        
//if($count2==0){
   
                        //}
                        
if($next<=$row[5]){
                           if(
$count==$page_limit){
                               
$next_link="<a href='index.PHP?sh=".$sh."&cid=cat&cat_id=".$cat_id."&next=".$row[5]."' class='duzyazilink'>Next &raquo;</a>";
                               break;
                           }
                           if((
$count%3)==0){
                              echo 
'<tr align="center" valign="top">'
                           }
               echo 
'<td width="105" align="center" valign="top" class="uruntext"><a href="index.PHP?sh='.$sh.'&cid=item&item_id='.$row[5].'&cat_id='.$cat_id.'" class="urunlink"><img src="'.$row[3].'" border="0"><br><img src="i/trans.gif" border="0" height="5" width="50"><br>'.$row[1].'</a><br><br>';
                           if((
$count%3)==0){
                              echo 
'</tr>'
                           }
                           
$count++;
                        }
                            if((
$count2%$page_limit)==0){
                               if(
$row[5]<$next)
                                  
$prev=$row[5];
                            }
                            if(isset(
$prev)){
                            
$prev_link="<a href='index.PHP?sh=".$sh."&cid=cat&cat_id=".$cat_id."&next=".$prev."' class='duzyazilink'>&laquo; Previous</a>";
                            }

            
$count2++;

        }

        if(
$count==0){
            echo 
"There is no data...";
        }
        
mysql_free_result($result);
        
mysql_close();        
    echo 
"<tr><td align='left' colspan='3'><table width='100%' cellspacing='0' cellpadding='0'><tr>";    
if(
strlen($prev)>0){
           echo 
"<td align='left' width='50%'>".$prev_link."</td>";
        }
        echo 
"<td align='right' width='50%'>".$next_link."</td>";
echo 
"</tr></table></td></tr>";
        echo 
'</table>';
        }
        else if(
$cid=='item'){
        
mysql_connect("localhost""root""root") or die("dbase Conneciton Failed!");
        
mysql_select_db("bishop");

        
$query="SELECT * FROM items where siraid=".$item_id;
        
$result mysql_query($query);    
        
$count=0;
        
$item_name="";
        
$item_large_img="";

        while (
$row mysql_fetch_array($result)) {
            
$item_name=$row[1];
            
$item_large_img=$row[4];                        
            
$count++;
        }

        if(
$count==0){
            echo 
"No files found...";
            exit;
        }

        echo 
'
                  <table width="329" border="0" cellspacing="0" cellpadding="0">
                    <tr align="center" valign="top"> 
                      <td width="105" align="center" valign="top" class="uruntext">
                   <!-- BUYUK RESIM BASLA -->
                   <table width="329" border="0" cellspacing="0" cellpadding="0">
                     <tr> 
                       <td colspan="3"><img src="'
.$item_large_img.'" width="334" height="242"></td>
                     </tr>
                     <tr> 
                       <td width="68" height="36"><img src="i/trans.gif" width="68" height="36" border="0"></td>
                       <td width="256" height="36" align="center" valign="top" background="i/detay_kapama.gif" class="baslik"><img src="i/trans.gif" height="4" width="150" border="0"><br>'
.$item_name.'</td>
                       <td width="10" height="36"><img src="i/trans.gif" width="10" height="36" border="0"></td>
                     </tr>
                   </table>
                   <!-- BUYUK RESIM BIT -->
                   </td>
                  </tr>
        <tr align="center" valign="top"> 
          <td align="center" valign="top" class="uruntext"><img src="i/trans.gif" width="1" height="20" border="0"></td>
        </tr>
        <tr align="center" valign="top"> 
          <td align="left" valign="top" class="uruntext">
         '
;

        

        
$query="SELECT * FROM item_detail where item_id=".$item_id." order by orderance";
        
$result mysql_query($query);    
        
$count=0;        
        
        while (
$row mysql_fetch_array($result)) {
                        
            if(
$count==0){
                echo 
'
                              <!-- OZELLIKLER BASLA -->
                              <table width="100%" border="0" cellspacing="0" cellpadding="0">'
;
            }
                        echo 
'
             <tr> 
                <td width="80" height="30" align="left" class="maintextbold" valign="top">'
.$row[1].'</td>
                <td width="10" height="30" align="left" class="maintextbold" valign="top">:</td>
                <td height="30" align="left" class="maintext" valign="top">'
.$row[2].'</td>
              </tr>'
;

        
$count++;
        }

        if(
$count==0){
            echo 
"There is no data...";
        }
                else{
                  echo 
'
                  </table>
                  <!-- OZELLIKLER BIT -->'
;
                }
        
mysql_free_result($result);

        
$query="select siraid from items where cat_id=".$cat_id.' order by siraid';
        
$result mysql_query($query);    
        while (
$row mysql_fetch_array($result)){
                  if(
$row[0]<$item_id){
                     
$pre_id=$row[0];
                     
$pre_link='<a href="index.PHP?sh='.$sh.'&cid=item&item_id='.$pre_id.'&cat_id='.$cat_id.'" class="duzyazilink">&laquo; Previous</a>';
                  }
                }
        
mysql_free_result($result);
                
$result mysql_query($query);

        while (
$row mysql_fetch_array($result)){
                  if(
$row[0]>$item_id){
                     
$next_id=$row[0];
                     
$next_link='<a href="index.PHP?sh='.$sh.'&cid=item&item_id='.$next_id.'&cat_id='.$cat_id.'" class="duzyazilink">Next &raquo;</a>';
                     
$next_link2='</a>';
                     break;
                  }
                }
                echo 
'</td>
        </tr>
        <tr>
        <td>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" height="60">
        <tr>
          <td align=left width="50%" class="maintext">'
.$pre_link.'</td>
          <td align=right width="50%" class="maintext">'
.$next_link.'</td>
        </tr>         
        </table>
        
        </td>
        </tr>
      </table>'
;

        
mysql_free_result($result);
        
mysql_close();        

        
?>
      <?PHP
        
}
        else if(
$cid=='static'){

           include(
$staticname);
        }
        else{
        
?>
      <p align="justify"><img src="i/anasayfa_resim.jpg" width="329" height="158"><br>
        <img src="i/trans.gif" width="329" height="5"> Bishop was established 
        in 1997 to introduce to the rapidly growing interior design industry<br>
        <br>
        in Turkey the elements of cutting edge furniture and lighting design. 
        In our vast showroom located in Nisantasi, the upscale design district 
        of Istanbul, we feature among others<br>
        <br>
        lighting and accessories conceived by Poul Henningsen, Arne Jacobsen, 
        Eric Magnussen and Holger Strom.<br>
        <br>
        Despite its short history, Bishop quickly became the leading interior 
        design store in Istanbul specializing in new design and modern classics. 
        In our showroom we further represent an array of works by upcoming Turkish 
        designers. Our design team's lighting concepts have been implemented in 
        numerous restaurant, hotel, office and residential projects all over Turkey. 
        Using simple forms with a touch of flare, Bishop Designs adapt to every 
        space and suit specific applications.<br>
        <br>
        In the last 4 years, we have extended our scope and services into manufacturing 
        of lighting and furniture, and have gained the respect of acclaimed designers 
        in Turkey as well as in Europe with our products. The production workshops 
        of Bishop are able to meet the high standarts of designers in quality 
        and detailing, and can work with various different materials such as plexiglass, 
        metal(aluminum, chrome, brass etc.), recycled paper, polypropylene and 
        various fabrics. Besides batch production capabilities, we can also offer 
        consulting during design and sampling stage.<br>
        To the domestic and contract clients as well as the designer, Bishop can 
        offer many advantages all at the same time: <br>
        <br>
      
      <table width="100%" border="0" cellspacing="0" cellpadding="5">
        <tr> 
          <td width="20" align="center" valign="top" class="maintext">-</td>
          <td align="left" valign="top" class="maintext">Energetic and young ownership 
            and staff with a keen understanding of the current design world.</td>
        </tr>
        <tr> 
          <td width="20" align="center" valign="top" class="maintext">-</td>
          <td align="left" valign="top" class="maintext">Creative solutions which 
            can be implemented in new design ideas.</td>
        </tr>
        <tr> 
          <td width="20" align="center" valign="top" class="maintext">-</td>
          <td align="left" valign="top" class="maintext">The ability to manufacture 
            quality products for the designer at very competitive prices.</td>
        </tr>
        <tr> 
          <td width="20" align="center" valign="top" class="maintext">-</td>
          <td align="left" valign="top" class="maintext">The flexibility to create 
            samples or difficult molds for new ideas.</td>
        </tr>
        <tr> 
          <td width="20" align="center" valign="top" class="maintext">-</td>
          <td align="left" valign="top" class="maintext">The experience in lighting 
            design and manufacture of bar, hotel, nightclub and restaurant projects.</td>
        </tr>
      </table>
</p>
        <?PHP ?>
        </td>
  </tr>
  <tr> 
    <td align="center" valign="top" class="maintext" height="20"><img src="i/trans.gif" width="1" height="20" border="0"></td>
  </tr>
</table>
bu dosya icerik.PHP... herşey bu dosya üzerinde gerçekleşio.. ürün listeleme de, ürün detayı alma da...

benim mantığıma göre olmaıs gereken şöyle..
şu anda ürünler listelenirken bir ürünün detayına girmek için kullanılan link bu..
Kod:
<a href="index.PHP?sh='.$sh.'&cid=item&item_id='.$row[5].'&cat_id='.$cat_id.'" class="urunlink">
buna göre item id'si items'in içindeki row5'e eşit olana git diyo, değil mi ?

fakat ürünün detayında ise
PHP Code:
$query="SELECT * FROM items where siraid=".$item_id
ile başlayan satır bana items'in içindeki siraid'si item id'ye eşit olanları al dio...

(iyice karıştırdım biliom )

benim istediğim, yukardaki kod içinde nası bi değişiklik yapmam gerekirki, ürünler sira id ile listelenirken detayına girince sira id'si geldiği sayfadaki id ile örtüşen (bu nası bi kelimeyse) ürünün detayı bana gelsin ? (vöh!)

anlatamadım büyük ihtimal.. beni anlıycak bi babayiğit war mı

şimdiden teşekkürler
__________________
Kişisel: ozankilic.com | İşsel: Biletix.com | Fotosel: flickr.com/photos/okilic | Stocksel: istockphoto.com/ozankilic
Firan Zal'honan şu an çevrimdışı  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl'e kaydet! http://reddit.com/submit?url=%url%&title=%title%Wong'e kaydet!Yahoo'ya kaydet!Google'a kaydet!MSN'e kaydet!Facebook'e kaydet!
Mesajdan alıntı yaparak yeni bir cevap ekleyin
Old 01.10.2003   #2 (permalink)
 
Firan Zal'honan's Avatar
 
Üyelik Tarihi: 06.06.2001
Yer: istanbul
Yaş: 31
Mesaj: 697
amanın!!! forumu gümlettim!!!
__________________
Kişisel: ozankilic.com | İşsel: Biletix.com | Fotosel: flickr.com/photos/okilic | Stocksel: istockphoto.com/ozankilic
Firan Zal'honan şu an çevrimdışı  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl'e kaydet! http://reddit.com/submit?url=%url%&title=%title%Wong'e kaydet!Yahoo'ya kaydet!Google'a kaydet!MSN'e kaydet!Facebook'e kaydet!
Mesajdan alıntı yaparak yeni bir cevap ekleyin
Old 01.10.2003   #3 (permalink)
 
Firan Zal'honan's Avatar
 
Üyelik Tarihi: 06.06.2001
Yer: istanbul
Yaş: 31
Mesaj: 697
sanırım ki düzenlenmesi gereken cümle şurası :

Kod:
$query="SELECT * FROM item_detail where item_id=".$item_id." order by orderance";
mantığı da item_detail içindeki item_id'si items'ın içindeki id'si ile çakışan'ın bilgisini getir gibi bişi olcak galiba.. çünkü yukarda

Kod:
$query="SELECT * FROM items where siraid=".$item_id;
denilen satır ile ürün detayına girince gelmesi gereken imaj ve ürün adı normal şekilde gelio...

doğru mantık mı kurdum.. ? öğreniom mu bu işi
__________________
Kişisel: ozankilic.com | İşsel: Biletix.com | Fotosel: flickr.com/photos/okilic | Stocksel: istockphoto.com/ozankilic
Firan Zal'honan şu an çevrimdışı  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl'e kaydet! http://reddit.com/submit?url=%url%&title=%title%Wong'e kaydet!Yahoo'ya kaydet!Google'a kaydet!MSN'e kaydet!Facebook'e kaydet!
Mesajdan alıntı yaparak yeni bir cevap ekleyin
Sponsorlu Bağlantılar
Zoque.Forum
Reklam
Yanıt

Etiketler

sorunum , mysqlde , php


 
Zoque'a hoşgeldiniz!
Zoque 27.02.1999 tarihinde yayın hayatına başlamış, paylaşıma dayalı bir oluşumdur. Tasarım, teknoloji, web, kültür ve sanat ana başlıkları altında bilgi paylaşımı ve benzer değerlere sahip katılımcıların birbirleriyle iletişime girmelerine imkan sağlar. "Az ama Öz" sloganından yola çıkarak, kaliteli ve nitelikli katılımı temel alır.

Saygın ve ciddi bir ortamda yardımlaşmak, haberleşmek, kendi bildiklerini diğer katılımcılarla paylaşmak isteyen, oluşumumuza düzenli katılımda bulunacağı inancını taşıyan konuklarımızı üye olmaya davet ediyoruz. [ » ]


Üye Girişi:

En popüler ilk 100 etiket
Tag Cloud
acil adsl ajax almak arama araniyor ariyorum ariyoruz asp bilen bilgi bilgisayar blog calisma canon css div domain dosya eleman film firefox flash font form forum fotograf freelance google gore grafik grafiker hakkinda hangi hata hatasi hosting html ilgili ilk image internet istanbul istiyorum java javascript karakter kayit kisisel kullanimi link logo mac mail menu muzik mysql nasil neden nedir online oyun photoshop php problemi program programi reklam resim satilik sayfa script server ses sistemi site sitesi son soru sorun sorunsali sorunu sql swf tasarim tasarimci tasarimcisi tasarimi turk turkce veri video web windows wordpress xml yardim yazi yeni zoque
Zoque RSS Aboneliği
Son eklenen konuları e-posta ile haber verelim mi?

Forum Yazılımı: vBulletin® Version 3.7.4 Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

Arayüz/Skin "Güneş" © www.zoque.com / net. Copyright © 1999 - 2008
Forum Saati GMT +2. Şu anda saat: 12:26.