Solarpitch Posted March 18, 2008 Share Posted March 18, 2008 Hey, Is there an reason why the value of $row[4] below will not assign its value to the array? When I try to print the value out noting will display but when I hard code in a test value... $myinfo[1] = "test"; that will print out fine. <?php ... dbconnect(); $myinfo = array(); $sql = "select * from golfpro_time_sheet where realdate= '".$teedate."' and slots < ".$players.""; $row = mysql_fetch_row($sql); $myinfo[1] = $row[4]; return $myinfo; ... ?> Link to comment https://forums.phpfreaks.com/topic/96680-small-syntax-question/ Share on other sites More sharing options...
kenrbnsn Posted March 18, 2008 Share Posted March 18, 2008 You're syntax is fine. What's in $row[4]? do a <?php echo '<pre>' . print_$($row,true) . '</pre>'; ?> after the mysql_fetch_array() BTW, you might want to use the mysql_fetch_assoc() function instead, then you can use the field names as array indexes. Ken Link to comment https://forums.phpfreaks.com/topic/96680-small-syntax-question/#findComment-494736 Share on other sites More sharing options...
PFMaBiSmAd Posted March 18, 2008 Share Posted March 18, 2008 Ummm. There is no mysql_query() in the code. You are not querying the database, so the mysql_fetch_xxxxx() has no results to be fetching. Link to comment https://forums.phpfreaks.com/topic/96680-small-syntax-question/#findComment-494737 Share on other sites More sharing options...
Solarpitch Posted March 18, 2008 Author Share Posted March 18, 2008 Thats the problem PFMaBiSmAd. Somethings are easily overlooked. Thanks lads. Link to comment https://forums.phpfreaks.com/topic/96680-small-syntax-question/#findComment-494741 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.