当前位置: 首页>>代码示例>>PHP>>正文


PHP db_fieldname函数代码示例

本文整理汇总了PHP中db_fieldname函数的典型用法代码示例。如果您正苦于以下问题:PHP db_fieldname函数的具体用法?PHP db_fieldname怎么用?PHP db_fieldname使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了db_fieldname函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ShowResultsEditSurvey

/**
 * GForge Survey Facility
 *
 * Portions Copyright 1999-2001 (c) VA Linux Systems
 * The rest Copyright 2002-2004 (c) GForge Team
 * http://gforge.org/
 *
 * @version   $Id$
 *
 * This file is part of GForge.
 *
 * GForge is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * GForge is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
function ShowResultsEditSurvey($result)
{
    global $group_id;
    $rows = db_NumRows($result);
    $cols = db_NumFields($result);
    echo "<h3>" . sprintf(ngettext('%1$s survey found', '%1$s surveys found', $rows), $rows) . "</h3>";
    if ($rows > 0) {
        echo "<table border=\"0\">\n";
        /*  Create  the  headers  */
        echo "<tr class=\"tableheading\">\n";
        for ($i = 0; $i < $cols; $i++) {
            echo "<th>" . db_fieldname($result, $i) . "</th>\n";
        }
        echo "</tr>";
        for ($j = 0; $j < $rows; $j++) {
            echo "<tr class=\".{$HTML->boxGetAltRowStyle}({$j})\">\n";
            echo "<td><a href=\"edit_survey.php?group_id={$group_id}&amp;survey_id=" . db_result($result, $j, 0) . "\">" . db_result($result, $j, 0) . "</a></td>";
            for ($i = 1; $i < $cols; $i++) {
                echo "<td>" . db_result($result, $j, $i) . "</td>\n";
            }
            echo "</tr>";
        }
        echo "</table>";
    }
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:50,代码来源:survey_utils.php

示例2: db_getfieldslist

function db_getfieldslist($strSQL)
{
	global $conn;
	$res=array();
	$rs=db_query($strSQL,$conn);
	for($i=0;$i<db_numfields($rs);$i++)
	{
		$res[$i]=array("fieldname"=>db_fieldname($rs,$i),"type"=>202,"is_nullable"=>0);
	}
	return $res;
}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:11,代码来源:dbinfo.sqlite3.php

示例3: db_getfieldslist

function db_getfieldslist($strSQL)
{
	global $conn;
	$res=array();
	$rs=db_query($strSQL,$conn);
	for($i=0;$i<db_numfields($rs);$i++)
	{
		$ntype=$rs->Fields[$i]->Type;
		$res[$i]=array("fieldname"=>db_fieldname($rs,$i),"type"=>$ntype,"not_null"=>0);
	}
	return $res;
}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:12,代码来源:dbinfo.mssql.php

示例4: db_getfieldslist

function db_getfieldslist($strSQL)
{
	global $conn;
	$res=array();
	$rs=db_query($strSQL,$conn);
	for($i=0;$i<db_numfields($rs);$i++)
	{
		$stype=mysql_field_type($rs,$i);
		if($stype=="blob")
		{
			$flags=mysql_field_flags($rs,$i);
			if(strpos($flags,"binary")===false)
				$stype="text";
		}

		$ntype=db_fieldtypenum($stype);
		$arr=mysql_fetch_field($rs,$i);
		$res[$i]=array("fieldname"=>db_fieldname($rs,$i),"type"=>$ntype,"not_null"=>0);
	}
	return $res;
}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:21,代码来源:dbinfo.my.mysql.php

示例5: ShowResultComments

