MySQL db record being processed twice
Posted: Tue Oct 25, 2016 8:56 am
Code worked at one time. Now acting like it's reading the same record twice.
Looked at the main code and it seems ok (just a do-while loop). Looking at the connect and query code, I think I may be using deprecated code, which might be contributing. (Am researching what the current coding approach is. I'm a php mysql novice).
The connection looks OK and I've checked the db to make sure it doesn't have dup records.
These are the queries: one for groups and one for maps. Does it look ok? Where should I be using current coding?
Looked at the main code and it seems ok (just a do-while loop). Looking at the connect and query code, I think I may be using deprecated code, which might be contributing. (Am researching what the current coding approach is. I'm a php mysql novice).
The connection looks OK and I've checked the db to make sure it doesn't have dup records.
These are the queries: one for groups and one for maps. Does it look ok? Where should I be using current coding?
Code: Select all
<?php
require_once('Connections/atlas.php'); // NOTE: Also may require change in href for detail
// New group code
mysql_select_db($database_atlas, $atlas);
$groups = mysql_query("SELECT * FROM tblMapGroups ORDER BY DispSeq ASC"); // Get the group records
$row_groups = mysql_fetch_assoc($groups);
if (!$_GET)
$selectGroup = $row_groups['MapGroupID']; // First time through; set initial default group
else $selectGroup = $_GET['groupselect']; // Otherwise use GET to retrieve the submit button chosen
mysql_data_seek($groups, 0); // Reset to first record for Form loop
// End new group code
// Select map records
$query_maps1 = "SELECT * FROM tblMaps";
$query_maps2 = "ORDER BY tblMaps.MapGroup, tblMaps.Area, tblMaps.Community, tblMaps.DispSeq ";
$query_maps = sprintf("%s WHERE MapGroup ='%s' %s", $query_maps1, $selectGroup, $query_maps2);
$maps = mysql_query($query_maps, $atlas) or die(mysql_error());
$row_maps = mysql_fetch_assoc($maps);
?>