MichelDS Posted May 3, 2012 Share Posted May 3, 2012 $Row[2] doesn't work but if I use $Row["linkcat"] than it works fine. Is there somewhere to activate in the php.ini file ? // I got 9 fields to in the table tbl_link ! $Row[2] should give me a number. $Verbinding = mysql_connect($db_host, $db_user, $db_passw); mysql_select_db($db_name); $sql = "Select * from tbl_link where userid=1"; $ResultShow = mysql_query($sql); while ($Row = mysql_fetch_assoc($ResultShow)){ echo $Row[2]; } Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted May 3, 2012 Share Posted May 3, 2012 mysql_fetch_assoc only returns an associative array. Perhaps you meant to use mysql_fetch_row or mysql_fetch_array ? Quote Link to comment Share on other sites More sharing options...
MichelDS Posted May 3, 2012 Author Share Posted May 3, 2012 Oh yes indeed, I overlooked this one ! I do need to use $Row[index] system for a function I 'm working on so I can use the same function for different perposes. The example was just a little example. I need only 1 row back in fact. So yes mysql_fetch_row works fine, thanks. Quote Link to comment Share on other sites More sharing options...
Mahngiel Posted May 3, 2012 Share Posted May 3, 2012 The issue is you are requesting the value for the Array where the KEY is 2. Because your array has strings for keys, you have errors. print_r() or var_dump() are great functions to use on arrays and objects to help determine the existence of your desires. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.