PHP ' Ufacık Bir Sorun.?
-
<div id="content">
<?php
@$get_id=$_GET['id'];
if(!isset($get_id)){
$sql="select * from articles where id='$get_id' ";
$hit_sql=mysql_query("update articles set hit=hit+1 where id='$get_id'");
}
else{
$sql="select * from articles order by id desc limit 0,7";
$query=mysql_query($sql);
while ($getir=mysql_fetch_assoc($query)){
$id=$getir['id'];
$title=$getir['title'];
if(!isset($get_id)){
$articles=substr($getir['articles'],0,280);
$tarih=$getir['date'];
$hit=$getir['hit'];
echo "<h2><a href='index.php?id=."$id."'>."$title."</a></h2>";
echo " <p> ."$articles." </p>";
echo "<div align='right'>okunma: ".$hit." Tarih: ".$tarih." Devamı <a href='index.php?id=".$id."'> [...]</a></div>";
}else{
echo "bu idye sahip bi makale yok hoca adamın asabını bozma";
}
}
}
?>
</div>buyur hoca
-
AbdullahAzad bunu yazdı:
-----------------------------
@$get_id=$_GET['id'];
if(!isset($get_id)){
$sql="select * from articles where id='$get_id' ";
$hit_sql=mysql_query("update articles set hit=hit+1 where id='$get_id'");
}
else{
$sql="select * from articles order by id desc limit 0,7";
$query=mysql_query($sql);
while ($getir=mysql_fetch_assoc($query)){
$id=$getir['id'];
$title=$getir['title'];
if(!isset($get_id)){
$articles=substr($getir['articles'],0,280);
$tarih=$getir['date'];
$hit=$getir['hit'];
echo "."$title."
";
echo "."$articles."
";
echo "okunma: ".$hit." Tarih: ".$tarih." Devamı [...]";
}else{
echo "bu idye sahip bi makale yok hoca adamın asabını bozma";
}
}
}
?>buyur hoca
-----------------------------hocam Parse error: parse error, expecting `','' or `';'' in C:\Program Files\localServer\www\blog\typographyparamount\index.php on line 97
verdi
-
97inci satır ne hocam ?
bize verdiğin kodlarda 97inci satır felan yok (:
-
echo "<div align='right'>okunma: ". $hit ." Tarih: ".$tarih ." Devamı <a href='index.php?id=."$get_id".'> [...]</a></div>";
hocam $get_id "" tırnakların içinde olduğu için hata verdi
echo "<div align='right'>okunma: ". $hit ." Tarih: ".$tarih ." Devamı <a href='index.php?id=.'$get_id'.'> [...]</a></div>";
değiştim sayfa kaydı :S
-
echo "<div align='right'>okunma: ". $hit ." Tarih: ".$tarih ." Devamı <a href='index.php?id=$id'> [...]</a></div>";
hocam genelde echo ile ' kullan " kullanma.Ayrıca echo ile . değil , kullan.
Tam bi performans manyağı olduğum için 0.000bilmemkaç mili saniyeyi dikkate alıyorum.Ben değil, google böyle diyor.Neyse avdullahazad'ın kodlar çalıştıysa böyle çalışır ;
Değişkenleri gereksizse oynama hocam.Yani sadece getir['baslik'] bir yerde kullanilacaksa bosuna $baslik=$getir['baslik'] yapma.
<div id="content">
<?php
$get_id=intval($_GET['id']);
if(!isset($get_id)){
$sql="select * from articles where id='$get_id' ";
$hit_sql=mysql_query("update articles set hit=hit+1 where id='$get_id'");
}
else{
$sql="select * from articles order by id desc limit 0,7";
$query=mysql_query($sql);
while ($getir=mysql_fetch_assoc($query)){
$id=$getir['id'];
if(!isset($get_id)){
$articles=substr($getir['articles'],0,280);
echo '<h2><a href="index.php?id=$id">',$getir['title'],'</a></h2>';
echo '<p> $articles </p>';
echo '<div align='right'>okunma: ',$getir['hit'],' Tarih: ',$getir['date'],' Devamı <a href="index.php?id=',$get_id,'"> [...]</a></div>';
}else{
echo "bu idye sahip bi makale yok hoca adamın asabını bozma";
}
}
}
?>
</div>
-
ayrıca şöyle bir satır görmüştüm ;
echo "<h2><a href='index.php?id=."$id."'>."$title."</a></h2>";
buradaki id=."$id."' yanlış.Oradan sıkıntı çıkabilir. id=",$id," dener misin.Benim verdiğim kodlarda düzelttim onu.
Ayrıca: hocam tabı kullan.İf, else, switch-case, for,while vs.. ye ait olanları tab ile yada boşluk ile 2-3 boşluk bırakırsan daha rahat okursun.
-
Parse error: parse error, expecting `','' or `';'' aynı şekil ediyom etmiyom değişmiyor sayfa gitti php yeniyim sınırları zorlicam gerekirse sabaha kadar çalişirim
-
hocam satr kaçta ona bir bak, sonra editörde o satırı buraya kopyala, bakalım.
-
hocam http://hotfile.com/dl/42422732/b9b63c6/calisma.rar.html
dosyalar burda tablo adı articles
-
tmm bakıyorum hoca.
