Hi there, i just started up working with PHP and MySQL a little time ago, and i built up a site, which doesn't work quite as i want it to. Well, i wrote this code: [quote]$mysql = mysql_connect("*****", "*****", "*****") or die ("No connection!"); //connect to mysql mysql_select_db("*****", $mysql) or die ("No database establishment!"); //choosing a database $fieldnavn = $produktnummer; //$produktnummer is defined by the user in a form, a little earlier. It's a number from 1-10 $tablenavn = "produkter"; $vaelgfoernavn = mysql_query("SELECT $fieldnavn FROM $tablenavn") or die(mysql_error()); while($row = mysql_fetch_assoc($vaelgfornavn)) { echo $row['$fieldnavn']."<br />"; } mysql_query("DELETE `$produktnummer` FROM `$tablenavn`"); //Here i was trying to delete whats in the field previously, which didn't work. mysql_query("INSERT INTO `$tablenavn` ( `$produktnummer` ) VALUES ('$produktnavn')"); //put in the new stuff } [/quote] Yeah, i know my code looks crazy, sometimes using ` sometimes using " sometimes using nothing at all, anyway, when i launch this, it doesn't delete the stuff, AND i recieve the error: [quote]Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/sjuk.dk/public_html/mysql/tilfoej.php on line 40[/quote] And line 40: [quote] line 39|$vaelgfoernavn = mysql_query("SELECT $fieldnavn FROM $tablenavn") or die(mysql_error()); line 40| while($row = mysql_fetch_assoc($vaelgfornavn)) { line 41| echo $row['$fieldnavn']."<b r>"; line 42| } [/quote] [sup](the <b r> is cause the forum sees this as new line)[/sup] Okay, i really hope anyone here understand me, and won't get pissed on me, just because im a noob. Hope you guys can help me, this is driving me nuts! ??? -Steve.