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


PHP dbFetchAssoc函数代码示例

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


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

示例1: deletesubTopic

function deletesubTopic()
{
    if (isset($_GET['TopicId']) && (int) $_GET['TopicId'] > 0) {
        $TopicId = (int) $_GET['TopicId'];
    } else {
        header('Location: index.php');
    }
    // remove any references to this Topic from
    // tbl_order_item and tbl_cart
    $sql = "DELETE FROM tbl_order_item\r\n\t        WHERE pd_id = {$TopicId}";
    dbQuery($sql);
    $sql = "DELETE FROM tbl_cart\r\n\t        WHERE pd_id = {$TopicId}";
    dbQuery($sql);
    // get the image name and thumbnail
    $sql = "SELECT pd_image, pd_thumbnail\r\n\t        FROM tbl_Topic\r\n\t\t\tWHERE pd_id = {$TopicId}";
    $result = dbQuery($sql);
    $row = dbFetchAssoc($result);
    // remove the Topic image and thumbnail
    if ($row['pd_image']) {
        unlink(SRV_ROOT . 'images/Topic/' . $row['pd_image']);
        unlink(SRV_ROOT . 'images/Topic/' . $row['pd_thumbnail']);
    }
    // remove the Topic from database;
    $sql = "DELETE FROM tbl_Topic \r\n\t        WHERE pd_id = {$TopicId}";
    dbQuery($sql);
    header('Location: index.php?catId=' . $_GET['catId']);
}
开发者ID:findcomrade,项目名称:facebookchalobe,代码行数:27,代码来源:processsubTopics.php

示例2: getShopConfig

function getShopConfig()
{
    // get current configuration
    $sql = "SELECT sc_name, sc_address, sc_phone, sc_email, sc_shipping_cost, sc_order_email, cy_symbol \r\n\t\t\tFROM tbl_shop_config sc, tbl_currency cy\r\n\t\t\tWHERE sc_currency = cy_id";
    $result = dbQuery($sql);
    $row = dbFetchAssoc($result);
    if ($row) {
        extract($row);
        $shopConfig = array('name' => $sc_name, 'address' => $sc_address, 'phone' => $sc_phone, 'email' => $sc_email, 'sendOrderEmail' => $sc_order_email, 'shippingCost' => $sc_shipping_cost, 'currency' => $cy_symbol);
    } else {
        $shopConfig = array('name' => '', 'address' => '', 'phone' => '', 'email' => '', 'sendOrderEmail' => '', 'shippingCost' => '', 'currency' => '');
    }
    return $shopConfig;
}
开发者ID:findcomrade,项目名称:facebookchalobe,代码行数:14,代码来源:common.php

示例3: doLogin

function doLogin()
{
    // if we found an error save the error message in this variable
    $errorMessage = '';
    $userName = $_POST['txtUserName'];
    $password = $_POST['txtPassword'];
    //	  $_SESSION['user_id'] = $username;
    // first, make sure the username & password are not empty
    if ($userName == '') {
        $errorMessage = 'You must enter your username';
    } else {
        if ($password == '') {
            $errorMessage = 'You must enter the password';
        } else {
            // check the database and see if the username and password combo do match
            $sql = "SELECT user_id,user_name\n\t\t        FROM tbl_user \n\t\t\t\tWHERE user_name = '{$userName}' AND user_password = '{$password}'";
            $result = dbQuery($sql);
            if (dbNumRows($result) == 1) {
                $row = dbFetchAssoc($result);
                $_SESSION['user_id'] = $row['user_id'];
                $_SESSION['user_name'] = $row['user_name'];
                // log the time when the user last login
                $sql = "UPDATE tbl_user \n\t\t\t        SET user_last_login = NOW() \n\t\t\t\t\tWHERE user_id = '{$row['user_id']}'";
                dbQuery($sql);
                // now that the user is verified we move on to the next page
                // if the user had been in the admin pages before we move to
                // the last page visited
                $row = dbFetchAssoc($result);
                if ($userName == 'admin') {
                    //                            echo $userName;
                    //                            echo'1';
                    header('Location: index.php');
                    exit;
                } else {
                    if ($row['user_level'] == 0) {
                        //                            echo $userName;
                        //                                     echo'2';
                        header("Location: http://localhost/html/main.php");
                        exit;
                    }
                }
            } else {
                $errorMessage = 'Wrong username or password';
            }
        }
    }
    return $errorMessage;
}
开发者ID:joevanni,项目名称:gallantic-shopping-cart,代码行数:48,代码来源:functions.php

