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]; } Link to comment https://forums.phpfreaks.com/topic/262027-row2-doesnt-work/ 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 ? Link to comment https://forums.phpfreaks.com/topic/262027-row2-doesnt-work/#findComment-1342756 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. Link to comment https://forums.phpfreaks.com/topic/262027-row2-doesnt-work/#findComment-1342758 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. Link to comment https://forums.phpfreaks.com/topic/262027-row2-doesnt-work/#findComment-1342759 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.