Sql code with php code
for example:
create table testtable (
sales_area varchar2(30),
sales_comp varchar2(40),
sales_market varchar2(30),
order_number number(20),
order_date varchar2(20),
item_id number(15),
quantity number(20),
item_desc varchar2(50)
insert into testtable values ('westarea','acompany','amarket','52001',1001,1,10,'apple');
insert into testtable values ('westarea','acompany','amarket','52005',1002,2,20,'banana');
insert into testtable values ('eastarea','bcompany','bmarket','52002',1003,2,50,'banana');
insert into testtable values ('eastarea','bcompany','bmarket','52004',1006,1,30,'apple');
insert into testtable values ('eastarea','bcompany','bmarket','52003',1007,1,30,'apple');
insert into testtable values ('westarea','ccompany','cmarket','52006',1003,1,30,'orange');
insert into testtable values ('westarea','ccompany','dmarket','52007',1004,3,60,'orange');
commit;
select *
from testtable
it outputs below:
westarea acompany amarket 52001 1001 1 10 apple
westarea acompany amarket 52005 1002 2 20 banana
eastarea bcompany bmarket 52002 1003 2 50 banana
eastarea bcompany bmarket 52004 1006 1 30 apple
eastarea bcompany bmarket 52003 1007 1 30 apple
westarea ccompany cmarket 52006 1003 1 30 orange
westarea ccompany dmarket 52007 1004 3 60 orange
use php code outputs like below php code :
apple banana orange .......
westarea acompany amarket 52001 1001 10
westarea acompany amarket 52005 1002 20 ........
acompany 10 20 .........
westarea ccompany cmarket 52006 1003 30 .........
westarea ccompany dmarket 52007 1004 60 .........
ccompany 90 .........
westarea 10 20 90 .........
eastarea bcompany bmarket 52002 1003 50 .........
eastarea bcompany bmarket 52004 1006 30 .........
eastarea bcompany bmarket 52003 1007 30 .........
bcompany 60 50 .........
eastarea
total 70 70 90 ......
make below php code output a new table:
<?php
$v_item_count = count(array(item));
echo"<table border = 1>";
echo "<tr>";
echo "<td rowspan="2">sales area</td>";
echo "<td rowspan="2">sales comp</td>";
echo "<td rowspan="2">sales market</td>";
echo "<td rowspan="2">customer_number</td>";
echo "<td rowspan="2">order_number</td>";
echo "<td colspan="'||to_char($v_item_count)||'">categories and quantities</td>";
while ($row = oci_fetch_array ($stmt, OCI_BOTH)) {
echo "<tr>";
echo "<td>".$row['ORDER_NUMBER']."</td>";
?>
who can help me?
for example:
while ($row = oci_fetch_array ($stmt, OCI_BOTH)) {
echo "<tr>";
echo "<td>".$row['ORDER_NUMBER']."</td>";
echo "<td>".$row['ORDERED_DATE']."</td>";
for ($i=0; $i<sizeof($items); $i++) {
echo "<td>".$row[$i]." </td>";
echo "</tr>";
echo "</table>";
?>
above php code should output plentites of lines while it output few lines.
i don't know there has many lines outputed?
who can help me?
Similar Messages
-
A difficult problem with php code and sql code
it's good place to visit(Paged Result Sets with PHP and Oracle)
http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_paged.html
maybe below part php code could not be used in above address's php code.
if((isset($l_company) and $l_company != $rows['COMPANY']) or empty($stmt) and empty($total_pages) ) {
echo "<tr bgcolor='#CCFFCC'>";
echo "<td colspan= 3 align='center'>".$l_company."</td>";
echo "<td >".$totalcomany." </td>";
$totalcomany = 0;
echo "<td > </td>";
echo "</tr>";
$l_company = $rows['COMPANY'];
because the same company in one page could calculate sum while if
the same company in two pages could not do that.
and what do you think of ?
thanks !Hi,
this is because your sql-statement selects only the rows, you need to build this one page.
Neither php nor the given result from your query knows about data wich will be part of the result of another page.
Greetings from Hamburg
Thorsten Körner -
Problem with php code. Please help!
Hello!
I'm using the following syntax to bring content into my
websites' layout template:
Code:
<?php //check in the root folder first
if(file_exists('./' . $pagename . '.php'))
include './' . $pagename . '.php';
//if it wasn't found in the root folder then check in the
news folder
elseif(file_exisits('./news/' . $filename . '.php'))
include './news/' . $pagename . '.php';
// if it couldn't be found display message
else
echo $pagename . '.php could not be found in either the root
folder or the news folder!';
} ?>
What it's essentially saying is, if you can't find the .php
file in the _root folder, look for it in the /news/ folder.
It works perfectly if loading something from the _root folder
but I get an error if I need to bring something from the /news/
folder.
Can anyone see any potential problems with my code?
Thank you very much and I hope to hear from you.
Take care,
MarkI've never seen the code written like that before, but I'm
assuming it's
legal?
Perhaps try:
<?php
$newsroot = $_SERVER['DOCUMENT_ROOT']."/news";
if (!file_exists("$pagename.php")) {
elseif (!file_exists("$newsroot/$pagename.php")) {
else
Or the other thing you can try is replacing the elseif
statement with:
elseif (!file_exists("news/$pagename.php"))
If not - I'm sure Gary will be on here soon...
Shane H
[email protected]
http://www.avenuedesigners.com
=============================================
Proud GAWDS Member
http://www.gawds.org/showmember.php?memberid=1495
Delivering accessible websites to all ...
=============================================
"Spindrift" <[email protected]> wrote in
message
news:e5mled$272$[email protected]..
> Hello!
>
> I'm using the following syntax to bring content into my
websites' layout
> template:
>
> Code:
>
> <?php //check in the root folder first
> if(file_exists('./' . $pagename . '.php'))
> {
> include './' . $pagename . '.php';
> }
> //if it wasn't found in the root folder then check in
the news folder
> elseif(file_exisits('./news/' . $filename . '.php'))
> {
> include './news/' . $pagename . '.php';
> }
> // if it couldn't be found display message
> else
> {
> echo $pagename . '.php could not be found in either the
root folder or
> the
> news folder!';
> } ?>
>
> What it's essentially saying is, if you can't find the
.php file in the
> _root
> folder, look for it in the /news/ folder.
>
> It works perfectly if loading something from the _root
folder but I get an
> error if I need to bring something from the /news/
folder.
>
> Can anyone see any potential problems with my code?
>
> Thank you very much and I hope to hear from you.
>
> Take care,
>
> Mark
> -
How to write this sql query in php code ?
for example:
insert into temp
select *
from testtable;
after this, i will query data from sql below:
select *
from temp;
how to write this php code ?
who can help me ?
thanks!Have a look at the manual to find out how to issue queries.
http://us3.php.net/oci8 -
Using DW CS4
Have a page with a select that is populated from a recordset that lists products and i am trying to have the select show certain products as being SOLD OUT!
Here is the code i have
<?php
/*START_PHP_SIRFCIT*/ if
($row_rs_options['OptionPriceincrement']!="0"){ ?>
<option value="<?php echo
$row_rs_options['ProductOptionID']?>"><?php echo
$row_rs_options['OptionName']?> $<?php echo
$row_rs_options['OptionPriceincrement']; ?></option><?php } else
echo'<option class="style1" value=""><?php echo
$row_rs_options[\'OptionName\']?> ITEM SOLD OUT!</option>'
/*END_PHP_SIRFCIT*/ ?>
If my else statement is triggered, i want the select option to show the OptionName where the OptionPriceincrement is == to 0 and also the text ITEM SOLD OUT!
With the code as i have it, only the ITEM SOLD OUT! shows in a browser.
You can see this here http://www.comfycampers.info/products.php
Go to Tour Bon Ton Roulet and view the select
thanks for your help,
-Jim BalthropI figured out my mistake on the code.
<?php /*START_PHP_SIRFCIT*/ if ($row_rs_options['OptionPriceincrement']!="0"){ ?>
<option value="<?php echo $row_rs_options['ProductOptionID']?>"><?php echo $row_rs_options['OptionName']?> $<?php echo $row_rs_options['OptionPriceincrement']; ?></option><?php }
else { ?><option class="style1" value=""><?php echo $row_rs_options['OptionName']; ?> SOLD OUT!</option>
<?php } /*END_PHP_SIRFCIT*/ ?>
You can see this here http://www.comfycampers.info/products.php
Go to Tour Bon Ton Roulet and view the select
thanks for your help,
-Jim Balthrop -
Need help about MS SQL Gate with Mess Code Data
My Database is Oracle9i, and select * from nls_database_parameters with fellow table params
PARAMETER VALUE
1 NLS_CSMIG_SCHEMA_VERSION 3
2 NLS_NCHAR_CHARACTERSET AL16UTF16
3 NLS_LANGUAGE AMERICAN
4 NLS_TERRITORY AMERICA
5 NLS_CURRENCY $
6 NLS_ISO_CURRENCY AMERICA
7 NLS_NUMERIC_CHARACTERS .,
8 NLS_CHARACTERSET UTF8
9 NLS_CALENDAR GREGORIAN
10 NLS_DATE_FORMAT DD-MON-RR
11 NLS_DATE_LANGUAGE AMERICAN
12 NLS_SORT BINARY
13 NLS_TIME_FORMAT HH.MI.SSXFF AM
14 NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
15 NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZH:TZM
16 NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZH:TZM
17 NLS_DUAL_CURRENCY $
18 NLS_COMP BINARY
19 NLS_LENGTH_SEMANTICS BYTE
20 NLS_NCHAR_CONV_EXCP FALSE
21 NLS_RDBMS_VERSION 9.2.0.5.0
22 NLS_SAVED_NCHAR_CS WE8ISO8859P1
and confing access ms sql with oracle gate by ODBC, and the ms sql characterset with Chinese_PRC_CS_AI, Chinese_PRC_CS_AS.
my pc NLS_LANG=AMERICAN_AMERICA.ZHS16GBK.
when i query oracle database chinese data is ok, but when access the chinese data in ms sql will be ????(mess code data)?
How can i confing to access mssql chinese data be normal format, pls ?
Edited by: Rain.zhang on 2008-10-8 下午3:15hi llturro,
Thanks for answering my question. I have tried out what you suggested, but I still can't fix my problem. The following are the messages that display when I try to run my servlet. It seems that the DataSource, Connection and Statement are ok, however when it comes to the ResultSet the error message appear. What's wrong with my ResultSet coding ?
ResultSet rs = stat.executeQuery("SELECT ISBN FROM BOOKSINFO WHERE ISBN='"+primarykey+"'");
setEntityContext Method
Find by primary key
DataSource OK
Connection OK
Primary Key = 013-00-675721-9
Statement OK
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: Unknown Exception/Error thrown by EJB method.; nested exception is:
java.lang.NullPointerException
java.rmi.RemoteException: Unknown Exception/Error thrown by EJB method.; nested exception is:
java.lang.NullPointerException
java.lang.NullPointerException
<<no stack trace available>> -
Mapping of tax code with juridiction code
Hi MM Experts
While releasing service entry i m geting error " Message FF718 (tax code does not exist fo jurisdiction code)"
i have checked in FTXA tax code is mapped with juri code.
pls tell me where is the problem.
Thanks
AnubhavHope you have created Tax Code with Jurisdiction in FTXP Properly and Checked the Jurisdiction in Purchase ORder Item Detail Invoice Tab.
Now Check in OBCL whether Jurisdiction is Assigned to Company code.
Regards,
Ashok -
[Beta 6] Camera is crashing on simple code with exit code 101
First time it was perfect
Second time application failing with exit code 101
If I don't use result image. For example remove line: imageView.image = image;
then it works!
Any ideas?
[q]
- (void)showCamera {
// Set up the image picker controller and add it to the view
UIImagePickerController *imagePickerController = [[[UIImagePickerController alloc] init] autorelease];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.delegate = self;
imagePickerController.allowsImageEditing = NO;
[self presentModalViewController:imagePickerController animated:YES];
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo
[picker dismissModalViewControllerAnimated:YES];
imageView.image = image;
[/q]did you ever figure this out?
i am having the same thing, but i assumed it was an out of memory problem... -
Compare owb 9i code with 11g code
HI
Recently we migrated the 9i OWB's to 11g pls files.I need to verify whether correct versions were migrated or not.
is there any way to Compare the 9i OWB's with 11g pls files?
Note:9i databases with all OWB Components and 11g databases with new code is available.Hi
Since you are using LCT Oracle to Oracle dblink you might as well remove the source execution unit and put the operators in the Oracle default target execution unit.
Cheers
David -
Mapping of GL code with material code
Hi MM experts
is there any table where i can find GL code that is mapped with material code.
Regards
Anubhavi think there is no standard report existing for this GL material combination, also the same info is not also in same table. so i feel you can develop a report through SAP query or ask your abaper to develop it for you that material valuation class and GL account combination. you can use mm60 which have material and val. class combination
regards,
qsm sap -
why below example doesn't work?
<?php
$table =" select h.order_number,b.inventory_item_id,b.description item_desc
from oe_order_headers_all h,
oe_order_lines_all l,
mtl_system_items_b b
where h.header_id = l.header_id
and l.inventory_item_id = b.inventory_item_id
and b.organization_id = 85
AND h.org_id = 85
and l.org_id = 85
and to_char(h.ordered_date,'YYYYMMDD') = '20060508'";
$conn = ocilogon("apps", "apps", "prod");
$sql="select distinct(item_desc) item_desc from $table";
$stmt = oci_parse ($conn, $sql);
oci_execute ($stmt);
$items=array();
$result= array();
$i=0;
while ($result = oci_fetch_array($stmt,OCI_BOTH)) {
$items[$i]=$result['ITEM_DESC'];
echo $result['ITEM_DESC'];
$i=$i+1;
//build part of select stateme
for ($i=0; $i<sizeof($items); $i++) {
$select_items .= "SUM($items[$i]) $items[$i],";
for ($i=0; $i<sizeof($items); $i++) {
$decode_items .= "DECODE(item_desc,'$items[$i]', quantity, null) $items[$i],";
//final SQL statement
$sql="SELECT $select_items order_number
FROM (SELECT $decode_items order_number FROM $table )
group by order_number";
$stmt=oci_parse ($conn, $sql);
oci_execute($stmt);
echo "<table border=1>";
echo "<tr>";
echo "<td>Order Number</td>";
for ($i=0; $i<sizeof($items); $i++) {
echo "<td>".$items[$i]."</td>";
echo "</tr>";
while ($row = oci_fetch_array ($stmt, OCI_BOTH)) {
echo "<tr>";
echo "<td>".$row['ORDER_NUMBER']."</td>";
for ($i=0; $i<sizeof($items); $i++) {
echo "<td>".$row[$i]."</td>";
echo "</tr>";
echo "</table>";
?>Hey,
I'm French so i'll try to explain in my best english.
I had the same problem. And i solved it.
In fact i change the dll because the one which php install give us is not compatible.
I choose the one which is provides with wampserver 2.0i.
php_oci8_11g.dll
with instantclient_11_1g
Next i'll create environnement variables
NLS_LANG=FRENCH_FRANCE.WE8ISO8859P15
TNS_ADMIN=d:\oracle
and in path variable add the way to the instantclient11_1
D:\oracle\instantclient_11_1
Then i restart the server and lucky all services start and run perfectly. -
Predefined variables with php code
for example:
form1.html
<html>
<body>
<form action = "action.php" method = "post">
please select comany:
<select name="company" >
<option value="company1">company1
<option value="company2">company2
<option value="company3">company3
</select>
<input type="submit" value="提交">
</form>
</body>
</html>
action.php:
$query = "select * from company_table where company_name = $_POST[company]"
I don' know whether pass $_POST[company] is right or not.
who can help me?
thanks a lot!Pls don't get confused, to post data from one page to other page you must use either POST/GET methods..once you post your data from one page to second page...in that second page instead of directly using those post data it is always better to validate that data.. say if your data contains single & double quotes then you must add slashes(\) .. there should be some mechanism to prevent malicious data getting inserted into your DB..
-
Tax code with Jurisdiction Code
Dear Gurus,
How to find the Tax code is assigned to how many Jurisdiction codes, is there any Table for checking the same.
regards,
Gopi.PDear,
Use table A053
Regards,
Chintan Joshi -
SQL query with PHP variable help
Hi,
Using Dreamweaver Developer Toolbox, I added a Horizontal
recordset to get two columns across for the city. Next to this is a
number value of how many records are in the particular city.
But I have gone wrong somewhere, as I get the same value for
all my 102 cities.
I have two records in the 'jobs' table and it shows '2' in
the repeat region for all 102 cities.
Can anyone point me in the right direction?
Thank you.Many thanks for your reply.
I have run the statistic already for the both tableA and tableB as well all the indexes associated with both table (using dbms_stats, I am on 9i db ) but not the indexed columns.
for table I use:-
begin
dbms_stats.gather_table_stats(ownname=> 'IVAN', tabname=> 'TABLEA', partname=> NULL);
end;
for index I use:-
begin
dbms_stats.gather_index_stats(ownname=> 'IVAN', indname=> 'TABLEB_IDX_003', partname=> NULL);
end;
Is it possible to show me a sample of how to collect statisc for INDEX columns stats?
regards
Ivan -
Replace source code with destination code
Hi,
How to replace a program in source system with the program in production system technically?
Thanks in advance...hi,
Using Version Management you can do that.
Use menupath...
Utilies->Vesion->Version Management.
Check the lastet request whcih exist in the Production sytem using Remote Comparsion Button
After know the Request number Select the request number in the source system and press retrive.
Maybe you are looking for
-
IPhoto - problem sending photos by email
Hello, I now encounter a problem when I want to transfer photos to friends, something quite new !!! I get the following advertisement "The mail server did not recognize the association of your usere name and password" Can you help me solve this probl
-
Is it possible to save your iDisk space by putting photos on your .Mac iWeb site from another website you are with. Maybe thats not very clear.... I have a 'pro' flickr account that I bought before I got my .Mac account as a gift. Is it possible to b
-
Downloaded CD clicks when played back
I have two new CD's that will play back just fine on my iMac, but they can't be downloaded to my iTunes library without picking up popping, clicking and screaching artifacts when they are played back from the library. (I have successfully downloaded
-
Fully-Qualified Host Name empty in SMSY
Hello, I am facing a problem in the SMSY of Solution Manager. I've got some servers listed in the "servers" tree of the landscape components. Fine. But for all of them, the field Fully-Qualified Host Name is empty. I need this entry for generating RF
-
Hi all, I am using Webutil library within form10g, the problem that i got is that when the user clicks cancel to save a file, the non-oracle 302000. the code where the error apears is this: fic_name := WEBUTIL_FILE.FILE_SAVE_DIALOG('',fic_name,'csv f