示例4: getProductDetail

function getProductDetail($pdId, $catId)
{
    $_SESSION['shoppingReturnUrl'] = $_SERVER['REQUEST_URI'];
    // get the product information from database
    $sql = "SELECT pd_name, pd_description, pd_price, pd_image, pd_qty\n\t\t\tFROM tbl_product\n\t\t\tWHERE pd_id = {$pdId}";
    $result = dbQuery($sql);
    $row = dbFetchAssoc($result);
    extract($row);
    $row['pd_description'] = nl2br($row['pd_description']);
    if ($row['pd_image']) {
        $row['pd_image'] = WEB_ROOT . 'images/product/' . $row['pd_image'];
    } else {
        $row['pd_image'] = WEB_ROOT . 'images/no-image-large.png';
    }
    $row['cart_url'] = "cart.php?action=add&p={$pdId}";
    return $row;
}
开发者ID:joevanni,项目名称:gallantic-shopping-cart,代码行数:17,代码来源:product-functions.php

示例5: doLogin

function doLogin()
{
    $errorMessage = '';
    $accno = (int) $_POST['accno'];
    $pwd = $_POST['pass'];
    $sql = "SELECT u.fname, u.lname, u.email, u.is_active, u.pics, u.phone,\n\t\t\ta.acc_no, a.user_id, a.pin, a.type, a.status,\n\t\t\tad.address, ad.city, ad.state, ad.zipcode\n\t\t\tFROM tbl_users u, tbl_accounts a, tbl_address ad\n\t\t\tWHERE a.acc_no = {$accno} AND u.pwd = PASSWORD('{$pwd}')\n\t\t\tAND u.id = a.user_id AND ad.user_id = u.id AND u.is_active != 'FALSE'";
    $result = dbQuery($sql);
    if (dbNumRows($result) == 1) {
        $row = dbFetchAssoc($result);
        $_SESSION['hlbank_tmp'] = $row;
        $_SESSION['hlbank_user_name'] = strtoupper($row['fname'] . ' ' . $row['lname']);
        header('Location: pin.php');
        exit;
    } else {
        $errorMessage = 'Your account number or password incorrect or Account is not Active.';
    }
    return $errorMessage;
}
开发者ID:satishverma143,项目名称:demo_project_php,代码行数:18,代码来源:functions.php

示例6: while

    ?>
>
        <span class="oneline" <?php 
    if ($subtopicid == $subt_id) {
        ?>
style="font-weight: bold"<?php 
    }
    ?>
>
        <font size="1.5" face="verdana" >
            <?php 
    echo $name;
    ?>
