zathrus Posted June 24, 2003 Share Posted June 24, 2003 I haven\'t been able to find this answer on the web, so here\'s what\'s happening. A fairly simple php script is calling a mysql database, and putting the results into an array. This database stores information on products, so there may be multiple rows with the same name, but they\'ll have a different topic type (category) and they all have a unique id of course. Here\'s a chunk from the file (this script calls another database, and generates links to information in that database) while($row = mysql_fetch_row($topic_result)) { //row[0]=Topic_id $test = $row[0]; $items++; $topic_types_query = "SELECT Name, `Order` FROM `Topic_Types` WHERE Topic_Type = \'$test\'"; $topic_type_result = mysql_query($topic_types_query); $topic_type_row = mysql_fetch_array($topic_type_result); $link_list[] = array(\'order\' => $topic_type_row[1], \'id\' => $row_id[0], \'type\' => $row[0], \'type_name\' => $topic_type_row[0]); } $counter=0; $items +=5; //shouldn\'t have to do this, but if I don\'t add at least one to //this value, 1 less result gets printed, than there should be, in all cases while($counter <= $items) { $i=0; while($i <= $items) { if ($link_list[$i][\'order\'] == $counter) { //print $items; print $link_list[$i][`order`]; $info_box_contents[] = array(\'text\' => "<tr><td><a href=http://somewebsite.com/Topics/somefile.cgi?ZType=" . $link_list[$i][type] . "&ZID=" . $link_list[$i][id] . ">" . $link_list[$i][\'type_name\'] . "</a></td></tr>"); } $i++; } $counter++; } (some of the values used come from further up) So, the results are simply some link another link another link (as many as there is information in the database on that item) However with 2 items specifically, you get some link <-- blank line some link another link etc Anyone know where this ghost data is originating from? (that is my entire question) I\'ve also tried checking if the elements are empty before I print but mysql didn\'t agree with me on that. Thanks in advance, Jonathan. Quote Link to comment https://forums.phpfreaks.com/topic/631-query-sometimes-returns-ghost-data/ 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.