1

This is my page

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php
require("admin/config/connect.php");

?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META http-equiv=content-type content=text/html;charset=iso-8859-9>
<META http-equiv=content-type content=text/html;charset=windows-1254>
<META http-equiv=content-type content=text/html;charset=x-mac-turkish>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Lettering by FCT</title>
<link href="http://fonts.googleapis.com/css?family=Arvo" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
    <div id="page">
        <div id="page-bgtop">
            <div id="page-bgbtm">
                <div id="content">
                  <div class="post">
                  <?php $id = $_REQUEST["id"]; 
                   $sorgu=mysql_query("select * from portalmakale where id='$id'");

$oku=mysql_fetch_assoc($sorgu);

                  ?>
                      <h2 class="title"><?php echo $oku['baslk']; ?></h2>
                        <p class="meta"><?php echo $oku['tarih']; ?></p>
                        <div style="clear: both;"></div>
                        <div class="entry">
                            <p><?php echo $oku['icerk']; ?></p>
                            <p class="links"><a href="#">&nbsp;&nbsp;&nbsp;</a></p>
                      </div>
                    </div>
                  <div class="post">
                  <?php session_start();


    $sayi1 = rand(1,100);
    $sayi2 = rand(1,600);



    $toplam_sayi = $sayi1+$sayi2;


    $_SESSION['guvenlik_kodu'] = "$toplam_sayi";


  ?>
                    <center><p><font size="+2">Yorum Yapın! </font></p>
                    <p><font size="2">&quot;Amaaan yorum yapsam nolur yapmasam nolur :S Ne işime yarıcak </font>&quot; demeden yorumlarınızın değerli olduğunu hatırlatalım .</p>
                    <center>  <form id="form1" method="post" action="yorumekle.php?id=<?php echo $id ?>">
                      <table width="404" height="155" border="0">

  <tr>
    <th width="67" scope="row">Ad</th>
    <td width="117"><center><input name="ad" type="text" /></center></td>
  </tr>
  <tr>
    <th scope="row">Email</th>
    <td><center><input name="email" type="text" /></center></td>
  </tr>
   <tr>
    <th scope="row">Mesaj</th>
    <td><center><textarea  name="mesaj"  rows="7" cols="30"></textarea></center></td>
  </tr>
  <tr>
    <th scope="row">Doğrulama</th>
    <td><center><input name="dorulama" type="text" /></center></td>
  </tr>
  <tr>
    <th scope="row">G&ouml;nder</th>
    <td><center><input name="" type="submit" value="Gönder" /></center></td>
  </tr>
</table>
                    </form></center>
                      <p>Sizin İçin Hiçbir Masraftan Kaçınmayıp, Yemeden i&ccedil;menden, G&uuml;nlerce oturup yazdığımız ve &ccedil;alışıp didinip emektar annelercesine uğraşıp oluşturduğumuz doğrulama kodunuz .</p>
                      <p><font size="+1"><?php echo'Güvenlik kodu: '; echo $sayi1+$sayi2 ?></font></p>

                    </center>
                    <div class="entry">
                        <p><center>Css Ve Php bilgilerimizin el verdiğince yayınlayabildiğimiz yapılan yorumlar </center>.<center>
                         <?php


//kaç tane gösterileceğini girin
$gosterim=5;
//gösterilecek sayfa numarasını alma
$sayfa=@$_GET['sayfa'];
//sayfa numarası kontrolü
if(empty($sayfa) || !is_numeric($sayfa)){$sayfa=1;}

//toplam kayıt sayısını alma
$k_sayisi=mysql_num_rows(mysql_query("Select yorumid From yorum"));
//kaç sayfa olacağını bulma
$s_sayisi=ceil($k_sayisi/$gosterim);
//hangi kayıttan itibaren gösterileceğini bulma
$ilk_kayit=($sayfa*$gosterim)-$gosterim;
 ?>
                        <?php $veri = mysql_query('select ad,mesaj from yorum where id=$id');

                  ?>
                        <table width="522" border="1">
  <tr>
    <th scope="col">Ad</th>
    <th scope="col">Mesaj</th>
  </tr>
  <?php  while($row = mysql_fetch_array($veri)){?>
  <tr>
    <td><?php echo $row['ad'];?></td>
    <td><?php echo $row['mesaj'];?></td>
  </tr> <?php } ?>
</table><center>
</p> <?php



