本文整理汇总了PHP中add_db函数的典型用法代码示例。如果您正苦于以下问题:PHP add_db函数的具体用法?PHP add_db怎么用?PHP add_db使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_db函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fill_fields
function fill_fields($item, $brand, $serial, $barcode)
{
global $item;
global $brand;
global $serial;
global $picked_up_test;
global $MESSG;
$barcode = swap_back($barcode);
//if(empty($item)AND isset($item))
//{
$connect = mysql_connect('localhost', 'root', 'krasnal') or die(mysql_error());
mysql_select_db('dbs3');
echo 'empty item';
$sql_get_barcode = "Select * from Barcode Where Barcode='{$barcode}'";
$result = add_db($sql_get_barcode);
if ($item_id = mysql_fetch_array($result, 1)) {
$item_id_1 = $item_id["Item_id_item"];
echo $item_id_1;
$sql_get_item = "SELECT * FROM Item Where id_item='{$item_id_1}'";
$result = add_db($sql_get_item);
if ($res = mysql_fetch_array($result, 1)) {
$item = $res["name"];
$brand = $res["brand"];
$serial = $res["pn"];
$MESSG = 4;
//$picked_up_test=1;
echo $item;
} else {
echo 'Barcode in the system but no item issociated';
}
} else {
//if($_SESSION["bar_last"]!=$barcode)
// { //if item in the system maybe reset settings test
$item = '0';
$brand = '0';
$serial = '0';
$_SESSION["bar_last"] = $barcode;
$MESSG = 2;
// }
}
// }
}
示例2: mysql_fetch_array
$rek_c = mysql_fetch_array($cust);
echo "<tr><td>Transaction Reference</td><td>" . $rek_c["ref_sell_number"] . $rek_c["Buyer_id_Buyer"] . "</td></tr>";
echo "<tr><td>Company</td><td>" . $rek_c["company_name"] . " </td></tr>";
echo "<tr><td>Name</td><td>" . $rek_c["name"] . " </td></tr>";
echo "<tr><td>Surname</td><td>" . $rek_c["surname"] . " </td></tr>";
echo "<tr><td>Address</td><td>" . $rek_c["address"] . "</BR>" . $rek_c["town"] . "</BR>" . $rek_c["postcode"] . "</td></tr>";
?>
</table>
</BR></BR>
<h3>SUMMARY:</h3>
<table style="width: 110px;"><tr><td>Item type</td><td>Quantity sold</td></tr>
<?php
$customer1 = "SELECT Item.name, count(*) as quantity From Barcode_has_Buyer\r\nINNER JOIN Buyer ON Barcode_has_Buyer.Buyer_id_Buyer=Buyer.id_Buyer\r\nINNER JOIN Barcode ON Barcode.id_Barcode=Barcode_has_Buyer.Barcode_id_Barcode\r\nINNER JOIN Item ON Item.id_item=Barcode.Item_id_item\r\nWHERE ref_sell_number='{$ref_sell}' \r\nGROUP BY Item.name ORDER BY Item.name\r\n";
$cust = add_db($customer1);
while ($rek = mysql_fetch_array($cust, MYSQL_BOTH)) {
//changed from 1
$i++;
//if($tab[$rek["id_test"]]<'1')
//{
echo '<tr>';
echo '<td>' . $rek["name"] . '</td>';
echo '<td>' . $rek["quantity"] . '</td>';
//echo '<td>'.$rek["name"].'</td>';
// echo '<td>'.$rek["pn"].'.</td>';
// echo '<td>1</td>';
//echo '<td>'.$rek["sum_weight"].'</td>';
// echo '<td>'.$rek["Name_sub"].'</td>';
echo '</tr>';
//}
示例3: compare_origins
/** functions utilizes basic comparison on origins on tablet device and root system
* @return 1_true Description
*/
function compare_origins()
{
$size_origin_tablet = 0;
$size_origin_root = 0;
global $host_in;
global $host_out;
global $dbs3_in;
global $dbs3_out;
echo $sql = "SELECT * FROM origin";
//$connect=connect_tablet();
$connect = mysql_connect($host_out, 'root', 'krasnal') or die(mysql_error());
mysql_select_db($dbs3_out);
$result = add_db($sql);
$size_origin_tablet = mysql_num_rows($rek);
// mysql_connect()
//connect_dbs3();
//END
$connect = mysql_connect($host_in, 'root', 'krasnal') or die(mysql_error());
mysql_select_db($dbs3_in);
$result = add_db($sql);
$size_origin_root = mysql_num_rows($result);
echo "SIZE TAB " . $size_origin_tablet;
echo "SIZE dbs " . $size_origin_root;
//compare the scope of tablet and root if is different communicate for show manifest
//and start digging out which one is missing. I fount with collection communicate to get it befor manifest import. Manifest import done in transactional mode
if ($size_origin_root == $size_origin_tablet) {
return 0;
} else {
return 1;
}
}
示例4: while
$sql_check_trans = "SELECT * FROM trans_category WHERE name_1='{$att_trans}'";
//$result_check=mysql_query($sql_check_trans) or die(mysql_error());
/*
while ($rek_check= mysql_fetch_array($result_check))
{
echo $rek_check['name_1'];
//here we also can check if doubled
if($rek_check['name_1']==$_POST['batch_date'])
$trans_flag_ch=1;
}
*
*/
$trans_flag_ch = 1;
if ($trans_flag_ch == 1) {
$sql_weight = "UPDATE category SET type_2='" . $weight . "' WHERE id={$name_sub_cat}";
$result = add_db($sql_weight);
}
//$we=mysql_insert_id();
//echo $we;
//$sql_cat_read="SELECT * FROM Category";
//$sql_cat="INSERT INTO Sub_cat(Category_id,Weight_id,Name_sub) Values('$name_cat','$we','$name_sub_cat')";
//$result=add_db($sql_cat);
}
if (isset($_POST['category'])) {
$att_key = $_POST['att_key'];
$insert_sql_att = "INSERT INTO trans_category(Category_id, name_1) VALUES('{$att_key}','{$category}')";
$result_att_in = mysql_query($insert_sql_att) or die(mysql_error());
//$rek_att_in=mysql_fetch_array($result_att_in);
}
}
//AND !empty($_POST['name_sub_cat'])
示例5: mysql_connect
$item = $_POST['item'];
$brand = $_POST['brand'];
$serial = $_POST['serial'];
$pat = $_POST['pat'];
$fun = $_POST['fun'];
$cln = $_POST['cln'];
$vis = $_POST['vis'];
$defect = $_POST['defect'];
$rdy = $_POST['rdy'];
if ($_POST["Cancel"] == "Cancel") {
echo "Cancel";
}
$connect = mysql_connect('localhost', 'root', 'krasnal') or die(mysql_error());
mysql_select_db('dbs3');
$sql = 'SELECT * FROM Item' . ' INNER JOIN Barcode ON Barcode.Item_id_item=Item.id_item' . ' ORDER BY Barcode.date';
$result = add_db($sql);
/*
$tab = array();
for($z=0;$z<=100;$z++)
$tab[$z]=0;
echo $barcode;
//echo $_POST[$idd];
//echo " ";
echo $pat ;
//echo $_POST[$name];
//echo " ";
$d=0;
示例6: category
if (!empty($category)) {
echo $category;
$sql_weight = "INSERT INTO category(type_2,name_cat) Values('0','{$category}')";
$result = add_db($sql_weight);
//$we=mysql_insert_id();
//echo $we;
//$sql_cat_read="SELECT * FROM Category";
//$sql_cat="INSERT INTO Sub_cat(Category_id,Weight_id,Name_sub) Values('$name_cat','$we','$name_sub_cat')";
//$result=add_db($sql_cat);
}
}
//AND !empty($_POST['name_sub_cat'])
if (!empty($_POST['batch_date'])) {
echo $name_sub_cat;
$sql_weight = "Update category SET name_cat='{$weight}' WHERE id='{$name_sub_cat}'";
$result = add_db($sql_weight) or die(mysql_error());
$we = mysql_insert_id();
//echo $we;
$sql_cat_read = "SELECT * FROM Category";
//$sql_cat="INSERT INTO Sub_cat(Category_id,Weight_id,Name_sub) Values('$name_cat','$we','$name_sub_cat')";
//$result=add_db($sql_cat);
}
/**
* $result=add_db($sql_cat_read);
* while($rek=mysql_fetch_array($result))
* {
*
* }
*/
$weight = 0;
$name_sub_cat = 0;
示例7: add_db
}
/*
if(isset($date_to))
{
$sql_date='SELECT * FROM `Test`'
. ' INNER JOIN Barcode ON Test.Barcode_id_Barcode=Barcode.Barcode'
. ' INNER JOIN Pat ON Test.Pat_id_pat=Pat.id_pat '
. ' INNER JOIN Visual ON Test.Visual_id_visual=Visual.id_visual'
. ' INNER JOIN Functional ON Test.Functional_id_fun=Functional.id_fun'
. ' INNER JOIN Cleaning ON Cleaning.id_clean=Test.Cleaning_id_clean '
//. ' INNER JOIN Defect ON Test.id_test=Defect.Test_id_test'
. ' INNER JOIN Item ON Barcode.Item_id_item=Item.id_item WHERE Barcode.date="'.$date_to.'"';
// echo $sql;
}
*/
$result = add_db($sql_date);
/*
$tab = array();
for($z=0;$z<=100;$z++)
$tab[$z]=0;
echo $barcode;
//echo $_POST[$idd];
//echo " ";
echo $pat ;
//echo $_POST[$name];
//echo " ";
$d=0;
示例8: Weight
//$weight=$batch_date;
$name_cat;
$name_sub_cat;
$sql_transaction = "BEGIN\r\nINSERT INTO Weight(weight) \r\n VALUES('{$weight}');\r\n set v_weight_id = last_insert_id();\r\nINSERT INTO Category (name_cat) \r\n VALUES('{$name_cat}');\r\n\r\nINSERT INTO Sub_cat (Category_id, Weight_id) \r\n VALUES(LAST_INSERT_ID(),v_weight_id,'{$name_sub_cat}');\r\n\r\nCOMMIT";
$weight = $_POST['batch_date'];
$name_sub_cat = $_POST['name_sub_cat'];
$name_cat = $_POST['site_location'];
//echo $weight;
if (!empty($_POST['batch_date']) and !empty($_POST['name_sub_cat']) and !empty($_POST['site_location'])) {
$sql_weight = "INSERT INTO Weight(weight) Values('{$weight}')";
$result = add_db($sql_weight);
$we = mysql_insert_id();
//echo $we;
$sql_cat_read = "SELECT * FROM Category";
$sql_cat = "INSERT INTO Sub_cat(Category_id,Weight_id,Name_sub,kind) Values('{$name_cat}','{$we}','{$name_sub_cat}','2')";
$result = add_db($sql_cat);
}
/**
* $result=add_db($sql_cat_read);
* while($rek=mysql_fetch_array($result))
* {
*
* }
*/
$weight = 0;
$name_sub_cat = 0;
unset($weight);
unset($name_sub_cat);
///A place for code of categories
//$result=add_db($sql_subcat);
//if($result)
示例9: show_concat_waste
function show_concat_waste($ref_sell, $price_call)
{
mysql_connect('localhost', 'root', 'krasnal') or die(mysql_error());
mysql_select_db('dbs3') or die(mysql_error());
$customer1 = "SELECT waste_barcode.category,waste_barcode.weight,type_item,count(*) as quantity FROM transaction_waste, waste_barcode,item_has_cat Where waste_barcode.idwaste_barcode=transaction_waste.waste_barcode_idwaste_barcode " . "AND Item_has_cat.id_item_cat=waste_barcode.type_item AND ref_sell_number='{$ref_sell}' GROUP BY type_item ORDER By type_item";
//echo $ref_sell;
$reuse = array();
$cust = add_db($customer1);
$waste_barcode = array();
$waste_barcode_weight = array();
//echo "bf fetch";
while ($rek = mysql_fetch_array($cust, MYSQL_BOTH)) {
//changed from 1
$i++;
//echo " in fetch ";
//if($tab[$rek["id_test"]]<'1')
//{
//here we count unige barcode waste and add to array
$index = $rek['type_item'];
// echo " <BR /> ";
$waste_barcode[$index] += $rek['quantity'];
$waste_barcode_weight[$index] = $rek['weight'] * $rek['quantity'];
//echo '<tr>';
//echo '<td>'.get_item_name($rek['type_item']).'</td>';
// echo '<td>'.$rek["quantity"].'</td>';
// echo '<td>'.$rek["category"].'</td>';
// echo '<td>'.$rek["pn"].'.</td>';
// echo '<td>1</td>';
//echo '<td>'.$rek["sum_weight"].'</td>';
// echo '<td>'.$rek["Name_sub"].'</td>';
//echo '</tr>';
$cat = $rek['category'];
$reuse[$cat] += $rek['weight'] * $rek['quantity'];
//}
//$tab[$rek["id_test"]]+=1;
}
$waste_barcode[3];
$waste_barcode_weight[3];
echo '<form action="sell_item_invoice_waste.php?invoice=1&ref_sell=' . $ref_sell . '" method="POST">';
$weee_reused_waste_qtty = array();
global $sum_rec;
global $qtty_rec;
global $ind_rec;
for ($name_cat = 0; $name_cat < 62; $name_cat++) {
if (($qtty = get_waste_qtty($ref_sell, $name_cat)) > 0) {
echo "<tr>";
echo "<td>";
echo $sum_qtty_recalculate = $qtty + $waste_barcode[$name_cat];
echo " UNIT </td>";
echo "<td>";
echo get_item_name($name_cat);
echo "</td>";
// echo '<td>';
// echo get_weight_qtty($ref_sell, $name_cat)+$waste_barcode_weight[$name_cat];
// echo "</td>";
// echo "<td>".$name_cat."</td>";
echo "<td>" . $sum_qtty_recalculate . " x </td>";
// echo $sum_rec[$name_cat];
echo "<input type='hidden' name='qtty_rec" . $name_cat . "' value='" . $sum_qtty_recalculate . "'>";
echo "<td><input type='text' name='price" . $name_cat . "' value='" . $ind_rec[$name_cat] . "' placeholder='Individual price'></td>";
if ($sum_rec[$name_cat] > 0) {
echo "<td> <b>Price Set:</b> <BR/>" . $sum_rec[$name_cat] . " Pounds</td>";
}
echo "</tr>";
$sum_qtty = get_weight_qtty($ref_sell, $name_cat);
+$waste_barcode[$name_cat];
$cat = get_cat($name_cat);
$weee_reused_waste_qtty[$cat] += get_weight_qtty($ref_sell, $name_cat);
} else {
$customer1 = "SELECT waste_barcode.category,waste_barcode.weight,type_item,count(*) as quantity FROM transaction_waste, waste_barcode,item_has_cat Where waste_barcode.idwaste_barcode=transaction_waste.waste_barcode_idwaste_barcode " . "AND Item_has_cat.id_item_cat=waste_barcode.type_item AND ref_sell_number='{$ref_sell}' AND type_item='{$name_cat}' GROUP BY type_item ORDER By type_item";
$cust = add_db($customer1);
while ($rek = mysql_fetch_array($cust, MYSQL_BOTH)) {
$i++;
//if($tab[$rek["id_test"]]<'1')
//{
//here we count unige barcode waste and add to array
if ($rek['quantity'] > 0) {
$qtty_indiv = $rek["quantity"];
$index = $rek['type_item'];
$waste_barcode_weight[$index] = $rek['weight'] * $rek['quantity'];
// echo " <BR /> ";
//$waste_barcode[$index]+=$rek['quantity'];
// $waste_barcode_weight[$index]=$rek['weight']*$rek['quantity'];
echo '<tr>';
echo '<td>' . $rek["quantity"] . ' Unit</td>';
echo '<td>' . get_item_name($rek['type_item']) . '</td>';
// echo '<td>'.$waste_barcode_weight[$index]
// .'</td>';
// echo '<td>'.$rek["category"].'</td>';
// echo '<td>'.$rek["pn"].'.</td>';
// echo '<td>1</td>';
//echo '<td>'.$rek["sum_weight"].'</td>';
// echo '<td>'.$rek["Name_sub"].'</td>';
echo "<td>" . $qtty_indiv . " x </td>";
echo "<input type='hidden' name='qtty_rec" . $name_cat . "' value='" . $qtty_indiv . "'>";
echo "<td><input type='text' name='price" . $name_cat . "' value='" . $ind_rec[$name_cat] . "' placeholder='Individual price'></td>";
if ($sum_rec[$name_cat] > 0) {
echo "<td> <b>Price Set:</b> <BR/>" . $sum_rec[$name_cat] . " Pounds</td>";
}
echo '</tr>';
//.........这里部分代码省略.........
示例10: add_db
<tr><td>Quantity</td><td>Item Type Collected</td><td>STANDARD Weight Assesment</td><td>Active</td><td>ASSIGN NR</td><td>Date Weight ASSIGNMET MADE</td><td>Cat. Assignment</td></tr>
<?php
//if(isset($_SESSION['assign_number_dctv'])) //this modul is for creation of new active weight range
if (isset($_GET['CHG']) > 0) {
//each time we check if sesion var is set. This if no change once set shall be carry on inf.
//lets give it by get once
//We deactivate items by category / group of assignment number. If deactivate button is clicked
//than sesion is set untill it is unset by clicking create button
//here w store seesion assign number of group of items that must be deset as tmp1. We take results from item and item cat
// where asiign number is set
//$old_as1=$_SESSION['assign_number_dctv'];
$old_as1 = $_GET['CHG'];
$sql_item_not_as12 = "SELECT name,weight,active,assign_nr,cat FROM item_has_cat INNER JOIN Item ON Item.Item_has_Cat_id_item_cat=Item_has_cat.id_item_cat Where assign_nr='{$old_as1}' ";
//site id
$result_sub12 = add_db($sql_item_not_as12);
$rek_12 = mysql_fetch_array($result_sub12);
$old_as = rand();
//here we generate unique assignment number by taking old date and some random set
echo '<tr><td></td>';
//thus we take only once since but many items on one assign?
echo '<td>' . $rek_12["name"] . '</td>';
echo '<td>' . $rek_12["weight"] . '</td>';
echo '<td>' . $rek_12["active"] . '</td>';
echo '<td>' . $rek_12["assign_nr"] . '</td>';
// echo '<td>'.$rek["assign_nr"].'</td>';
echo '<td>' . $rek_12["date"] . '</td>';
echo '<td>' . $rek_12["cat"] . '</td>';
// echo '<td>'.$rek["Sub_cat_id_c"].'</td>';
//echo '<td>'.$rek["sum_weight"].'</td>';
// echo '<td>'.$rek["Name_sub"].'</td>';
示例11: show_concat_waste_swaped
function show_concat_waste_swaped($ref_sell)
{
mysql_connect('localhost', 'root', 'krasnal') or die(mysql_error());
mysql_select_db('dbs3') or die(mysql_error());
$customer1 = "SELECT waste_barcode.category,waste_barcode.weight,type_item,count(*) as quantity FROM transaction_waste, waste_barcode,item_has_cat Where waste_barcode.idwaste_barcode=transaction_waste.waste_barcode_idwaste_barcode " . "AND Item_has_cat.id_item_cat=waste_barcode.type_item AND ref_sell_number='{$ref_sell}' GROUP BY type_item ORDER By type_item";
//echo $ref_sell;
$reuse = array();
$cust = add_db($customer1);
$waste_barcode = array();
$waste_barcode_weight = array();
//echo "bf fetch";
while ($rek = mysql_fetch_array($cust, MYSQL_BOTH)) {
//changed from 1
$i++;
//echo " in fetch ";
//if($tab[$rek["id_test"]]<'1')
//{
//here we count unige barcode waste and add to array
$index = $rek['type_item'];
// echo " <BR /> ";
$waste_barcode[$index] += $rek['quantity'];
$waste_barcode_weight[$index] = $rek['weight'] * $rek['quantity'];
//echo '<tr>';
//echo '<td>'.get_item_name($rek['type_item']).'</td>';
// echo '<td>'.$rek["quantity"].'</td>';
// echo '<td>'.$rek["category"].'</td>';
// echo '<td>'.$rek["pn"].'.</td>';
// echo '<td>1</td>';
//echo '<td>'.$rek["sum_weight"].'</td>';
// echo '<td>'.$rek["Name_sub"].'</td>';
//echo '</tr>';
$cat = $rek['category'];
$reuse[$cat] += $rek['weight'] * $rek['quantity'];
//}
//$tab[$rek["id_test"]]+=1;
}
$waste_barcode[3];
$waste_barcode_weight[3];
$weee_reused_waste_qtty = array();
for ($name_cat = 0; $name_cat < 62; $name_cat++) {
if (($qtty = get_waste_qtty($ref_sell, $name_cat)) > 0) {
echo "<tr>";
echo "<td>";
echo get_item_name($name_cat);
echo "</td>";
echo "<td>";
echo $qtty + $waste_barcode[$name_cat];
echo " UNIT </td>";
// echo '<td>';
// echo get_weight_qtty($ref_sell, $name_cat)+$waste_barcode_weight[$name_cat];
// echo "</td>";
// echo "<td>".$name_cat."</td>";
echo "</tr>";
$sum_qtty = get_weight_qtty($ref_sell, $name_cat);
+$waste_barcode[$name_cat];
$cat = get_cat($name_cat);
$weee_reused_waste_qtty[$cat] += get_weight_qtty($ref_sell, $name_cat);
} else {
$customer1 = "SELECT waste_barcode.category,waste_barcode.weight,type_item,count(*) as quantity FROM transaction_waste, waste_barcode,item_has_cat Where waste_barcode.idwaste_barcode=transaction_waste.waste_barcode_idwaste_barcode " . "AND Item_has_cat.id_item_cat=waste_barcode.type_item AND ref_sell_number='{$ref_sell}' AND type_item='{$name_cat}' GROUP BY type_item ORDER By type_item";
$cust = add_db($customer1);
while ($rek = mysql_fetch_array($cust, MYSQL_BOTH)) {
$i++;
//if($tab[$rek["id_test"]]<'1')
//{
//here we count unige barcode waste and add to array
if ($rek['quantity'] > 0) {
$index = $rek['type_item'];
$waste_barcode_weight[$index] = $rek['weight'] * $rek['quantity'];
// echo " <BR /> ";
//$waste_barcode[$index]+=$rek['quantity'];
// $waste_barcode_weight[$index]=$rek['weight']*$rek['quantity'];
echo '<tr>';
echo '<td>' . get_item_name($rek['type_item']) . '</td>';
echo '<td>' . $rek["quantity"] . ' UNIT</td>';
// echo '<td>'.$waste_barcode_weight[$index]
// .'</td>';
// echo '<td>'.$rek["category"].'</td>';
// echo '<td>'.$rek["pn"].'.</td>';
// echo '<td>1</td>';
//echo '<td>'.$rek["sum_weight"].'</td>';
// echo '<td>'.$rek["Name_sub"].'</td>';
echo '</tr>';
// $cat=$rek['category'];
// $reuse[$cat]+=$rek['weight'] * $rek['quantity'];
//}
}
//$tab[$rek["id_test"]]+=1;
}
}
}
}
示例12: add_db
<?php
require 'config.php';
require 'index.php';
if (isset($_POST["dbname"])) {
add_db($db);
} else {
echo "Veuillez entrer un nom pour la base de données.";
}
?>
<div id="createform" class="form tohide">
<h5>Créer une nouvelle base de données</h5>
<form action="form.php" method="post">
<label for="dbname">Nom</label>
<input name="dbname" type="text"></input>
<input name ="submit" type="submit" value="Créer">
</form>
</div>
示例13: elseif
print $error;
exit;
} elseif (!$name) {
/* should never reach here. */
print "Internal Error. Please go back and reload the page.";
exit;
}
/*
* check for user being in the db already. If so drop user and
* recreate.
*/
if (check_user($name)) {
del_user($name);
}
add_user($name, $pass);
add_db($db_name, $name);
$i_added = make_string_added_to_db($name, $db_name);
print "{$i_added} {$back}";
} elseif ($name) {
/* Adding a user to the database. */
$userinfo = posix_getpwnam($name);
$fname = $userinfo['gecos'];
$uinfo = "{$name} - {$fname} ";
$html = print_form($user_in_db, $uinfo, $name, $password_notice);
print $html;
} else {
print "{$welcome}";
}
?>
<p id="copyright">Copyright © <a href="http://www.gnu.org/licenses/gpl-2.0.html" target="_top">GPLv2</a> 2011 <a href="mailto:nmoureyii@ne.rr.com">Nathan A. Mourey II</a></p>
</body>