Re: [Linux-programlama] PHP Script Hatası

---------

New Message Reply About this list Date view Thread view Subject view Author view Attachment view

From: What you get is Not what you see (wyginwys@gmail.com)
Date: Thu 18 Jan 2007 - 09:16:18 GMT


Manualden alinti :
When working on large result sets, you should consider using one of
the functions that fetch an entire row (
mysql_fetch_row()
mysql_fetch_array()
mysql_fetch_assoc()
mysql_fetch_object()). As these functions return the contents of
multiple cells in one function call, they're MUCH quicker than
mysql_result(). Also, note that specifying a numeric offset for
the field argument is much quicker than specifying a fieldname or
tablename.fieldname argument.

Performance: An important thing to note is that using
mysql_fetch_array() is not significantly slower than using
mysql_fetch_row(), while it provides a significant added value.

Sorunuzda hatadan bahsetmissiniz. O neydi?

On 1/18/07, Fatih Kaya <fkayaist@gmail.com> wrote:
>
>
>
>
> Peki, hangisini kullanmam performans açısından daha iyidir?
>
>
>
> 1. mysql_result()
>
> 2. mysql_fetch_array
> $kayit[" foto"] ÅŸeklinde
>
> 3. mysql_fetch_object
> $kayit->foto
>
>
>
>
> Fatih Kaya
>
> ________________________________

>
> From: linux-programlama-bounces@liste.linux.org.tr [mailto:linux-programlama-bounces@liste.linux.org.tr] On Behalf Of Huseyin Gomleksizoglu
> Sent: Thursday, January 18, 2007 10:48 AM
> To: linux-programlama@liste.linux.org.tr
> Subject: Re: [Linux-programlama] PHP Script Hatası
>
>
>
>
> if($a==4) {
>
> yerine
>
> if ($i3 % 4 == 0) {
>
> gibi bir yapı kullanırsan $a diye bir değişkene ihtiyacın kalmaz.
>
> ayrıca Agah Bey'in dediği gibi mysql_fetch_array veya mysql_fetch_object kullanabilirsiniz. Bu durumda
> mysql_result() fonksiyonunu da kullanmanıza gerek kalmaz.
>
> mysql_fetch_array kullanırsanız
> $kayit[" foto"] ÅŸeklinde
>
> mysql_fetch_object kullanırsanız
> $kayit->foto ÅŸeklinde bilgilere eriÅŸebilirsiniz.
>
> son olarak da
>
> <tr align="center">
>
> her 4 kayıtta bir </tr> yapıyorsun ama daha sonra yeni bir <tr> açmıyorsun. Bu durumda tablon düzgün gözükmez.
>
> $a++;
>
> if($a==4) {
>
> echo("</tr>\n<tr align\"Center\">");
>
> $a=0;
>
> }
>
> şeklinde yapmalısın.
>
>
>
>
>
>
> On 1/18/07, Agah ALICI < agah@sakarya.edu.tr> wrote:
>
>
> Merhaba,
>
> while($kayit = mysql_fetch_array($sql3)){
>
> .....
>
> }
>
>
> şeklinde kullansanız daha doğru olur sanıyorum.
>
>
>
>
>
> İyi çalışmalar...
>
>
>
> ________________________________

>
> From: linux-programlama-bounces@liste.linux.org.tr [mailto:linux-programlama-bounces@liste.linux.org.tr] On Behalf Of Fatih Kaya
> Sent: Thursday, January 18, 2007 10:07 AM
> To: linux-programlama@liste.linux.org.tr
> Subject: [Linux-programlama] PHP Script Hatası
>
>
>
> Merhaba,
>
>
>
>
> Şu kodda genel bir mantık hatası, kod hatası..vb. bir hata görüyor musunuz? Yada nasıl söylesem, bu şekilde bir sorgulama ve kayıt gosterme yerine daha güvenli ve hatasız bir yazım şekli var mıdır? Kod normalde çalışıyor ancak sayfa ard arda refresh edildiğinde hata veriyor…
>
>
>
> Rastgele foto gösteren script: (bir hata var mı?)
>
>
>
> <?php
>
> $sql3 = mysql_query("SELECT id, baslik, foto, diger, aciklama FROM foto ORDER BY rand() DESC limit 16");
>
> ?>
>
> <tr align="center">
>
> <?php
>
> for($i3=0;$i3<16;$i3++){
>
> $kayit_id3 = mysql_result($sql3,$i3,"id");
>
> $kayit_foto3 = mysql_result($sql3,$i3,"foto");
>
> $kayit_baslik3 = mysql_result($sql3,$i3,"baslik");
>
> $kayit_diger3 = mysql_result($sql3,$i3,"diger");
>
> $kayit_ack3 = mysql_result($sql3,$i3,"aciklama");
>
> ?>
>
> <td width="195"><?=$kayit_ack3?><br />
>
> <br />
>
> <span class="style2"><?=$kayit_diger3?></span></td>
>
> <?php
>
> $a++;
>
> if($a==4) {
>
> echo("</tr>");
>
> $a=0;
>
> }
>
> }
>
>
> ?>
>
>
>
>
> Fatih Kaya
>
>
>
>
>
> _________________________________________________________
>
> Bu E-Posta Sakarya Universitesi E-posta Sunucusu Araciligiyla Size Ulastirilmistir.
>
> SAU >> BIDB >> Ar-Ge S.M. >> Sistem Yonetimi Servisi
>
> >> BitDefender Antivirus Yazilimi Tarafindan Virus Taramasindan Gecirilmistir.
>
>
> _______________________________________________
> Linux-programlama mailing list
> Linux-programlama@liste.linux.org.tr
> http://liste.linux.org.tr/mailman/listinfo/linux-programlama
>
>
>
>
> _______________________________________________
> Linux-programlama mailing list
> Linux-programlama@liste.linux.org.tr
> http://liste.linux.org.tr/mailman/listinfo/linux-programlama
>
>
>

_______________________________________________
Linux-programlama mailing list
Linux-programlama@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama


New Message Reply About this list Date view Thread view Subject view Author view Attachment view

---------

Bu arsiv hypermail 2.1.2 tarafindan uretilmistir.