</font></span></a>
            <?php 
    while ($row1 = dbFetchAssoc($result1)) {
        extract($row1);
        $surl = "index.php?&c=" . encrypt($course) . "&su=" . encrypt($subuniversity) . "&st=" . encrypt($subt_id);
        $subtopic_storage[$subt_id] = array('name' => $name, 'subt_id' => $subt_id, 'url' => $surl, 'next' => '');
        if ($flag != 0) {
            $subtopic_storage[$flag]['next'] = $subt_id;
            $flag = 0;
        }
        if ($subtopicid == $subt_id) {
            $flag = $subt_id;
        }
        ?>
        
    <a class="subtopics lefttitle" title="<?php 
        echo $name;
        ?>
开发者ID:findcomrade,项目名称:facebookchalobe,代码行数:31,代码来源:leftNavv.php

示例7: _deleteImage

function _deleteImage($catId)
{
    // we will return the status
    // whether the image deleted successfully
    $deleted = false;
    // get the image(s)
    $sql = "SELECT cat_image \n            FROM tbl_category\n            WHERE cat_id ";
    if (is_array($catId)) {
        $sql .= " IN (" . implode(',', $catId) . ")";
    } else {
        $sql .= " = {$catId}";
    }
    $result = dbQuery($sql);
    if (dbNumRows($result)) {
        while ($row = dbFetchAssoc($result)) {
            // delete the image file
            $deleted = @unlink(SRV_ROOT . CATEGORY_IMAGE_DIR . $row['cat_image']);
        }
    }
    return $deleted;
}
开发者ID:joevanni,项目名称:gallantic-shopping-cart,代码行数:21,代码来源:processCategory.php

示例8: catch

    $objReader = PHPExcel_IOFactory::createReader($inputFileType);
    $objReader->setReadDataOnly(true);
    $objReader->setLoadSheetsOnly("MERVEN");
    $objPHPExcel = $objReader->load($inputFileName);
} catch (Exception $e) {
    die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage());
}
/*
    PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
    $cacheSettings = array( 'memoryCacheSize' => '1024MB');
    PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings); 
*/
//  Get worksheet dimensions
$arts = "SELECT count(id) as cant FROM articulo WHERE active = 1";
$arts1 = dbQuery($arts);
$arts2 = dbFetchAssoc($arts1);
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();
PHPExcel_Calculation::getInstance($objPHPExcel)->cyclicFormulaCount = 1;
//$objReader->setPreCalculateFormulas(FALSE);
$i = 1;
//$arts2['cant']
/*while($i < 10){
    $value = $objPHPExcel->getSheetByName("MERVEN")->getCell('F'.$i)->getCalculatedValue();
    if( $value == 'OBS:'){
        break;
    }else{
        $i++;
        echo  '         Valor loco: '. $i.'<br>';        
    } 
开发者ID:axeljosue12,项目名称:disgene,代码行数:31,代码来源:get_precio.php

示例9: now

                $i .= "fecha_modifica = now(), ";
                $i .= "usuario_id = $usuario_id ";
                $i .= " WHERE articulo_id = $articulo  AND active = 1";
                //echo $i;
                $i1 = dbQuery($i);
                */
                //aqui es salida ya que de la bodega "A" se pasa a la bodega "B"
                //SAL = SALIDA, MBD = Movimiento Bodegas
                $di = "INSERT INTO inventario_d (";
                $di .= "articulo_id, bodega_id, tipo, cantidad, motivo, bodega_origen_id, bodega_destino_id, fecha_alta, usuario_id )";
                $di .= " VALUES ({$articulo}, {$bodega},'SAL',{$cantidad},'MBD', {$bodega},{$bodega_destino},now(),{$usuario_id})";
                dbQuery($di);
                //aqui es entrada ya que la bodega "B" recibe producto de la bodega "A"
                //SAL = SALIDA, MBD = Movimiento Bodegas
                $di = "INSERT INTO inventario_d (";
                $di .= "articulo_id, bodega_id, tipo, cantidad, motivo, bodega_origen_id, bodega_destino_id, fecha_alta, usuario_id )";
                $di .= " VALUES ({$articulo}, {$bodega_destino},'ENT',{$cantidad},'MBD', {$bodega},{$bodega_destino},now(),{$usuario_id})";
                dbQuery($di);
                $r = "exito";
            }
        } else {
            //INSERT
            $r = "fracaso";
        }
        $q = "SELECT * FROM inventario WHERE articulo_id = {$articulo} AND active = 1";
        $q1 = dbQuery($q);
        $q2 = dbNumRows($q1);
        $q3 = dbFetchAssoc($q1);
        echo $r . '|' . $q3['stock'];
        break;
}
开发者ID:axeljosue12,项目名称:disgene,代码行数:31,代码来源:ajax.php

