Yeah, I actually did switch in the company_profiles.id just in case. Still get the same results. The part that is weird is a created a bunch of cities and assigned four of them to my test account & it grabs the 2nd, 3rd, & 4th correctly, but not the 1st one. So it seems like it is working, but just not echoing the first result for some reason. [URL=http://********itdonedesign.com/CreateDB.php?id=1]Here is the link to the results.[/URL] These are all cities in Lansing. The first one that is supposed to be listed is Bath, but is not there. You can also use id=2 for another company I tested & all the cities are named Testing2, 3, etc... You will notice that the first one is missing there as well).
Could it be something in the table setup? It seems correct. Or any other ideas?
I ran a sql query on phpMyAdmin on my profile_cities table (SELECT * FROM profile_cities WHERE profile_id =1) and it brings up the correct city_id's. But I changed the code to get rid of all the joins & pull directly from the profile_cities using the same SELECT statement (got rid of all other unnecessary steps as well)& it still skips the first record. Just for kicks, here is the code I used to try it this way:
<?php
$Host = "localhost";
$User = "getitdon_warzol";
$Password = "jemy45";
$DBName = "getitdon_testing";
$TableName = "profile_cities";
$link = mysql_connect ($Host, $User, $Password);
$query = "SELECT * FROM $TableName WHERE profile_id=1";
$select = mysql_select_db ($DBName);
$result = mysql_query ($query, $link) or die(mysql_error());
$row = mysql_fetch_assoc ($result);
while ($row = mysql_fetch_array ($result))
{ print ("You are in ".$row[city_id]."</br>\n");
}
mysql_close ($link);
?>
Anybody have any clue on this? Another weird thing I noticed is that if I simply remove the "while" loop, it by default pulls up the first record (the one that it won't bring up with the loop is used). It is all very weird 🙂