I am having trouble with Dreamweaver 8 and php with MySQL.

Basically, I have a main page, index.php that includes a header file that I use to display my header using readfile like this:
<?php readfile("header.php"); ?>

Inside of header.php, there is code to create a drop down list. I am trying to populate this list from my database, but I cannot get this to work.

This is the code snippet:

<form name="storeShowSelect" method="GET" class="sf_select" target='newwin'>
<input name="selectStore" type="hidden" value="17999">

<select name="storeSelect" onChange="jumpToLink(this);">
<option disabled selected >--- Select a store ---</option>
<?php
do {

?>
<option value="<?php echo $row_marketplaceStoreNames['storeName']; ?>">
<?php echo $row_marketplaceStoreNames['storeDisplayName']; ?>
</option>
<?php
} while ($row_marketplaceStoreNames = mysql_fetch_assoc($marketplaceStoreNames));
?>
</select>
</form>

It looks like this is only inserting one blank row in the drop down list. When testing my recordset in Dreamweaver, I do get the rows of data that I am expecting.

Can anyone possibly help me figure out what I am doing wrong here?

Thanks in advance,
Mona

    We need to see the mysql query to see if there is any problem with the fetching of the data from the database.

    Why are you using readfile and not include ???

      Holy cow, ClarkF1, you went right to the problem.

      When I switched to use include instead of readfile, that fixed my problem.

      Now, I am a bit confused as to why readfile did not work. Sounds like it should have done the same thing.

      Thanks for your help.

        I think readfile would just echo the contents of the file (a bit like using \$ in an echo statement) , whereas include parses variables correctly etc.

        Please mark the thread as resolved (thread tools menu)

          Write a Reply...