示例10: rand

                    </div>
                </div>

                <div class="panel-body">
                      <div class="row">
                            <div class="col-sm-12 col-md-12 col-lg-12">
                                <?php 
    $id = 50;
    //id pedido
    $id_cliente = 100;
    //100 empieza y llega al  1500
    for ($i = 0; $i <= 1110; $i++) {
        $id_cliente = rand(5, 15);
        $c = "SELECT * FROM cliente WHERE id = {$id_cliente}";
        $c1 = dbQuery($c);
        $c3 = dbFetchAssoc($c1);
        $nit = $c3['nit'];
        $nombre_negocio = $c3['nombre_negocio'];
        $referencia = $c3['refe'];
        $usuario_vendedor_id = $c3['usuario_vendedor_id'];
        $w = "INSERT INTO pedido (";
        $w .= "id,status, cliente_id ,nit,nombre_negocio,refe,usuario_vendedor_id,transporte,municipio,depto,direccion_entrega, zona,";
        $w .= "observacion,fecha_alta,usuario_id,pago,pago_pedido)";
        $w .= " VALUES ({$id},1,{$id_cliente},'nit','{$cliente_negocio}','{$referencia}',{$id_usuario_vendedor},'{$transporte_pedido}',";
        $w .= "{$municipio},{$depto},'{$direccion_pedido}',{$zona},'{$observaciones_pedido}', ";
        $w .= "{$seguro_pedido}, {$flete_pedido}, {$guatex_pedido},{$fecha_alta},{$usuario_id},'{$pago_cliente_pedido}','{$pago_pedido}' ";
        $w .= ")";
    }
    ?>
 
                            </div>
开发者ID:axeljosue12,项目名称:disgene,代码行数:31,代码来源:index.php

