Mysql_fetch_array (): verilen argüman â € geçerli bir MySQL sonuç değildir | [yinelenen]

3 Cevap php

Possible Duplicate:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result

Aklıma gelen her şeyi denedim, ama ben bu hatayı almaya devam.

Mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /url/ on line 41

if ( $_POST[submit] == "Submit" )
    {
        $sql="INSERT INTO table (`content`, `userid`, `ttime`) VALUES 
('$_POST[content]', '".$user_id."', '".time()."')";
    $res = mysql_query($sql,$link) or die(mysql_error());
/* (line 41 is the following)*/ 
while($result = mysql_fetch_assoc($res)) {
    } }

(Hiçbir hata sadece uyarı yazdırır) hata yazdırarak denedim, ben, sorgu değişen ben düşünüyorum her şeyi denedim. Kod gayet güzel çalışıyor - bu, her şey sadece bu uyarı görünüyorsa, ince tıklama insert does _ '..

Herhangi bir fikir?

3 Cevap

Php documentation üzerine mysql_query()

Return Values

For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.

For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.

The returned result resource should be passed to mysql_fetch_array(), and other functions for dealing with result tables, to access the returned data.

Use mysql_num_rows() to find out how many rows were returned for a SELECT statement or mysql_affected_rows() to find out how many rows were affected by a DELETE, INSERT, REPLACE, or UPDATE statement.

mysql_query() will also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query.

Bir INSERT sorgudan bir sonuç almak olamaz.

Bir SELECT sorgusu olmayan bir sorgudan bir veri satırını elde çalışıyorsunuz. Sen sadece bir sonuç veri setinden ilişkili diziler getirebilir. Bir INSERT sorgusu sadece kendi şeyi yapar.