How to open CMSB DB twice?

2 posts by 2 authors in: Forums > CMS Builder
Last Post: July 27, 2010   (RSS)

By mingyq - July 27, 2010

OK, so we created a booking form, http://www.castlekid.ca/booking_form.php.

One of the fields (Type of Inflatable) pulls data straight from the CMSB Database, see code:

<td class="ra" height="38"><img src="image/book_typeinflatable.png" width="226" height="36" /></td>
<td class="la">
<select name="type">
<?php
function Connect(){$serveraddress = "localhost";$user = "castleki_cmsadm";$pass = "wi1hill";mysql_connect($serveraddress,$user, $pass) or die('Could not connect: ' . mysql_error());}
function Disconnect(){$serveraddress = "localhost";$user = "castleki_cmsadm";$pass = "wi1hill";mysql_close(mysql_connect($serveraddress,$user, $pass)) or die('Could not disconnect: ' . mysql_error());}
Connect();
$sql = mysql_query("SELECT * FROM castleki_cmsbuilder.cms_listings ORDER BY product ASC");
while($r=mysql_fetch_array($sql)){
$name = $r["product"];
$size = $r["category"];
print '<option>'.$name.' - ('.$size.')</option>';
}
Disconnect();
?>
</select>
</td>
</tr>
<tr>
<td colspan="2" height="20">(Please be sure to check
the prices on the pricing page!)</td>
</tr>
<tr>
<td class="ra" height="38"><img src="image/book_typeinflatable_2nd.png" width="226" height="36"></td>
<td class="la"> <input type="text" name="2ndtype" name="text" />
(see list above)</td>
</tr>

Just below we want to give the client an option to choose an alternative product (2nd Choice) based on the same list. However, copying the same code as for choice 1 into choice 2 gives a DB Error saying your not allowed to open a DB already opened or something to that effect (it's been a couple of weeks since I tried this).

Any ideas how to populate this twice based on the same data?

MingyQ