galvin Posted November 28, 2008 Share Posted November 28, 2008 I have the following code... $user_set = mysql_query("SELECT * FROM users", $connection); if (!$user_set) { die("Database query failed: " . mysql_error()); } $userResArray = array(); $userCount = 0; while ($users = mysql_fetch_array($user_set)) { $userRow = "<tr><td class="name">{$users["firstname"]}" . " " . "{$users["lastname"]}<br/><img src=\"http://gdoot.com/gsfl/images/user_{$users["userid"]}.jpg\" /> <span class=\"record\">RecordPlaceHolder</span></td>"; ...which when outputted in the browser is causing seemingly random numbers to appear after the class of "name." (in the outputted table row). For example, the first row outputted has "class = "name7"". Where is that 7 coming from?!?!?!?! It should just be "class = "name"". Only the last row (which is about row 30) has it correctly (i.e. class = "name"). Every other row before that has a random number immediately after "name". Anyone have any ideas? Link to comment https://forums.phpfreaks.com/topic/134643-solved-mystery-number-being-added/ Share on other sites More sharing options...
rhodesa Posted November 28, 2008 Share Posted November 28, 2008 you have to escape your double quotes just like the rest of the line: $userRow = "<tr><td class=\"name\">{$users["firstname"]} {$users["lastname"]}<br/><img src=\"http://gdoot.com/gsfl/images/user_{$users["userid"]}.jpg\" /> <span class=\"record\">RecordPlaceHolder</span></td>"; Link to comment https://forums.phpfreaks.com/topic/134643-solved-mystery-number-being-added/#findComment-701038 Share on other sites More sharing options...
galvin Posted November 28, 2008 Author Share Posted November 28, 2008 Thanks, I escaped them, but it's still doing the same thing. Makes absolutely no sense. ??? Link to comment https://forums.phpfreaks.com/topic/134643-solved-mystery-number-being-added/#findComment-701042 Share on other sites More sharing options...
galvin Posted November 28, 2008 Author Share Posted November 28, 2008 FYI, I just changed the class in code to be "class = \"nam\"" and everything outputted as just "nam" (as it should). I then put it back to "class = \"name\"" and it comes back with random numbers (i.e. class = name8). Seems like the "e" in "name" is causing problems somehow. I guess I can just rename the class to "nam" instead of "name" but if anyone knows what might cause that, I'm very curious. Link to comment https://forums.phpfreaks.com/topic/134643-solved-mystery-number-being-added/#findComment-701043 Share on other sites More sharing options...
rhodesa Posted November 28, 2008 Share Posted November 28, 2008 can you post the entire script? Link to comment https://forums.phpfreaks.com/topic/134643-solved-mystery-number-being-added/#findComment-701046 Share on other sites More sharing options...
galvin Posted November 28, 2008 Author Share Posted November 28, 2008 Sorry I figured it out. There WAS code in another area of the script that was changing "name". My idiot brother added it recently and didn't tell me. Thanks! Link to comment https://forums.phpfreaks.com/topic/134643-solved-mystery-number-being-added/#findComment-701048 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.