function ShowResultComments($result)
{
    global $survey_id;
    $rows = db_numrows($result);
    $cols = db_numfields($result);
    echo "<h3>{$rows} Found</h3>";
    echo "<table border=\"0\">\n";
    /*  Create  the  headers  */
    echo "<tr class=\"tableheading\">\n";
    for ($i = 0; $i < $cols; $i++) {
        echo "<th>" . db_fieldname($result, $i) . "</th>\n";
    }
    echo "</tr>";
    for ($j = 0; $j < $rows; $j++) {
        echo "<tr class=\"" . $HTML->boxGetAltRowStyle($j) . "\">\n";
        for ($i = 0; $i < $cols; $i++) {
            echo "<td>" . db_result($result, $j, $i) . "</td>\n";
        }
        echo "</tr>";
    }
    echo "</table>";
    //</td></tr></table>";
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:23,代码来源:show_results_comments.php

示例6: ShowResultsEditQuestion

function ShowResultsEditQuestion($result)
{
    global $group_id;
    $rows = db_numrows($result);
    $cols = db_numfields($result);
    echo "<h3>" . sprintf(ngettext('%1$s question found', '%1$s questions found', $rows), $rows) . "</h3>";
    echo "<table border=\"0\">\n";
    /*  Create  the  headers  */
    echo "<tr class=\"tableheading\">\n";
    for ($i = 0; $i < $cols; $i++) {
        echo "<th>" . db_fieldname($result, $i) . "</th>\n";
    }
    echo "</tr>";
    for ($j = 0; $j < $rows; $j++) {
        echo "<tr " . $GLOBALS['HTML']->boxGetAltRowStyle($j) . ">\n";
        echo "<td><a href=\"edit_question.php?group_id={$group_id}&amp;question_id=" . db_result($result, $j, "question_id") . "\">" . db_result($result, $j, "question_id") . "</a></td>\n";
        for ($i = 1; $i < $cols; $i++) {
            echo "<td>" . db_result($result, $j, $i) . "</td>\n";
        }
        echo "</tr>";
    }
    echo "</table>";
    //</td></tr></table>");
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:24,代码来源:show_questions.php

示例7: getFieldNamesByHeaders

function getFieldNamesByHeaders($fields)
{
    global $strTableName, $conn, $strOriginalTableName, $ext;
    // check fields in column headers
    // check that we have labes in column headers
    $fieldsNotFoundArr = array();
    $fNamesArr = array();
    $fNamesFromQuery = GetFieldsList($strTableName);
    $fieldLabelError = false;
    $labelFieldsNotFoundArr = array();
    for ($j = 0; $j < count($fields); $j++) {
        $labelNotFound = true;
        for ($i = 0; $i < count($fNamesFromQuery); $i++) {
            if ($ext == ".CSV") {
                $label = GoodFieldName($fNamesFromQuery[$i]);
            } else {
                $label = GetFieldLabel(GoodFieldName($strTableName), GoodFieldName($fNamesFromQuery[$i]));
            }
            if ($fields[$j] == $label) {
                $fNamesArr[$j] = $fNamesFromQuery[$i];
                $labelNotFound = false;
                break;
            }
        }
        if ($labelNotFound) {
            $fieldLabelError = true;
            $labelFieldsNotFoundArr[] = $fields[$j];
        }
    }
    // if field names are not labels, than compare them with fields from query
    $fieldsListError = false;
    $queryFieldsNotFoundArr = array();
    if ($fieldLabelError) {
        $fieldFromListNotFound = true;
        $fNamesArr = array();
        for ($j = 0; $j < count($fields); $j++) {
            $fieldNotFound = true;
            for ($i = 0; $i < count($fNamesFromQuery); $i++) {
                if ($fields[$j] == $fNamesFromQuery[$i]) {
                    $fNamesArr[$j] = $fNamesFromQuery[$i];
                    $fieldNotFound = false;
                    $fieldFromListNotFound = false;
                    break;
                }
            }
            if ($fieldNotFound) {
                $fieldsListError = true;
                $queryFieldsNotFoundArr[] = $fields[$j];
            }
        }
    }
    // if field list not lables or fields from query, than compare fields from DB
    $fieldsDbError = false;
    $dbFieldsNotFoundArr = array();
    if ($fieldLabelError && $fieldsListError) {
        $fNamesArr = array();
        $strSQL = "select * from " . AddTableWrappers($strOriginalTableName);
        $rs = db_query($strSQL, $conn);
        $dbFieldNum = db_numfields($rs);
        for ($j = 0; $j < count($fields); $j++) {
            $fieldFromDBNotFound = true;
            for ($i = 0; $i < $dbFieldNum; $i++) {
                $fNameFromDB = db_fieldname($rs, $i);
                if ($fields[$j] == $fNameFromDB) {
                    $fNamesArr[$j] = $fNameFromDB;
                    $fieldFromDBNotFound = false;
                    break;
                }
            }
            if ($fieldFromDBNotFound) {
                $fieldsDbError = true;
                $dbFieldsNotFoundArr[] = $fields[$j];
            }
        }
    }
    // if fields are not labels, fields from list and fields from table
    if ($fieldLabelError && $fieldsListError && $fieldsDbError) {
        if (count($labelFieldsNotFoundArr) < count($dbFieldsNotFoundArr) && count($labelFieldsNotFoundArr) < count($queryFieldsNotFoundArr)) {
            $fieldsNotFoundArr = $labelFieldsNotFoundArr;
        } elseif (count($dbFieldsNotFoundArr) < count($labelFieldsNotFoundArr) && count($dbFieldsNotFoundArr) < count($queryFieldsNotFoundArr)) {
            $fieldsNotFoundArr = $dbFieldsNotFoundArr;
        } elseif (count($queryFieldsNotFoundArr) < count($labelFieldsNotFoundArr) && count($queryFieldsNotFoundArr) < count($dbFieldsNotFoundArr)) {
            $fieldsNotFoundArr = $queryFieldsNotFoundArr;
        } elseif (count($queryFieldsNotFoundArr) == count($labelFieldsNotFoundArr) && count($queryFieldsNotFoundArr) == count($dbFieldsNotFoundArr)) {
            $fieldsNotFoundArr = $dbFieldsNotFoundArr;
        }
        echo "Import didn't succeed, couldn't find followind fields: " . implode(", ", $fieldsNotFoundArr);
        exit;
    } else {
        return $fNamesArr;
    }
}
开发者ID:samsulpendis,项目名称:Instant_Appointment,代码行数:92,代码来源:Readings_import.php

示例8: ShowResultSet

/**
 * ShowResultSet() - Show a generic result set
 * Very simple, plain way to show a generic result set
 *
 * @param	int		The result set ID
 * @param	string	The title of the result set
 * @param	bool	The option to turn URL's into links
 * @param	bool	The option to display headers
 * @param	array	The db field name -> label mapping
 * @param	array   Don't display these cols
 *
 */
function ShowResultSet($result, $title = '', $linkify = false, $displayHeaders = true, $headerMapping = array(), $excludedCols = array())
{
    global $group_id, $HTML;
    if ($result) {
        $rows = db_numrows($result);
        $cols = db_numfields($result);
        echo '<table border="0" width="100%">';
        /*  Create  the  headers  */
        $headersCellData = array();
        $colsToKeep = array();
        for ($i = 0; $i < $cols; $i++) {
            $fieldName = db_fieldname($result, $i);
            if (in_array($fieldName, $excludedCols)) {
                continue;
            }
            $colsToKeep[] = $i;
            if (isset($headerMapping[$fieldName])) {
                if (is_array($headerMapping[$fieldName])) {
                    $headersCellData[] = $headerMapping[$fieldName];
                } else {
                    $headersCellData[] = array($headerMapping[$fieldName]);
                }
            } else {
                $headersCellData[] = array($fieldName);
            }
        }
        /*  Create the title  */
        if (strlen($title) > 0) {
            $titleCellData = array();
            $titleCellData[] = array($title, 'colspan="' . count($headersCellData) . '"');
            echo $HTML->multiTableRow('', $titleCellData, TRUE);
        }
        /* Display the headers */
        if ($displayHeaders) {
            echo $HTML->multiTableRow('', $headersCellData, TRUE);
        }
        /*  Create the rows  */
        for ($j = 0; $j < $rows; $j++) {
            echo '<tr ' . $HTML->boxGetAltRowStyle($j) . '>';
            for ($i = 0; $i < $cols; $i++) {
                if (in_array($i, $colsToKeep)) {
                    if ($linkify && $i == 0) {
                        $link = '<a href="' . getStringFromServer('PHP_SELF') . '?';
                        $linkend = '</a>';
                        if ($linkify == "bug_cat") {
                            $link .= 'group_id=' . $group_id . '&amp;bug_cat_mod=y&amp;bug_cat_id=' . db_result($result, $j, 'bug_category_id') . '">';
                        } else {
                            if ($linkify == "bug_group") {
                                $link .= 'group_id=' . $group_id . '&amp;bug_group_mod=y&amp;bug_group_id=' . db_result($result, $j, 'bug_group_id') . '">';
                            } else {
                                if ($linkify == "patch_cat") {
                                    $link .= 'group_id=' . $group_id . '&amp;patch_cat_mod=y&amp;patch_cat_id=' . db_result($result, $j, 'patch_category_id') . '">';
                                } else {
                                    if ($linkify == "support_cat") {
                                        $link .= 'group_id=' . $group_id . '&amp;support_cat_mod=y&amp;support_cat_id=' . db_result($result, $j, 'support_category_id') . '">';
                                    } else {
                                        if ($linkify == "pm_project") {
                                            $link .= 'group_id=' . $group_id . '&amp;project_cat_mod=y&amp;project_cat_id=' . db_result($result, $j, 'group_project_id') . '">';
                                        } else {
                                            $link = $linkend = '';
                                        }
                                    }
                                }
                            }
                        }
                    } else {
                        $link = $linkend = '';
                    }
                    echo '<td>' . $link . db_result($result, $j, $i) . $linkend . '</td>';
                }
            }
            echo '</tr>';
        }
        echo '</table>';
    } else {
        echo db_error();
    }
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:90,代码来源:utils.php

示例9: ShowResultSet

function ShowResultSet($result, $title = "Untitled", $linkify = false, $showheaders = true)
{
    global $group_id, $HTML;
    /*
    	Very simple, plain way to show a generic result set
    	Accepts a result set and title
    	Makes certain items into HTML links
    */
    if ($result) {
        $rows = db_numrows($result);
        $cols = db_numfields($result);
        echo '
			<TABLE BORDER="0" WIDTH="100%">';
        /*  Create the title  */
        echo '
		<TR class="boxtitle">
		<TD COLSPAN="' . $cols . '" class="boxitem"><B>' . $title . '</B></TD></TR>';
        if ($showheaders) {
            /*  Create  the  headers  */
            echo '<tr>';
            for ($i = 0; $i < $cols; $i++) {
                echo '<td><B>' . db_fieldname($result, $i) . '</B></TD>';
            }
            echo '</tr>';
        }
        /*  Create the rows  */
        for ($j = 0; $j < $rows; $j++) {
            echo '<TR class="' . html_get_alt_row_color($j + 1) . '">';
            for ($i = 0; $i < $cols; $i++) {
                if ($linkify && $i == 0) {
                    $link = '<A HREF="?';
                    $linkend = '</A>';
                    if ($linkify == "bug_cat") {
                        $link .= 'group_id=' . $group_id . '&bug_cat_mod=y&bug_cat_id=' . db_result($result, $j, 'bug_category_id') . '">';
                    } else {
                        if ($linkify == "bug_group") {
                            $link .= 'group_id=' . $group_id . '&bug_group_mod=y&bug_group_id=' . db_result($result, $j, 'bug_group_id') . '">';
                        } else {
                            if ($linkify == "patch_cat") {
                                $link .= 'group_id=' . $group_id . '&patch_cat_mod=y&patch_cat_id=' . db_result($result, $j, 'patch_category_id') . '">';
                            } else {
                                if ($linkify == "support_cat") {
                                    $link .= 'group_id=' . $group_id . '&support_cat_mod=y&support_cat_id=' . db_result($result, $j, 'support_category_id') . '">';
                                } else {
                                    if ($linkify == "pm_project") {
                                        $link .= 'group_id=' . $group_id . '&project_cat_mod=y&project_cat_id=' . db_result($result, $j, 'group_project_id') . '">';
                                    } else {
                                        $link = $linkend = '';
                                    }
                                }
                            }
                        }
                    }
                } else {
                    $link = $linkend = '';
                }
                echo '<td>' . $link . db_result($result, $j, $i) . $linkend . '</td>';
            }
            echo '</tr>';
        }
        echo '</table>';
    } else {
        echo db_error();
    }
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:65,代码来源:utils.php

示例10: getTableColumns

 /**
  * Returns an array of column names and fieldtype for a table.
  * 
  */
 function getTableColumns($table)
 {
     $sql = "SELECT * FROM {$table} LIMIT 1";
     $columnArray = array();
     $v = array();
     $t = array();
     $res = db_prep_query($sql, $v, $t);
     $i = 0;
     while ($i < db_num_fields($res)) {
         if (db_field_type($res, $i) == "varchar") {
             $fieldType = "s";
         } else {
             $fieldType = "i";
         }
         $columnArray[db_fieldname($res, $i)] = $fieldType;
         $i++;
     }
     return $columnArray;
 }
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:23,代码来源:class_administration.php

示例11: admin_table_show

/**
 *	admin_table_show() - display the specified table, sorted by the primary key, with links to add, edit, and delete
 *
 *	@param $table - the table to act on
 *	@param $unit - the name of the "units" described by the table's records
 *	@param $primary_key - the primary key of the table
 */
function admin_table_show($table, $unit, $primary_key)
{
    global $HTML;
    $result = db_query("SELECT * FROM {$table} ORDER BY {$primary_key}");
    if ($result) {
        $rows = db_numrows($result);
        $cols = db_numfields($result);
        $cell_data = array();
        $cell_data[] = array(ucwords(getUnitLabel($unit)) . ' <a href="' . getStringFromServer('PHP_SELF') . '?function=add">[' . _('add new') . ']</a>', 'colspan="' . ($cols + 1) . '"');
        echo '<table border="0" width="100%">';
        echo $HTML->multiTableRow('', $cell_data, TRUE);
        echo '
			<tr><td width="5%"></td>';
        for ($i = 0; $i < $cols; $i++) {
            echo '<td><strong>' . db_fieldname($result, $i) . '</strong></td>';
        }
        echo '</tr>';
        for ($j = 0; $j < $rows; $j++) {
            echo '<tr ' . $HTML->boxGetAltRowStyle($j) . '>';
            $id = db_result($result, $j, 0);
            echo '<td><a href="' . getStringFromServer('PHP_SELF') . '?function=edit&amp;id=' . $id . '">[' . _('Edit') . ']</a>';
            echo '<a href="' . getStringFromServer('PHP_SELF') . '?function=confirmdelete&amp;id=' . $id . '">[' . _('Delete') . ']</a> </td>';
            for ($i = 0; $i < $cols; $i++) {
                echo '<td>' . db_result($result, $j, $i) . '</td>';
            }
            echo '</tr>';
        }
        echo '</table>';
    } else {
        echo db_error();
    }
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:39,代码来源:admin_table.php


注:本文中的db_fieldname函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。