Etapa Autorización - Condiciones con Query
SELECT DISTINCT 'TRUE' FROM OPOR T0 WHERE T0.Doctype='I' and T0.Docnum =$[$8.1.1]
Estoy tratando de que todos las Ordenes de Compra tipo artículo ingresen a etapa de autorización, pero no logro que me funcione este query, será que alguien me puede dar una mano?
Gracias.
Douglas,
Prueba de esta manera debería funcionarte
Select DISTINCT 'TRUE' FROM OPOR T0 WHERE $[OPOR.DOCTYPE]='I'
Similar Messages
-
¿como ver con query addon conectado/desconectado en tiempo real xusauario?
Encontré estas tablas pero dan información de la configuración de los Add ons instalados,
Definición del ad don en la compañía
SELECT * FROM OARI T0
Registro del Ad don en SBO COMMON :
SELECT * FROM SARI
Definicion de add on en usuarios
SELECT * FROM ARI1
El tema es que requiero apoyo para ver si por medio de un query puedo ver si un ad don esta o no está conectado en tiempo real por determinado usuario.Hola.
El tema de relacionar los usuarios SB1 con las máquinas ha surgido constantemente en los Foros. Aún no hay una solución completa pero hay aproximaciones interesantes que funcionan.
Por favor sigue este link a otro caso donde se habla de esto: Saber en que PC está conectado un usuario a B1.
En cuanto a los add-ons, déjame miro.
Espero sea de ayuda.
Saludos. -
Buenas tardes es que estoy haciendo una consulta y recorriendo el query pero me esta trayendo problemas, entonces lo que quiero es pasar la informacion del query a un array para recorrer el array pero me aparece error al convertir lo stipos de datos??
el error es al tratar de convertir los datos complejos a datos simples.
-
Veran, estoy ejecutando un procedimiento a traves de
DECLARE @INICIO DATETIME
DECLARE @FIN DATETIME
set @INICIO=(SELECT top 1 T0.TaxDate FROM dbo.OINV T0 WHERE T0.TaxDate = '[%0]')
set @FIN=(SELECT top 1 T0.TaxDate FROM dbo.OINV T0 WHERE T0.TaxDate = '[%1]')
EXEC SBOAsisteLibros_Compras_Digital @INICIO, @FIN
Este procedimiento pretende halar ciertos documentos en un rango de fechas, el problema que tengo es que, en el mes de julio me aparecen datos, y en el mes de agosto ya no, luego me vueven a aparecer datos en septiembre
Me podrian decir que estare haciendo mal?
o como puedo solucionarloGracias por tu ayuda. Este es el procedimiento
SELECT Libro + '|' + TipoDocto + '|' + ISNULL(Serie,'0') + '|' + REPLACE(NoDocto,'-','') + '|' +
CONVERT(NVARCHAR, FechaDocto,103) + '|' + NIT + '|' +
REPLACE(Nombre,',','') + '|' + TipoCompra + '|' + '|' +
NoRegistro + '|' + NoCedula + '|||' + CONVERT(NVARCHAR,ca,126) + '|' +
CONVERT(NVARCHAR,sa,126) + '|' + CONVERT(NVARCHAR,cna,126) + '|' + CONVERT(NVARCHAR,sna,126) + '|' +
CONVERT(NVARCHAR,c1,126) + '|' + CONVERT(NVARCHAR,c4,126) + '|' + CONVERT(NVARCHAR,impuesto,126) AS Fila
FROM (
select 'C' Libro, TipoDocto, CASE WHEN Serie = '' THEN '0'
WHEN Serie IS NULL THEN '0'
ELSE Serie
END Serie, NoDocto, FechaDocto,
case when TipoDoctoMaestro <> 'E' then ISNULL(NIT,'0') else '0' end NIT, REPLACE(Nombre,'´','') AS Nombre,
case when TipoDocto = 'DA' then 'I' else 'L' end TipoCompra, '' S1,
case when TipoDoctoMaestro <> 'E' then '0'
else CASE WHEN (substring(NIT2, 0, charindex(' ',NIT2))) = '' THEN '0'
else substring(NIT2, 0, charindex(' ',NIT2)) end
end NoRegistro,
case when TipoDoctoMaestro <> 'E' then '0' else substring(NIT2, charindex(' ',NIT2) + 1, len(NIT2)) end NoCedula,
'' S2, '' S3,
isnull(sum(CA),0.00) CA, isnull(sum(SA),0.00) SA, isnull(sum(CNA),0.00) CNA, isnull(sum(SNA),0.00) SNA, 0.00 C1, 0.00 C4,
isnull(sum(Impuesto),0.00) Impuesto
from (select FechaDocto, case when (TipoDocto = 'FC' and TipoDoctoMaestro = 'E') then 'FE'
when TipoDocto = 'PI' then 'DA' else TipoDocto end TipoDocto,
TipoDoctoMaestro, Serie, NoDocto,
CASE WHEN LEFT(CardCode,1) = 'P' THEN '0'
WHEN LEFT(CardCode,1) = 'C' THEN '0'
ELSE replace(NIT,'-','') END NIT, NIT NIT2, Nombre, Referencia,
case when TipoDoctoDetalle <> 'S' then case when TipoImpuesto = '0' then case when EsIVACreditoFiscal = 'Y' then (ImpuestoLocal/0.12) end else NetoLocal end end CA,
case when TipoDoctoDetalle = 'S' then case when TipoImpuesto = '0' then case when EsIVACreditoFiscal = 'Y' then (ImpuestoLocal/0.12) end else NetoLocal end end SA,
case when (TipoImpuesto in ('0') and TipoDoctoDetalle <> 'S') then NetoLocal end CNA,
case when (TipoImpuesto in ('0') and TipoDoctoDetalle = 'S') then NetoLocal end SNA, ImpuestoLocal Impuesto
from SBOVCompras
where FechaConta between @INICIO and @FIN
and TipoDoctoDetalle not in ('N','NB')) DT
group by TipoDocto, Serie, NoDocto, FechaDocto, NIT, NIT2, Nombre, TipoDoctoMaestro) X
order by FechaDocto, TipoDocto, Serie, NoDocto
Lo que hago aqui, es halar datos de una vista, los codifico para que no me muestre datos nulos, porque en la parte superior, convierto a una linea, toda la informacion, separando los cada dato por "|"
Muy agradecido por cualquier ayuda! -
Hello, I have this problem,
I use php for read data from oracle table,
all works right, I have any problem whith varchar number type data, but when I must read geometry data like
(type MDSYS.SDO_GEOMETRY)
I can't display it on the web page.
esemple of spatial query that I use:
select GEOMETRY_1
from table_a
where
ID = 970;
If I use sql plus I have this result
SDO_GEOMETRY(3001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(1, -0, -
0, 580094, 4998494, -1))
but blank page when I use php sentence.
I use PHP Version 4.4.0
modules load are:
extension=php_sdo.dll
extension=php_oci8.dll
But I don't know which other module I need and also which php function to use for read array of array. at the moment I use @OCIFetchInto.
Someone can help me?
My English is very bad please reply easy.
Thanks for all!
AngeloThank you very much CJ.
Now there isn't any problems: you and this link (Re: PHP and spatial data and Adamo Bozzetti helped me
I have used SDO_UTIL.GETVERTICES
my complete php script is:
$conn = @OCILogon("xxxxxx", "xxxxx", "xxxxx") or die
( "Non riesco a connettermi al server $host ");
$query = "select
TABLE_A.tipo_via,
TABLE_A.nome_via,
c.codice_via,
t.X,
t.Y
from TABLE B c, TABLE_A , TABLE(SDO_UTIL.GETVERTICES(c.geometry1)) t
where c.codice_via = 830
and c.codice_via = TABLE_A.id_via
$istruzione = @OCIParse($conn, $query);
@OCIExecute($istruzione);
$nrows = @OCIFetchInto($istruzione, $results);
$trovati = 0;
while(@OCIFetchInto($istruzione, $results))
$trovati++;
?>
<table border width="800" >
<tr>
<td align="center" width="80" bgcolor ="#aaffee"><?echo trim($results[0]);?></td>
<td align="center" width="150" bgcolor ="#eeffee"><?echo trim($results[1]);?></td>
<td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[2]);?></td>
<td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[3]);?></td>
<td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[4]);?></td>
</tr>
</table>
<?
} //fine While
@OCIFreeStatement($istruzione);
@OCILogOff($conn); -
please help.
I ran the query below in php4 + oacle9i
<?php
$quantity = 12345;
$grace=20;
$conn = ociLogon('username', 'pwd','host');
if (!$conn) {
$e = ocierror();
print htmlentities($e['message']);
exit;
$query = "udpate product set status_dtm = (status_dtm)+20 where product_no = $quantity";
$stid = ociparse($conn, $query);
if (!$stid) {
$e = ocierror($conn);
print htmlentities($e['message']);
exit;
$r = ociexecute($stid, OCI_DEFAULT);
if (!$r) {
$e = ocierror($stid);
echo htmlentities($e['message']);
exit;
print '<table border="1">';
while (ocifetchinto($stid, $row, OCI_ASSOC)) {
print '<tr>';
foreach ($row as $item) {
print '<td>'.($item?htmlentities($item):' ').'</td>';
print '</tr>';
print '</table>';
ociLogoff($conn);
?>
it throws error , but it throws this error
Warning: ociexecute() [function.ociexecute]: OCIStmtExecute: ORA-00900: invalid SQL statement in C:\Program Files\IBM HTTP Server 2.0\htdocs\en_US\welcome.php on line 40
ORA-00900: invalid SQL statement$query = "udpate product set status_dtm =
(status_dtm)+20 where product_no = $quantity";It says "udpate" instead of "update" :-) -
To parameter the name of table in a query
I need to work with dynamic link of tables. my php is like this:
===========
$query = "select DEPARTMENT_ID facture , DEPARTMENT_NAME ticket from :matable
where DEPARTMENT_ID <100 ";
$conn = db_connect();
ui_print_header('Informations');
$bindargs = array();
array_push($bindargs, array('matable', 'DEPARTMENTS',-1));
$dept = db_do_query($conn, $query,$bindargs);
===========
and execution is terminated by this error:
Error: at line 29 of C:\Program Files\Zend\Apache2\htdocs\Vente\anyco_db.inc
ORA-00903 invalid table name
Can anyone help me to correct this error
thanks in advancehi pbarut,
thanks for your response.
with oracle it possible to use a bind variable for the table.
for example with sqlplus :
SQL> select DEPARTMENT_ID , DEPARTMENT_NAME from &matable
2 where rownum<3;
Entrez une valeur pour matable : departments
ancien 1 : select DEPARTMENT_ID , DEPARTMENT_NAME from &matable
nouveau 1 : select DEPARTMENT_ID , DEPARTMENT_NAME from departments
DEPARTMENT_ID DEPARTMENT_NAME
10 Administration
20 Marketing
I use oracle9.2.
But i don't know how i can translate that in php code !!!!
nb : and my real query is more complex than this example. -
Help with MYSQLi Query and WHILE statement
Hi,
Not sure what is wrong here but the same record is printed in the while loop 11 times (the amount of records in the table).
<?php
//Main Connection & Query
//Database Connection & Error
$con_host = 'X';
$con_username = 'X';
$con_password = 'X';
$con_database = 'X';
$con = mysqli_connect($con_host, $con_username, $con_password, $con_database);
?>
<?php
//Query
$sql = "SELECT * FROM equipment ORDER BY name ASC";
$query = mysqli_query($con, $sql);
$row = mysqli_fetch_assoc($query);
$row_count = mysqli_num_rows($query);
//Create Variables
$name = $row['name'];
$size = $row['size'];
$quantity = $row['quantity'];
$protection = $row['protection'];
$location = $row['location'];
$sublocation = $row['sublocation'];
$bc = $row['BC'];
$id = $row['id'];
?>
<!doctype html>
<html>
<link href="stylesheets/main_stylesheet.css" rel="stylesheet" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Slabo+27px' rel='stylesheet' type='text/css'>
<!-- Favicon -->
<link rel="shortcut icon" type="image/png" href="images/icon.png" />
<style type="text/css">
</style>
<head>
<meta charset="utf-8">
<title>Print Equipment List</title>
<link href="stylesheets/print_stylesheet.css" rel="stylesheet" type="text/css">
<script src="sorttable.js"></script>
<!--<body onload="window.print()">-->
</head>
<body>
<div class="print_button no-print" onClick="window.print()">Print</div>
<div class="print_text no-print">Select the sorting of the list by clicking on the table categories and click the print button below</div>
<div class="print_a4page">
<div class="print_header">
<div class="print_header_logo"><img src="images/logo.png" width="306" height="43"></div>
<div class="print_header_text" id="header_text">Drama Database</div>
<div class="print_header_info">List printed: <script type="text/javascript">
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
document.write(day + "/" + month + "/" + year);</script>
<br>
Total records:
<?php echo $row_count ?></div>
</div>
<div class="print_header_divider">Equipment List</div>
<div class="print_body">
<div>
<form name="users" method="post">
<div class="table_print">
<table width="100%" border="0" cellpadding="5" class="sortable">
<tr class="table_header_print">
<th width="15%" scope="col">Name</th>
<th width="12%" scope="col">Size</th>
<th width="9%" scope="col">Quantity</th>
<th width="12%" scope="col">Protection</th>
<th width="17%" scope="col">Location</th>
<th width="12%" scope="col">Sublocation</th>
<th width="11%" scope="col">Barcode</th>
<th width="12%" scope="col">Internal ID</th>
</tr>
<?php do { ?>
<tr class="table_body">
<td><?php echo $name ?></td>
<td><?php echo $size ?></td>
<td><?php echo $quantity ?></td>
<td><?php echo $protection ?></td>
<td><?php echo $location ?></td>
<td><?php echo $sublocation ?></td>
<td><?php echo $bc ?></td>
<td><?php echo $id ?></td>
</tr>
<?php } while ($row = mysqli_fetch_assoc($query));?>
</table>
</form>
</div>
</div>
</div>
</body>
</html>Still getting the same issue.
As I see it, the way you have suggested is just rearanging things right?
here is a screenshot of the outcome:
And here is the improved code:
<?php
//Main Connection & Query
//Database Connection & Error
$con_host = 'X';
$con_username = 'X';
$con_password = 'X';
$con_database = 'X';
$con = new mysqli($con_host, $con_username, $con_password, $con_database);
?>
<?php
//Query
$sql = "SELECT * FROM equipment ORDER BY name ASC";
$result = $con->query($sql);
$row = $result->fetch_assoc();
$row_count = $result->num_rows;
//Create Variables
$name = $row['name'];
$size = $row['size'];
$quantity = $row['quantity'];
$protection = $row['protection'];
$location = $row['location'];
$sublocation = $row['sublocation'];
$bc = $row['BC'];
$id = $row['id'];
?>
<!doctype html>
<html>
<link href="stylesheets/main_stylesheet.css" rel="stylesheet" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Slabo+27px' rel='stylesheet' type='text/css'>
<!-- Favicon -->
<link rel="shortcut icon" type="image/png" href="images/icon.png" />
<style type="text/css">
</style>
<head>
<meta charset="utf-8">
<title>Print Equipment List</title>
<link href="stylesheets/print_stylesheet.css" rel="stylesheet" type="text/css">
<script src="sorttable.js"></script>
<!--<body onload="window.print()">-->
</head>
<body>
<div class="print_button no-print" onClick="window.print()">Print</div>
<div class="print_text no-print">Select the sorting of the list by clicking on the table categories and click the print button below</div>
<div class="print_a4page">
<div class="print_header">
<div class="print_header_logo"><img src="images/logo.png" width="306" height="43"></div>
<div class="print_header_text" id="header_text">Drama Database</div>
<div class="print_header_info">List printed: <script type="text/javascript">
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
document.write(day + "/" + month + "/" + year);</script>
<br>
Total records:
<?php echo $row_count ?></div>
</div>
<div class="print_header_divider">Equipment List</div>
<div class="print_body">
<div>
<form name="users" method="post">
<div class="table_print">
<table width="100%" border="0" cellpadding="5" class="sortable">
<tr class="table_header_print">
<th width="15%" scope="col">Name</th>
<th width="12%" scope="col">Size</th>
<th width="9%" scope="col">Quantity</th>
<th width="12%" scope="col">Protection</th>
<th width="17%" scope="col">Location</th>
<th width="12%" scope="col">Sublocation</th>
<th width="11%" scope="col">Barcode</th>
<th width="12%" scope="col">Internal ID</th>
</tr>
<?php while ($row = $result->fetch_assoc()) { ?>
<tr class="table_body">
<td><?php echo $name ?></td>
<td><?php echo $size ?></td>
<td><?php echo $quantity ?></td>
<td><?php echo $protection ?></td>
<td><?php echo $location ?></td>
<td><?php echo $sublocation ?></td>
<td><?php echo $bc ?></td>
<td><?php echo $id ?></td>
</tr>
<?php } ?>
</table>
</form>
</div>
</div>
</div>
</body>
</html> -
Help me on CVP class to query a SQL database
Dear friends,
I try to create a class extends to Action element. But when I do deploy, it return no result.
I want this class receive Calling Number and do the query to database (SQL as I test, later if it works I will do for another database). After query I will get Name, Address, Email of this Customer based on Calling Number (ANI).
Please help to take a look on my program and help me to fix it.
Thank you very much.
import com.audium.server.AudiumException;
import com.audium.server.voiceElement.ActionElementBase;
import com.audium.server.session.ActionElementData;
import java.sql.*;
* This class is called when a standard action has been configured to use a
* Java class. Since this is a standard action element, it applies to a
* specific application and does not have a configuration. As a result, the
* only method needed in this class is the doAction method.
public class DBLookupStandardAction extends ActionElementBase
class WhatIGot
String ANI = null;
String Name = null;
String Address = null;
String Email = null;
public void doAction(String name, ActionElementData data) throws AudiumException
Connection conn = null;
String Name = null;
String Address = null;
conn = connectToDatabase();
String ani = data.getAni();
WhatIGot whatigot = new WhatIGot();
whatigot = QueryDatabase(conn, ani);
Name = whatigot.Name;
Address = whatigot.Address;
data.setSessionData("Name",Name);
data.setSessionData("Address",Address);
// PUT YOUR CODE HERE.
private Connection connectToDatabase()
Connection conn = null;
try
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
conn = DriverManager.getConnection("jdbc:sqlserver://172.16.3.5:1433;DatabaseName=hcmpt","sa","");
catch (ClassNotFoundException e)
e.printStackTrace();
System.exit(1);
catch (SQLException e)
e.printStackTrace();
System.exit(2);
return conn;
/*Query*/
private WhatIGot QueryDatabase(Connection conn, String ANI)
WhatIGot WhatIGot = new WhatIGot();
try
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("SELECT prefixnos, Name, Address, Email FROM customer_info where prefixnos = ANI");
WhatIGot.ANI = rs.getString ("prefixnos");
WhatIGot.Name = rs.getString ("Name");
WhatIGot.Address = rs.getString ("Address");
WhatIGot.Email = rs.getString ("Email");
rs.close();
st.close();
catch (SQLException se) {
System.err.println("Threw a SQLException creating the list of blogs.");
System.err.println(se.getMessage());
return WhatIGot;Thank you Geoff,
I have made some changes and now it's working fine with SQL database.
I go forward to Oracle database. But can you show me how can I copy a new library (ojdbc14.jar) to the CVP server:
- which folder?
- and how apply it for all other application can use the same lib here?
waiting for you answer...
Thank you,
This code I have tested, it can connect and query and I try to put to screen. It is working. But when I apply to CVP xml server, it not work. And the CVP VXML server got "stop" (maybe on the fail state)
package com.dts.db;
* @author Doan Khanh Tan Thanh
// These classes are used by standard action elements.
import com.audium.server.AudiumException;
import com.audium.server.voiceElement.ActionElementBase;
import com.audium.server.session.ActionElementData;
import java.sql.*;
* This class is called when a standard action has been configured to use a
* Java class. Since this is a standard action element, it applies to a
* specific application and does not have a configuration. As a result, the
* only method needed in this class is the doAction method.
public class OracleDBLookupAction extends ActionElementBase
class WhatIGot
String Name = null;
String Address = null;
String Email = null;
public void doAction(String name, ActionElementData data) throws AudiumException
String NameWhatIGot = null;
Connection conn = null;
String AddressWhatIGot = null;
//String EmailWhatIGot = null;
String ani = null;
conn = connectToDatabase();
ani = (String)data.getSessionData("ANI");
WhatIGot whatigot = new WhatIGot();
whatigot = QueryDatabase(conn, ani);
NameWhatIGot = whatigot.Name;
AddressWhatIGot = whatigot.Address;
//EmailWhatIGot = whatigot.Email;
data.setSessionData("Name",NameWhatIGot);
data.setSessionData("Address",AddressWhatIGot);
// PUT YOUR CODE HERE.
private Connection connectToDatabase()
Connection conn = null;
try
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@172.16.5.134:1521:dbkttt","CUOC1080","123456");
catch (ClassNotFoundException e)
e.printStackTrace();
System.exit(1);
catch (SQLException e)
e.printStackTrace();
System.exit(2);
return conn;
/*Query*/
private WhatIGot QueryDatabase(Connection conn, String ANI)
WhatIGot WhatIGot = new WhatIGot();
try
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("SELECT * FROM CUSTOMER_INFO where ANI = '838232822'");
while ( rs.next() )
WhatIGot.Name = rs.getString ("NAME");
WhatIGot.Address = rs.getString ("ADDRESS");
WhatIGot.Email = rs.getString ("EMAIL");
rs.close();
st.close();
catch (SQLException se) {
System.err.println("Threw a SQLException creating the list of blogs.");
System.err.println(se.getMessage());
return WhatIGot; -
Query with Zend 2.0 on a dblink
I use Zend for oracle 2.0 and I am trying to run a query on an oracle database (9.2) with a dblink. But I receive an error :
Parse error: syntax error, unexpected T_STRING in C:\Program Files\Zend\Apache2\htdocs\prog7\Anyvente.php on line 6
the query is :
$query ='select
to_char(b."DateVente",'yymmdd' ) as Date_vente from vente@mg b';
$conn = db_connect();
$dept = db_do_query($conn, $query);
nb :
name of the column of the dblink must be surrounded by quotes "
Can anyone help me to write correctly this query
thanks in advanceEscape the embedded single quotes:
$query ='select to_char(b."DateVente",\'yymmdd\' ) as Date_vente from vente@mg b';
-- cj -
Menosprecio de la autorización
Hola a Todos
Tengo el siguiente problema: He restringido el acceso a ciertas funcionalidades a un usuario, cuando este intenta accesar a dicho lugar aparece un mensaje que dice menosprecio de la autorización, y un botón que dice Autorizado por otro usuario.
Yo esperaría que dicha función (Autorizado por otro usuario) permita a un usuario con privilegios acceder a dicha opción, no obstante si el mismo usuario que tiene prohibido el acceso ingresa su login y password accede a la información que tenía denegada.
¿Cómo puedo hacer para resolver este problema?, ¿me falta alguna parametrización para que funcione?
Espero puedan ayudarme.
SaludosDentro de la opción Ventas - Clientes el usuario tiene los siguientes permisos
Ventas - Clientes Varias autorizaciones
Oferta de ventas Autorización total
Orden de venta Autorización total
Entrega Falta autorización
Devolución Falta autorización
Solicitud de anticipo de clientes Falta autorización
Factura de anticipo de clientes Falta autorización
Factura de clientes Falta autorización
Factura cliente + Pago Falta autorización
Nota de crédito de clientes Falta autorización
Factura de reserva de clientes Falta autorización
Factura exenta de deudores Falta autorización
Nota de débito de clientes Falta autorización
Boleta Falta autorización
Boleta exenta Falta autorización
Factura de exportación Falta autorización
Asistente de creación de documentos Falta autorización
Documento preliminar de documento Autorización total
Impresión documento Autorización total
Asignación de número de folio - Criterio Falta autorización
Asistente de reclamación Falta autorización
Informes de Ventas Falta autorización
Sólo impuesto Falta autorización
Modificar total de filas Autorización total
Modificar empleado dep.ventas Autorización total
Actualizar empleado dep.ventas Autorización total
Confirmar desviación de línea de crédito Falta autorización
Confirmar desviación de línea de endeuda Falta autorización
Confirmar desviación de límite de almacé Falta autorización
Entrega parcial Falta autorización
Confirmación documento Falta autorización
Documentos con importes cero Falta autorización
Permitir modificación cuentas asociadas Falta autorización
Ganancia bruta Autorización total
Documentos de deudores contabilizados mo Falta autorizació -
How do I count specific, smaller groups of information in one large table?
Hello all,
I have a feeling the answer to this is right under my nose, but somehow, it is evading me.
I would like to be able to count how many photos are in any specific gallery. Why? Well, on my TOC page, I thought it would be cool to show the user how many photos were in any given gallery displayed on the screen as part of all the gallery data I'm presenting. It's not necessary, but I believe it adds a nice touch. My thought was to have one massive table containing all the photo information and another massive table containing the gallery information, and currently I do. I can pull various gallery information based on user selections, but accurately counting the correct number of images per gallery is evading me.
In my DB, I have the table, 'galleries', which has several columns, but the two most relevant are g_id and g_spe. g_id is the primary key and is an AI column that represents also the gallery 'serial' number. g_spec is a value that will have one of 11 different values in it (not relevant for this topic.)
Additionally, there is the table, 'photos', and in this table are three columns: p_id, g_id and p_fname. p_id is the primary key, g_id is the foreign key (primary key of the 'galleries' table) and p_fname contains the filename of each photo in my ever-expanding gallery.
Here's the abbreviated contents of the galleries table showing only the first 2 columns:
(`g_id`, `g_spec`, etc...)
(1, 11, etc...),
(2, 11, etc...),
(3, 11, etc...),
(4, 11, etc...),
(5, 12, etc...),
(6, 13, etc...)
Here's the contents of my photos table so far, populated with test images:
(`p_id`, `g_id`, `p_fname`)
(1, 1, '1_DSC1155.jpg'),
(2, 1, '1_DSC1199.jpg'),
(3, 1, '1_DSC1243.jpg'),
(4, 1, '1_DSC1332.jpg'),
(5, 1, '1_DSC1381.jpg'),
(6, 1, '1_DSC1421.jpg'),
(7, 1, '1_DSC2097.jpg'),
(8, 1, '1_DSC2158a.jpg'),
(9, 1, '1_DSC2204a.jpg'),
(10, 1, '1_DSC2416.jpg'),
(11, 1, '1_DSC2639.jpg'),
(12, 1, '1_DSC3768.jpg'),
(13, 1, '1_DSC3809.jpg'),
(14, 1, '1_DSC4226.jpg'),
(15, 1, '1_DSC4257.jpg'),
(16, 1, '1_DSC4525.jpg'),
(17, 1, '1_DSC4549.jpg'),
(18, 2, '2_DSC1155.jpg'),
(19, 2, '2_DSC1199.jpg'),
(20, 2, '2_DSC1243.jpg'),
(21, 2, '2_DSC1332.jpg'),
(22, 2, '2_DSC1381.jpg'),
(23, 2, '2_DSC1421.jpg'),
(24, 2, '2_DSC2097.jpg'),
(25, 2, '2_DSC2158a.jpg'),
(26, 2, '2_DSC2204a.jpg'),
(27, 2, '2_DSC2416.jpg'),
(28, 2, '2_DSC2639.jpg'),
(29, 2, '2_DSC3768.jpg'),
(30, 2, '2_DSC3809.jpg'),
(31, 2, '2_DSC4226.jpg'),
(32, 2, '2_DSC4257.jpg'),
(33, 2, '2_DSC4525.jpg'),
(34, 2, '2_DSC4549.jpg'),
(35, 3, '3_DSC1155.jpg'),
(36, 3, '3_DSC1199.jpg'),
(37, 3, '3_DSC1243.jpg'),
(38, 3, '3_DSC1332.jpg'),
(39, 3, '3_DSC1381.jpg'),
(40, 3, '3_DSC1421.jpg'),
(41, 3, '3_DSC2097.jpg'),
(42, 3, '3_DSC2158a.jpg'),
(43, 3, '3_DSC2204a.jpg'),
(44, 3, '3_DSC2416.jpg'),
(45, 3, '3_DSC2639.jpg'),
(46, 3, '3_DSC3768.jpg'),
(47, 3, '3_DSC3809.jpg'),
(48, 3, '3_DSC4226.jpg'),
(49, 3, '3_DSC4257.jpg'),
(50, 3, '3_DSC4525.jpg'),
(51, 3, '3_DSC4549.jpg');
For now, each gallery has 17 images which was just some random number I chose.
I need to be able to write a query that says, tell me how many photos are in a specific photoset (in the photos table) based on the number in galleries.g_id and photos.g_id being equal.
As you see in the photos table, the p_id column is an AI column (call it photo serial numbers), and the g_id column assigns each specific photo to a specific gallery number that is equal to some gallery ID in the galleries.g_id table. SPECIFICALLY, for example I would want to have the query count the number of rows in the photos table whose g_id = 2 when referenced to g_id = 2 in the galleries table.
I have been messing with different DISTINCT and COUNT methods, but all seem to be limited to working with just one table, and here, I need to reference two tables to acheive my result.
Would this be better if each gallery had its own table?
It should be so bloody simple, but it's just not clear.
Please let me know if I have left out any key information, and thank you all in advance for your kind and generous help.
Sincerely,
wordmanbregent,
I got it!
Here's the deal: the query that picks the subset of records:
$conn = dbConnect('query');
$sql = "SELECT *
FROM galleries
WHERE g_spec = '$spec%'
ORDER BY g_id DESC
LIMIT $startRow,".SHOWMAX;
$result = $conn->query($sql) or die(mysqli_error());
$galSpec = $result->fetch_assoc();
picks 3 at a time, and with each record is an individual gallery number (g_id). So, I went down into my code where a do...while loop runs through the data, displaying the info for each subset of records and I added another query:
$conn = dbConnect('query');
$getTotal = "SELECT COUNT(*)
FROM photos
WHERE g_id = {$galSpec['g_id']}
GROUP BY g_id";
$total = $conn->query($getTotal);
$row = $total->fetch_row();
$totalPix = $row[0];
which uses the value in $galSpec['g_id']. I didn't know the proper syntax for including it, but when I tried the curly braces, it worked. I altered the number of photos in each gallery in the photos table so that each total is different, and the results display perfectly.
And as you can see, I used some of the code you suggested in the second query and all is well.
Again, thank you so much for being patient and lending me your advice and assistance!
Sincerely,
wordman -
Open and close database connection jsp page
hi there, i wanna know about how to open database connection to Mysql at the beginning of the page and close the connection at the end of the page. The jsp page contain all processing code.
plz help me...thx thx<html>
<head>
<basefont face="Arial">
</head>
<body>
<%@ page language="java" import="java.sql.*" %>
<%!
// define variables
String id;
String firstName;
String lastName;
// define database parameters, change this according to your needs
String host="localhost";
String user="root";
String pass="";
String db="test";
String conn;
%>
<table border="1" cellspacing="1" cellpadding="5">
<tr>
<td><b>id</b></td>
<td><b>first name</b></td>
<td><b>last name</b></td>
</tr>
<%
Class.forName("org.gjt.mm.mysql.Driver");
// create connection string
conn = "jdbc:mysql://" + host + "/" + db + "?user=" + user
+ "&password=" + pass;
// pass database parameters to JDBC driver
Connection Conn = DriverManager.getConnection(conn);
// query statement
Statement SQLStatement = Conn.createStatement();
// generate query
// change this query according to your needs
String Query = "SELECT id, firstname, lastname FROM abook";
// get result
ResultSet SQLResult = SQLStatement.executeQuery(Query);
while(SQLResult.next())
id = SQLResult.getString("id");
firstName = SQLResult.getString("firstname");
lastName = SQLResult.getString("lastname");
out.println("<tr><td>" + id + "</td><td>" +
firstName + "</td><td>" + lastName + "</td></tr>");
// close connection
SQLResult.close();
SQLStatement.close();
Conn.close();
%>
</table>
</body>
</html>hi :-)
i've got that on the net as part of the tutorial on jsp (long long time ago)
you just have to be resourceful in finding solutions :-)
try google :-) there are lot's of tutorial available in there ;-)
goodluck ;-)
regards, -
Selecting a MAX value from a table & displaying it on a form using OCI PHP
WinXP Pro SP3- 32bit
Apache/2.2.22 (Win32) mod_fcgid/2.3.6 PHP/5.4.0
PHP Version 5.4.0
Oracle epxress 11g
problem: output on form displaying Resource id #4 instead of the number from the table.
(maybe it's number to string conversion issue?)
$conn = oci_connect('system', 'mypassword', 'localhost/xe');
$query = "SELECT MAX(CustNo)+1 AS MAXNUM FROM customer";
$stmt = OCIParse($conn, $query);
OCIExecute($stmt);
OCIFetch($stmt);
echo OCIResult($stmt, "MAXNUM")." will be next number.";
//OCIFreeStatement($stmt); //frees the resources- use a the end!
$daNextNo = $stmt;
echo $daNextNo;
//$daNextNo = OCIBindByName($stmt, ":text", &$form_text, -1); //not sure how this works if it'll fix the issue
?>
<form name="Addcust" action="process_cust.php" method="post">
<input type="text" name="CustNo" value="<?php echo $daNextNo;?>" /></br>
output of complete code:
45 will be next number.Resource id #4
And inside the textbox it says: 45 will be next number.Resource id #4
how can I put the 45 into $php variable so i can use it in a textbox or on a label?
Thank you in advance .THanks. i couldn;t find the PHP section.
I figured it out
i used nextval() to convert the object to a string.
<?php
$conn = oci_connect('system', '1234', 'localhost/xe');
if (!$conn) {
$m = oci_error();
trigger_error('Could not connect to database: '. $m['message'], E_USER_ERROR);
$query = "SELECT MAX(CustNo)+1 AS MAXNUM FROM customer";
//$daNextNo = $query;
$stmt = OCIParse($conn, $query);
OCIExecute($stmt);
OCIFetch($stmt);
echo OCIResult($stmt, "MAXNUM")." will be next number.";
//OCIFreeStatement($stmt); //frees the resources- use a the end!
$daNextNo = strval(OCIResult($stmt, "MAXNUM")." .");
$daNextNo = strval(OCIResult($stmt, "MAXNUM"));
echo "danextNo: ";
echo $daNextNo;
?>
<form name="Addcust" action="process_cust.php" method="post">
<div>
<dl>
<dt>* <?php //echo $this->lang->line('cust_fn'); ?>: </dt>
<dd><input type="text" name="CustNo" value="<?php echo $daNextNo;?>" /></dd> -
I am trying connection with the Oracle 9i, and is presented the error below:
Log apache
[Sat Aug 26 12:23:38 2006] [notice] Apache/2.2.3 (Win32) PHP/5.1.5 configured -- resuming normal operations
[Sat Aug 26 12:23:38 2006] [notice] Server built: Jul 27 2006 16:49:49
[Sat Aug 26 12:23:38 2006] [notice] Parent: Created child process 244
PHP Warning: PHP Startup: Unable to load dynamic library 'c:\\php\\ext\\php_oci8.dll' - N\xe3o foi poss\xedvel encontrar o procedimento especificado.\r\n in Unknown on line 0
[Sat Aug 26 12:23:46 2006] [notice] Child 244: Child process is running
[Sat Aug 26 12:23:46 2006] [notice] Child 244: Acquired the start mutex.
[Sat Aug 26 12:23:46 2006] [notice] Child 244: Starting 250 worker threads.
[Sat Aug 26 12:23:46 2006] [notice] Child 244: Starting thread to listen on port 80.
[Sat Aug 26 12:55:34 2006] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function OCILogon() in C:\\Arquivos de programas\\Apache Software Foundation\\Apache2.2\\htdocs\\PHP\\file.php on line 8
Test connection PHP
<?php
* Created on 26/08/2006
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
$conn = OCILogon("system", "system", "//192.168.182.130/MANFRONX");
$query = 'select * from teste';
$stid = OCIParse($conn, $query);
OCIExecute($stid, OCI_DEFAULT);
while ($succ = OCIFetchInto($stid, $row)) {
foreach ($row as $item) {
echo $item." ";
echo "<br>\n";
OCILogoff($conn);
?>
The file php_oci8.dll exist in the C:\php\ext
On the php.ini, this configured for oracle as well as mysql, as below:
extension=php_mysql.dll
extension=php_oci8.dll
I obtain to carry through a connection with the MySql normally.
I am trying to conect in server Oracle 9i windows 2003.
configuration of the my computer:
Windows XP SP2
Apache 2.2.3
PHP Version 5.1.6
Client Oracle 9 installed and connecting in the server oracle it saw SQLPlus.
Any help would be appreciated. Thanks1)the variables:
ORACLE_HOME=C:\ORACLE\ORA92
NLS_LANG=BRAZILIAN PORTUGUESE_BRAZIL.WE8ISO8859P1
2)I installed client 10, none of them functioned
3)the libraries php_oci8, none of them functioned
The problem persists
Maybe you are looking for
-
Can I use logic express with my Macbook
I just got a macbook and i was wondering if I can use Logic express or pro on it??
-
How to resize window when stage style is undecorated ?
Hi, I have one undecorated window and I want to make it resizable by using mouse. How can I do it ? If I use decorated window then it allows me to resize it. Thanks.
-
BASELINE PACKAGE V 5.600 best practice,preconfigured smartforms isfor free?
Hello i want install in the system of my customer the BASELINE PACKAGE V 5.600 because i need preconfigured smartforms. I have a question. if i use the user id of my customer in servicemarketplace the customer have to pay BASELINE PACKAGE V 5.6000 or
-
Hi All, We are doing same scenario(Integration of CRM with ECC and replication of material/customer).My question is how to integrate CRM and ECC(Proxy OR WS). what are the interfaces involve in sap pi and any software com
-
I cannot get onto a website. I continually get a message that says that site requires a certificate. There is a certificate there I hit continue and it goes round and round repeating the same thing. Of course I can access site with my Samsung phone a