Notice: Undefined offset: 1 in ['DOCUMENT_ROOT']/CMS/lib/database_functions.php on line 507

3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 25, 2009   (RSS)

By (Deleted User) - February 25, 2009

I am creating a list in the section editor using an 'get options from MySQL query (advanced).

Q: SELECT DISTINCT room_type FROM cms_gallery //this query is valid and tested returning the correct results I would expect.

I want to use the data from one table so that I can later join them and cross reference the data on the public side.

I am getting this error: Notice: Undefined offset: 1 in ['DOCUMENT_ROOT']/CMS/lib/database_functions.php on line 507 for each result.

viewing the source of the 'pulldown box' in the CMS I see this

</tr>
Notice: Undefined offset: 1 in /home/mulletca/public_html/newsite/CMS/lib/database_functions.php on line 507

Notice: Undefined offset: 1 in /home/mulletca/public_html/newsite/CMS/lib/database_functions.php on line 507

Notice: Undefined offset: 1 in /home/mulletca/public_html/newsite/CMS/lib/database_functions.php on line 507

Notice: Undefined offset: 1 in /home/mulletca/public_html/newsite/CMS/lib/database_functions.php on line 507

Notice: Undefined offset: 1 in /home/mulletca/public_html/newsite/CMS/lib/database_functions.php on line 507

Notice: Undefined offset: 1 in /home/mulletca/public_html/newsite/CMS/lib/database_functions.php on line 507

Notice: Undefined offset: 1 in /home/mulletca/public_html/newsite/CMS/lib/database_functions.php on line 507

Notice: Undefined offset: 1 in /home/mulletca/public_html/newsite/CMS/lib/database_functions.php on line 507

Notice: Undefined offset: 1 in /home/mulletca/public_html/newsite/CMS/lib/database_functions.php on line 507
<tr>
<td class='fieldLabel'>Room Type</td>
<td>
<select name='detail_room_type'>
<option value=''>&lt;select&gt;</option>
<option value="Commercial Spaces" ></option>
<option value="Kitchen" ></option>
<option value="Laundry Rooms" ></option>

<option value="Bathroom" ></option>
<option value="Home Office" ></option>
<option value="Garage" ></option>
<option value="Bars" ></option>
<option value="Entertainment Media" ></option>
<option value="Entertainment/Media" ></option>
</select>
</td>
</tr>


So the value in the options are correct but something isnt working quite right. Thank you in advance for advice.

Re: [seyrich] Notice: Undefined offset: 1 in ['DOCUMENT_ROOT']/CMS/lib/database_functions.php on line 507

By Dave - February 25, 2009

Hi seyrich,

The version you have requires that 2 columns be returned from a query. The first one being used as the pullldown values and the second one being the label.

So this might work better (untested):
SELECT DISTINCT room_type, room_type FROM cms_gallery

However we just added a feature to 1.27 (just released) so if only one column is specified it will use it's value as both value and label.

Hope that helps (and makes sense!). Let me know if you need anything more on that.
Dave Edis - Senior Developer
interactivetools.com