Dear Fred...

It is solved. Thank you very much, my friend.
--- Fred van Engen <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> On Sun, Mar 30, 2003 at 05:39:13AM -0800, Prabu
> Subroto wrote:
> > Dear my friends....
> >  
> > I am trying to read the content per line of a
> query
> >  result with "mysql_fetch_row". But I got this
> error
> >  message :
> >  "
> >  Musingin homepage
> >  
> > koneksi sukses. Sukses memilih database. Sukses
> >  melakukan query. Besar hasil query 1. 
> > Warning: mysql_fetch_row(): supplied argument is
> not a
> >  valid MySQL result resource in
> >  /srv/www/htdocs/i-am-e-system/cgi-bin/tulis.php
> on
> >  line 20
> 
> The query failed, so it didn't return a valid
> result, whether emtpy or
> not.
> 
> 
> >  Akhir baris. 
> > "
> >  
> > Could any body tell me where my mistake?
> >  
> > Here is my codes under belom:
> >  <?PHP
> >  $konek=mysql_connect("localhost", "prabu",
> >  "password");
> >  if ($konek){
> >        echo "koneksi sukses.\n";
> >        mysql_select_db("berita");
> >        echo "Sukses memilih database.\n";
> >        $kalimatsql="
> >        SELECT noberita, pengirim, tanggal,
> namafile 
> >       FROM berita
> >        ";
> 
> I'm not sure what's wrong with the query, but you
> can call mysql_error
> to find out.
> 
> 
> >        $hasil = mysql_query($kalimatsql, $konek);
> 
> Now check if the query was successful:
> 
>          if (!$hasil) {
>            echo mysql_error();
>          }
>          else {
> 
> >        echo "Sukses melakukan query.\n";
> >        $besarhasil=sizeof($hasil);
> 
> What I guess you want to do here is call
> mysql_num_rows to get the
> number of rows in the result. Use sizeof to get the
> number of items in
> a list, not in a MySQL result resource, which is a
> single result object.
> 
> 
> >        echo "Besar hasil query $besarhasil.\n";
> >        while ($baris = mysql_fetch_row($hasil)){
> >             
> >
> list($noberita,$pengirim,$tanggal,$namafile)=$baris;
> >              echo "
> >              Nomer berita            : $noberita\n
> >              Pengirim            : $pengirim\n
> >              Tanggal                  : $tanggal\n
> >              Nama file            : $namafile\n
> >              ";
> >        }      
> >       echo "Akhir baris.\n";
> >  
> > } else echo "Gagal konek.\n";
> >  mysql_close($konek);
> >  ?>
> >  
> > Thank you very much in advance.
> >  
> 
> You're welcome.
> 
> 
> Regards,
> 
> Fred.
> 
> 
> -- 
> Fred van Engen                              XB
> Networks B.V.
> email: [EMAIL PROTECTED]               
> Televisieweg 2
> tel: +31 36 5462400                         1322 AC 
> Almere
> fax: +31 36 5462424                         The Netherlands

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to