示例11: dbQuery

        $nc2 = dbQuery($nc);
        $nc_count = dbNumRows($nc2);
        if ($nc_count > 0) {
            ?>
		Notas De Credito
		<table class="table table-condensed " >
			<thead >
				<th bgcolor="#DAA520">No.</th>
				<th bgcolor="#DAA520">Fecha</th>
				<th bgcolor="#DAA520">Tipo</th>
				<th bgcolor="#DAA520">Total</th>
				
			</thead>
			<tbody>
	<?php 
            while ($row = dbFetchAssoc($nc2)) {
                ?>
			<tr bgcolor="#FFD700">
				<td ><?php 
                echo $row['id'];
                ?>
</td>
				<td><?php 
                echo $row['fa'];
                ?>
</td>
				<td><?php 
                echo $row['tipo'];
                ?>
</td>
				<td class="text-right"><?php 
开发者ID:axeljosue12,项目名称:disgene,代码行数:31,代码来源:ajax.php

示例12: dbQuery

	
	
}
*/
$user = $_POST['inputEmail'];
$password = $_POST['inputPassword'];
//$pass = crypt_blowfish_bydinvaders($password); //usar esto solo para generar passwords
//echo "pass Encriptado: ".$pass;
$passwordenBD = "";
$q = "SELECT * FROM usuario WHERE usuario = '{$user}'";
//echo $q;
$q1 = dbQuery($q);
$q_tot = dbNumRows($q1);
if ($q_tot > 0) {
    $q2 = dbFetchAssoc($q1);
    $_SESSION['id_user'] = $q2['id'];
    //variables de sesion
    $_SESSION['username'] = $q2['usuario'];
    //variables de sesion
    $passwordenBD = $q2['password'];
    if (crypt($password, $passwordenBD) == $passwordenBD) {
        //echo '<br/>Es igual';
        header("Location: modulos.php");
        die;
    } else {
        //echo '<br/> No es igual';
        header("Location: index.php");
        die;
    }
    //echo "<br/>exito";//si existe el usuario
开发者ID:axeljosue12,项目名称:disgene,代码行数:28,代码来源:devolucion_ajax.php

示例13: _deleteImage

function _deleteImage($productId)
{
    // we will return the status
    // whether the image deleted successfully
    $deleted = false;
    $sql = "SELECT pd_image, pd_thumbnail \n\t        FROM tbl_product\n\t\t\tWHERE pd_id = {$productId}";
    $result = dbQuery($sql) or die('Cannot delete product image. ' . mysql_error());
    if (dbNumRows($result)) {
        $row = dbFetchAssoc($result);
        extract($row);
        if ($pd_image && $pd_thumbnail) {
            // remove the image file
            $deleted = @unlink(SRV_ROOT . "images/product/{$pd_image}");
            $deleted = @unlink(SRV_ROOT . "images/product/{$pd_thumbnail}");
        }
    }
    return $deleted;
}
开发者ID:joevanni,项目名称:gallantic-shopping-cart,代码行数:18,代码来源:processProduct.php

示例14: updateCart

function updateCart()
{
    $cartId = $_POST['hidCartId'];
    $productId = $_POST['hidProductId'];
    $itemQty = $_POST['txtQty'];
    $numItem = count($itemQty);
    $numDeleted = 0;
    $notice = '';
    $i = 0;
    for ($i = 0; $i < $numItem; $i++) {
        $newQty = (int) $itemQty[$i];
        if ($newQty < 1) {
            // remove this item from shopping cart
            deleteFromCart($cartId[$i]);
            $numDeleted += 1;
        } else {
            // check current stock
            $sql = "SELECT pd_name, pd_qty\n\t\t\t        FROM tbl_product \n\t\t\t\t\tWHERE pd_id = {$productId[$i]}";
            $result = dbQuery($sql);
            $row = dbFetchAssoc($result);
            if ($newQty > $row['pd_qty']) {
                // we only have this much in stock
                $newQty = $row['pd_qty'];
                // if the customer put more than
                // we have in stock, give a notice
                if ($row['pd_qty'] > 0) {
                    setError('The quantity you have requested is more than we currently have in stock. The number available is indicated in the &quot;Quantity&quot; box. ');
                } else {
                    // the product is no longer in stock
                    setError('Sorry, but the product you want (' . $row['pd_name'] . ') is no longer in stock');
                    // remove this item from shopping cart
                    deleteFromCart($cartId[$i]);
                    $numDeleted += 1;
                }
            }
            // update product quantity
            $sql = "UPDATE tbl_cart\n\t\t\t\t\tSET ct_qty = {$newQty}\n\t\t\t\t\tWHERE ct_id = {$cartId[$i]}";
            dbQuery($sql);
        }
    }
    if ($numDeleted == $numItem) {
        // if all item deleted return to the last page that
        // the customer visited before going to shopping cart
        header("Location: {$returnUrl}" . $_SESSION['shop_return_url']);
    } else {
        header('Location: cart.php');
    }
    exit;
}
开发者ID:joevanni,项目名称:gallantic-shopping-cart,代码行数:49,代码来源:cart-functions.php

示例15: switch

switch ($tab) {
    case 'general':
        ?>
            <tr><td><?php 
        echo translate('Name');
        ?>
</td><td><input type="text" name="newMonitor[Name]" value="<?php 
        echo validHtmlStr($newMonitor['Name']);
        ?>
" size="16"/></td></tr>
            <tr><td><?php 
        echo translate('Server');
        ?>
</td><td>
<?php 
        $servers = dbFetchAssoc('SELECT Id,Name FROM Servers ORDER BY Name', 'Id', 'Name');
        array_unshift($servers, 'None');
        ?>
	<?php 
        echo buildSelect("newMonitor[ServerId]", $servers);
        ?>
</td></tr>
            <tr><td><?php 
        echo translate('SourceType');
        ?>
</td><td><?php 
        echo buildSelect("newMonitor[Type]", $sourceTypes);
        ?>
</td></tr>
            <tr><td><?php 
        echo translate('Function');
开发者ID:jbudding,项目名称:ZoneMinder,代码行数:31,代码来源:monitor.php


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