//ilk sayfaya gitme bağlantısı
if($sayfa!=1){
    echo "<a href='?id=&sayfa=1'>İlk</a>";
    echo " ";
}
//diğer sayfalara geçiş bağlantısı koyma
for($i=1;$i<=$s_sayisi;$i++){
    echo "<a href='?id=$id&sayfa={$i}'>$i</a>";
    echo " ";
}
//en son sayfaya gitme bağlantısı
if($sayfa!=$s_sayisi){
    echo "<a href='?id=$id&sayfa={$s_sayisi}'>Son</a>";
}

?>
                    </div>
                  </div>
                </div>
                <!-- end #content -->
                <div id="sidebar">
                    <div id="logo">
                        <h1><a href="index.php">MybbEklenti</a></h1>
                        <p>slogans<a href="http://www.freecsstemplates.org/" rel="nofollow"></a></p>
                    </div>
                    <div id="menu">
                        <ul>
                            <li class="current_page_item"><a href="#">Portal</a></li>
                            <li></li>
                            <li></li>
                            <li><a href="#">Hakkımızda</a></li>
                            <li></li>
                            <li><a href="#">İletişim</a></li>
                        </ul>
                    </div>
                    <ul>
                        <li>
                            <h2>Duyurular</h2>
                            <p>Mauris vitae nisl nec metus placerat perdiet est. Phasellus dapibus semper consectetuer hendrerit.</p>

                        </li>
                      <li>
                            <h2>Kategoriler</h2>
                            <ul>
                                <li><a href="#">Aliquam libero</a></li>
                                <li><a href="#">Consectetuer adipiscing elit</a></li>
                                <li><a href="#">Metus aliquam pellentesque</a></li>
                                <li><a href="#">Suspendisse iaculis mauris</a></li>
                                <li><a href="#">Urnanet non molestie semper</a></li>
                                <li><a href="#">Proin gravida orci porttitor</a></li>
                            </ul>
                        </li>
                        <li></li>
                        <li>                        </li>
                    </ul>
                </div>
                <!-- end #sidebar -->
                <div style="clear: both;">&nbsp;</div>
            </div>
        </div>
    </div>
    <!-- end #page -->
</div>
<div id="footer">
    <p>T&uuml;m Hakları Saklıdır !</p>
</div>
<!-- end #footer -->
</body>
</html>

My error is Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\lettering\makale.php on line 113. How can i fix that. Line 113 is ;

<?php  while($row = mysql_fetch_array($veri)){?>

İ tried every way to fix that but i still get that error this is the image of the error ;

http://www.yukleresim.com/images/2013/10/14/Screenshot1.png

Ankur Dhanuka
  • 1,217
  • 2
  • 11
  • 22
mert
  • 13
  • 1
  • 1
  • 3

6 Answers6

1

copy and paste your query

select * from portalmakale where id='$id'

directly in database there it will show you the error.

also you can use mysql_error()like this

$sorgu=mysql_query("select * from portalmakale where id='$id'") or mysql_error();
Ankur Dhanuka
  • 1,217
  • 2
  • 11
  • 22
0

mysql_query() returned false because of error. Use mysql_error() to check what is going and don't forget that every query can fail. Check it.

Also think about changing to PDO. It's better than deprecated mysql_*.

Elon Than
  • 9,603
  • 4
  • 27
  • 37
0

Replace $veri = mysql_query("select ad,mesaj from yorum where id=$id").

In Variable parsing as per: http://php.net/manual/en/language.types.string.php

When a string is specified in double quotes or with heredoc, variables are parsed within it. 

Also, you try converting your mysql_* function to PDO or mysqli. Preferably, you can use procedural style mysqli as it is almost similar to mysql_*

Here is a list of OOP and procedural mysqli : http://www.php.net/manual/en/mysqli.summary.php

aaron
  • 697
  • 4
  • 11
0

This error will only generate when query returns empty record set.

So first check each parameter in query (like fields, table name and id). If all these are correct then e*xecute your query in mysql*. or use php function mysql_error which will show exact error and you will get solution.

Anand Solanki
  • 3,419
  • 4
  • 16
  • 27
-1

This is because your sql query is not correct. mysql_query returns false when the query is invalid. Your query statement looks correct. Check if your variable $id is set or not.

<?php 
  if(isset($_REQUEST['id'])) {
     $id = $_REQUEST['id'];//if this variable is empty mysql_query returns false
   }
  //Now write your other stuffs

A bit of suggestion upgrade from mysql to mysqli or PDO

nurakantech
  • 502
  • 4
  • 14
-1
$veri = mysql_query('select ad,mesaj from yorum where id=$id');

This query of yours is empty and not fetching any result, i would suggest

echo 'select ad,mesaj from yorum where id=$id';

Check after each query to see if the query is correct and execute the echoed query directly in database to see the result.

danish hashmi
  • 484
  • 5
  • 12