why doesn't my code work? :(

From: Date: Wed, 19 Jul 2000 12:24:24 +0000
Subject: why doesn't my code work? :(
Groups: php.general 
Request: Send a blank email to php-general+get-7250@lists.php.net to get a copy of this message
Hi ppl, I'm just trying a simple script to select something from a database, but it keeps giving me an error that there was a database problem (not selecting the database, but the second error mind you..) here's the code... : $offset = ($totalrows - 10); /* make connection to database */ MYSQL_CONNECT($hostname,$username,$passwrd) OR DIE("Oh twadi! Couldnt connect to the database, sorry mate!"); @mysql_select_db($dbName) or die("Unable to select database"); /* build the table from the database */ $query = " SELECT * FROM releases_music ORDER BY desc LIMIT $offset,10"; $result = mysql_db_query("$username", $query); if ($result) { print "<table border=0 cellspacing=0 cellpadding=0 width=100% align=center>\n"; while ($r = mysql_fetch_array($result)) { $name = $r["name"]; $date = $r["date"]; $starring = $r["starring"]; $others = $r["others"]; echo "<tr><td ><strong class=white>$name</strong></td> <td><small class=white>$date</a></small></td></tr>\n"; echo "<tr><td colspan=2><small class=white>$starring</small></td></tr> \n"; echo "<tr><td colspan=2><small class=white>$others</small></td></tr> \n"; } echo "</table><br> \n"; } else { echo "<strong class=black>whoops! there was some kind of database problem! It would be nice if you emailed the <a href=mailto:webmaster@snooplife.com>webmaster</a> and told him!</strong>"; } mysql_free_result($result); /* Close the database connection */ MYSQL_CLOSE(); Hope that makes sense to some folks... it gives me an error of : whoops! there was some kind of database problem! It would be nice if you emailed the <a href=mailto:webmaster@snooplife.com>webmaster</a> and told him! thanks in advance! /sunny __________________________________________________ Do You Yahoo!? Get Yahoo! Mail – Free email you can access from anywhere! http://mail.yahoo.com/

« previous php.general (#7250) next »