PHP 4 to 5 migration issue
Posted: Thu Jan 08, 2009 8:38 pm
After migrating from PHP 4.3.10 to 5.2.8 I'm receiving an "undefined index" error from the following code...
I know the mysql result is valid since it works fine in PHP4.
The output from var_dump($row) is:
PHP4
array(2) { ["yard"]=> string(22) "Chestnut Ridge Transit" ["yard_id"]=> string(1) "5" }
PHP5
array(2) { [""]=> string(22) "Chestnut Ridge Transit" ["B"]=> string(1) "5" }
Why would I be getting the strange characters for the field values?
Thanks
Code: Select all
<?php
while($row = mysql_fetch_array($result)){?>
<input id="yard_<?php echo $row['yard_id'];?>" type="checkbox" name="yard_list[]" value="<?php echo $row['yard_id'];?>" checked>
<label for="yard_<?php echo $row['yard_id'];?>"><?php echo $row['yard'];?></label><br>
<?php
}?>The output from var_dump($row) is:
PHP4
array(2) { ["yard"]=> string(22) "Chestnut Ridge Transit" ["yard_id"]=> string(1) "5" }
PHP5
array(2) { [""]=> string(22) "Chestnut Ridge Transit" ["B"]=> string(1) "5" }
Why would I be getting the strange characters for the field values?
Thanks