Thread: MySQL Problem
View Single Post
  #3   Spotlight this post!  
Unread 16-06-2004, 20:57
evulish's Avatar
evulish evulish is offline
1010100
AKA: Grant Harding
#0084 (WATTNESS (bot: Chuck))
Team Role: Alumni
 
Join Date: Jul 2002
Location: Towanda/Wysox, PA
Posts: 1,434
evulish is just really niceevulish is just really niceevulish is just really niceevulish is just really nice
Send a message via AIM to evulish
Re: MySQL Problem

Try using:

PHP Code:
$result mysql_query("SELECT * FROM contacts",$link) or die ("Mysql error: ".mysql_error()); 

Also, all that mysql_result stuff is probably overkill thanks to mysql_fetch_array.

PHP Code:
while ($array mysql_fetch_array($result,MYSQL_ASSOC)) {
print 
"$array['row'] $array['otherrow'] $array['etc']";

That makes it a whole lot cleaner and I'd assume quicker (but I'm not positive). (Also, take a look at www.php.net/mysql_fetch_array to see what that MYSQL_ASSOC is about, if you're wondering. You don't really need it, I guess, but I always use it)
__________________
I'm a professional web developer. I'm good with PHP, Perl, Java/JSP, some RoR, XML, Javascript (AJAX as well), (x)HTML, CSS, etc.. Validated code is good; fully cross-browser code is better (you comply to your users and the software they use, not the other way around. Sorry!)