Location: PHPKode > projects > OpenCabling > opencabling/primitives/getobject.php
<?php

# Return an array with all information about the object
# identified by "id"
# 
# array (
#    [id_object]
#    [name]
#    [obj_description]
#    [obj_extravalues]
#    [obj_links]
#    [obj_type]
#    [parent_obj]
#    [position]
#    [level]
#
#    [id_obj_type]
#    [brand]
#    [category]
#    [type]
#    [html]
#    [html_small]
#    [html_back]
#    [html_back_small]
#    [void_item]
#    [void_item_back]
#    [hpos_available]
#    [vpos_available]
#    [pos_ordering]
#    [out_available]
#    [out_names]
#    [hpos_used]
#    [vpos_used]
#    [display_detail]
#    [options]
#
#    [id_display]
#    [des_display]
#    [html_detail]
# )

function getobject($id) {

  global $mysql_conn, $DEBUG;

  if (is_numeric($id)) {
    $sql="select * from objects,objtypes,displays where objects.obj_type=objtypes.id_obj_type and objects.id_object='$id' and objtypes.display_detail=displays.id_display";
    if ($DEBUG==1) print "<!-- getobject SQL: $sql -->";
    $query=mysql_query($sql,$mysql_conn);
    if (mysql_num_rows($query)>0) {
      $result=mysql_fetch_assoc($query);
      if ($DEBUG==1) {
	print "<!-- getboject Result:";
	print_r($result);
	print "-->";
      }
      return $result;
    } else {
      if ($DEBUG==1) print "<!-- getboject Result: No Rows -->";
      return FALSE;
    }
  } else {
    return FALSE;
  }
}
?>
Return current item: OpenCabling