Being new to php I'm still trying to learn different ways to do things. Once I know that something works I tend to just stick with that method but I often wonder if it's even the best way to do it or should I be doing something differently.
What I was wondering is that there are so many different ways to fetch data that it makes me dizzy. I use fetch_array almost exclusively pretty much for the only reason that I know it works. I was playing around with fetch_object and it works just fine for what I would normally use fetch_array for. Besides the fact that it returns an object instead of an array, is there any real difference when I'm accessing my data by field names?
For example, is this
$sql = mysql_query("SELECT * FROM users WHERE id='$something' ");
while($res=mysql_fetch_array($sql)){
$fn = $res['something']; }
Any different from this?
$sql = mysql_query("SELECT * FROM users WHERE id='something' ");
while($res=mysql_fetch_object($sql)){
$fn = $res->something ; }
What would be another example to fetch data and what benefit would that have?