How to display the results of a MySql query in multiple columns?
Hi, I know how to display PHP/MySq
l of the results in a single column, but I'm really stuck to show
Ying the results of several columns in DW CS4.
Can someone help me with a code example? I'm new to php/mysql. Thank you
Are you asking how to rotate the query results? Do a search for a horizontal loop. If this isn't what you're asking, please provide more details.
Tags: Dreamweaver
Similar Questions
-
How to display the result sqlplus in java?
I want to call sqlplus to run some commands sql in java, but how can I print the result of sqlplus?
In java code, I call sqlplus as:
Process of p;
Run the command
p = Runtime.getRuntime () .exec (commandString);
print the result of the command
InputStream inputStream = p.getInputStream ();
How to display the result of the execution?
Published by: Yi on February 26, 2012 23:41You can use ProcessBuilder. Copy the following code starts sql * more and runs the script in the variable "filename". It displays the results in the console of NetBeans.
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.File; import java.util.Map; public class test1 { public static void main (String args []) { test_script(); } public static void test_script () { String fileName = "@test_table.sql"; String sqlPath = "E:\\"; String sqlCmd = "sqlplus"; String arg1 = "user/password@sid"; -- plug in your user, password and db name String arg2 = fileName; try { String line; ProcessBuilder pb = new ProcessBuilder(sqlCmd, arg1, arg2); Map
env = pb.environment(); env.put("VAR1", arg1); env.put("VAR2", arg2); pb.directory(new File(sqlPath)); pb.redirectErrorStream(true); Process p = pb.start(); BufferedReader bri = new BufferedReader (new InputStreamReader(p.getInputStream())); BufferedReader bre = new BufferedReader (new InputStreamReader(p.getErrorStream())); while ((line = bri.readLine()) != null) { System.out.println(line); } bri.close(); while ((line = bre.readLine()) != null) { System.out.println(line); } bre.close(); System.out.println("Done."); } catch (Exception err) { err.printStackTrace(); } } } Here is the content of the script at E:\\test_table.sql
Prompt drop TABLE ANOTHER_TEST; DROP TABLE ANOTHER_TEST CASCADE CONSTRAINTS / Prompt Table ANOTHER_TEST; CREATE TABLE ANOTHER_TEST ( BATCH_SEQ NUMBER, BATCH_GROUP_ID NUMBER, STATUS_FLAG VARCHAR2(30 BYTE), OBJ_BEING_PROCESSED VARCHAR2(80 BYTE), BATCH_RUN_START_DTTM DATE, BATCH_RUN_END_DTTM DATE, CREATE_DTTM DATE, CREATE_USER VARCHAR2(30 BYTE), UPDATE_DTTM DATE, UPDATE_USER VARCHAR2(30 BYTE) ) LOGGING NOCOMPRESS NOCACHE PARALLEL ( DEGREE DEFAULT INSTANCES DEFAULT ) MONITORING / COMMENT ON TABLE ANOTHER_TEST IS 'This is a test table.' / EXIT /
-
How to display the results in the order based on the value of research
Hi all
How to display the results in the slot order.
If the user makes a search with "MADONNA", I view the results as title begins with "MADONNA" first then the rest of the records.CREATE TABLE TEST( SONGID NUMBER, TITLE VARCHAR2(200)) INSERT INTO TEST(SONGID,TITLE) VALUES (10,'AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)'); INSERT INTO TEST(SONGID,TITLE) VALUES (11,'CICCONE, MADONNA (CA)'); INSERT INTO TEST(SONGID,TITLE) VALUES (12,'DALLIN, MADONNA LOUISE/STOCK'); INSERT INTO TEST(SONGID,TITLE) VALUES (13,'MADONNA'); INSERT INTO TEST(SONGID,TITLE) VALUES (14,'MADONNA (A)/ AHMADZAI, MIRWAIS (C)'); INSERT INTO TEST(SONGID,TITLE) VALUES (15,'MADONNA (CA)'); INSERT INTO TEST(SONGID,TITLE) VALUES (16,'MIRWAIS AHMADZAI, MADONNA'); INSERT INTO TEST(SONGID,TITLE) VALUES (17,'MIRWAIS (CA)/ MADONNA (CA),AHMADZAI'); INSERT INTO TEST(SONGID,TITLE) VALUES (18,'MADONNA (CA),CICCONE'); SELECT *FROM TEST WHERE INSTR (TITLE, 'MADONNA') > 0 output: SONGID TITLE 10 AHMADZAI, MIRWAIS (CA)/ MADONNA (CA) 11 CICCONE, MADONNA (CA) 12 DALLIN, MADONNA LOUISE/STOCK 13 MADONNA 14 MADONNA (A)/ AHMADZAI, MIRWAIS (C) 15 MADONNA (CA) 16 MIRWAIS AHMADZAI, MADONNA 17 MIRWAIS (CA)/ MADONNA (CA),AHMADZAI 18 MADONNA (CA),CICCONE Expected output : 13 MADONNA 14 MADONNA (A)/ AHMADZAI, MIRWAIS (C) 15 MADONNA (CA) 18 MADONNA (CA),CICCONE .. .. .. .. ...
Please let me know is possible to show the results in this order.
Kind regards
RajasekharThis can be a little more specific:
SQL> SELECT * 2 FROM TEST 3 WHERE INSTR (TITLE, 'MADONNA') > 0 4 ORDER BY INSTR (TITLE, 'MADONNA') 5 ,TITLE 6 ; SONGID TITLE -------------------- -------------------------------------- 13 MADONNA 14 MADONNA (A)/ AHMADZAI, MIRWAIS (C) 15 MADONNA (CA) 18 MADONNA (CA),CICCONE 12 DALLIN, MADONNA LOUISE/STOCK 11 CICCONE, MADONNA (CA) 17 MIRWAIS (CA)/ MADONNA (CA),AHMADZAI 16 MIRWAIS AHMADZAI, MADONNA 10 AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)
-
How to display the result of a java class in InputText?
Hi all
How can I get the result of the java classes to InputText or OutputText?
also everyone in the forum can road map me to deal with Java in oracle adf because I am a beginner in oracle adf
I saw a few samples in corner of oracle adf, but it is difficult for me.I use JDeveloper Version 11.1.2.3, technology of the Adf.
My question is how to return the result of java Bean InputText or OutText
Thank yousee if you want to have show some .so beans instance variable value you can have a few bean .define managed a variable as
string abc = "abc";create the getter set for her.
in the value property of inputText or OutPutText write an el as #{beanscope.managedbeanName.abc}
-
How to display the results of the database from several tables in descending order?
I have a key word to search for images on my website that allows visitors to search for specific things. My db msysql has 15 tables and for the search function I use a UNION ALL operation to join them any visitor can find all tables at the same time. The problem is that all the results are in ascending order. How can I get the results in descending order.
SELECT *.
FROM table1
Keyword WHERE AS id LIKE %s or %s
UNION ALL
SELECT *.
FROM table2
Keyword WHERE AS id LIKE %s or %s
UNION ALL
SELECT *.
TABLE 3
Keyword WHERE AS id LIKE %s or %s
PS
I tried this and it doesn't work:
SELECT * FROM table1 WHERE AS %s or id AS %s ORDER BY id DESC keyword
and I know that this is not conventional to use SELECT * with so many tables, but believe me, I have my reasons. I'm not trying to do is to wrap the whole UNION within an external SELECTION
Once more, the order by clause can only appear at the end of the last select statement in a UNION query. You have it on all select statements.
-
How to display the result conditioned by the sign!
Hello
This sum: sum (B.MONETARY_AMOUNT_03 [... / B.ACCOUNT_TYPE = 'R' and... / B.TREE_NODE = 'FUNC']).
sum (B.MONETARY_AMOUNT_03 [.. B.ACCOUNT_TYPE = ' and... / B.TREE_NODE = 'FUNC'])
is well calculated. (in my example, it is equal to: 5457573)
Now, I want to show this result only if it is positive, so I write this syntax...
<? If: (sum (B.MONETARY_AMOUNT_03 [... / B.ACCOUNT_TYPE = 'R' and... / B.TREE_NODE = 'FUNC'])-)
sum (B.MONETARY_AMOUNT_03 [.. B.ACCOUNT_TYPE = ' and... / B.TREE_NODE = 'FUNC'])) > 0? >
For me, that will show the result if it is positive, but when excuting, which show nothing... Normally, it should show the 5457573
..
Any help please!You should do this:
sum (B.MONETARY_AMOUNT_03 [.. B.ACCOUNT_TYPE = ' and... / B.TREE_NODE = 'FUNC'])) > 0? >
(sum(B.MONETARY_AMOUNT_03[.. .account_type='R' and="" ../b.tree_node='FONCT'?>
sum (B.MONETARY_AMOUNT_03 [.. B.ACCOUNT_TYPE = ' and... / B.TREE_NODE = 'FUNC']))? >Thank you!
-
How to write the result of a SQL query to a text file?
I'm using Oracle 11 g and SQL Plus.
I have a large table called side.
Whenever I do
SQL > select * rating.
The output goes well beyond what can show the screen sqlplus. So, I want to store the result of this query in a text file.
How is that possible? Help, please. Thank you.SQL > SPOOL results.txt
SQL > select * rating.
SQL > SPOOL OFF -
How to get the result of a single line in several columns
I have a scenario where I asked five different columns in a table and it would still look back one line.
So, for example: the query would be
So, this would mean 1 row with the value of their respective areas.Select user1, user2, user3, user4 from table1 where tblkey= 2
In my code, I have a common function I can call to send an email to the list of people (User1, User2, user3, user4).
So rather than call this function each time for each user, is there a way I can display the output to 4 different rows and use the loop For to call this function only once.
In this way, the loop For running 4 times (if not nulls for all users) and call this function of e-mail.
Really, I'd appreciate if someone could give me an idea of this scenario.
Thank you
ARIf the number of columns is fixed you may be able to use this:
SELECT DECODE ( RN , 1,USER1 , 2,USER2 , 3,USER3 , 4,USER4 ) AS USERS FROM TABLE1 CROSS JOIN (SELECT ROWNUM RN FROM DUAL CONNECT BY ROWNUM <= 4) WHERE TBLKEY = 2
This UN-pivot results.
Here's an example of it in action:
SQL> CREATE TABLE TABLE1 2 ( 3 TBLKEY NUMBER 4 , USER1 VARCHAR2(1) 5 , USER2 VARCHAR2(1) 6 , USER3 VARCHAR2(1) 7 , USER4 VARCHAR2(1) 8 ); Table created. SQL> INSERT INTO TABLE1 2 SELECT ROWNUM 3 , SUBSTR(OBJECT_NAME,1,1) 4 , SUBSTR(OBJECT_NAME,2,1) 5 , SUBSTR(OBJECT_NAME,3,1) 6 , SUBSTR(OBJECT_NAME,4,1) 7 FROM ALL_OBJECTS 8 WHERE ROWNUM <= 10; 10 rows created. SQL> SELECT * FROM TABLE1 WHERE TBLKEY = 2; TBLKEY USER1 USER2 USER3 USER4 -------------------- ---------- ---------- ---------- ---------- 2 I _ U S SQL> SELECT DECODE 2 ( 3 RN 4 , 1,USER1 5 , 2,USER2 6 , 3,USER3 7 , 4,USER4 8 ) AS USERS 9 FROM TABLE1 10 CROSS JOIN (SELECT ROWNUM RN FROM DUAL CONNECT BY ROWNUM <= 4) 11 WHERE TBLKEY = 2 12 / USERS ------------------------- I _ U S
HTH!
Published by: Centinul on February 24, 2010 11:21
-
How to display the results in 3 sec then line break?
I was on a website and saw that they had their results displaying in a row of 3 then it < br / > to the next line. I searched high and low for days about how they did it. I know that this can be done manually, but the question is whether this can be done dynamically?
For example:
= 37 search results
I want to display as follows
: # 1 # 2 result: result # 3 < br / >
: # 4 result # 5: result # 6 < br / >
Result # 7: Result # 8: # 9 result < br / >
and so on.
Hope that all of the senses.
I found an old string on the forums here with someone who has the same problem. What follows is exactly what I needed to finish it. I had no idea how to achieve this. Dan's response was right, but I didn't know exactly how finish it to take account of the last part of the file.
Thanks again for all the responses and assistance.
-
Hi all
I have two tables named as standard of the emp and priority of emp with the same data in both table. And not the column in tables emp and emp name.
I need to take priority emp emp data no 6,5,4 and emp of standard data should be 10,9,8,7,3,2,1
Put it should be like this
EMP name Emp
6A
6 a
3 d
20g
9 E
8 F
8: 00
3 H
3 P
2 I have
Thanks and greetings
Srikkanth.Mwith emp_standard as ( select 10 emp_no, 'D' emp_name from dual union all select 9 emp_no, 'E' emp_name from dual union all select 8 emp_no, 'F' emp_name from dual union all select 7 emp_no, 'G' emp_name from dual union all select 3 emp_no, 'H' emp_name from dual union all select 2 emp_no, 'I' emp_name from dual union all select 1 emp_no, 'J' emp_name from dual ), emp_priority as ( select 6 emp_no, 'A' emp_name from dual union all select 5 emp_no, 'B' emp_name from dual union all select 4 emp_no, 'C' emp_name from dual ) select emp_no, emp_name from emp_standard union all select emp_no, emp_name from emp_priority order by emp_name Output: "EMP_NO" "EMP_NAME" "6" "A" "5" "B" "4" "C" "10" "D" "9" "E" "8" "F" "7" "G" "3" "H" "2" "I" "1" "J"
-
Display the results in the String form: dosen't work based on the example
Hello
To understand How to display the results as a string, I tried to reproduce this:
[http://apex.oracle.com/pls/otn/f?p=31517:84 | http://apex.oracle.com/pls/otn/f?p=31517:84]
I have my emp table
I've created with the wizard, on my page, a new AREA of REPORTEMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7839 KING PRESIDENT - 81-11-17 5000 - 10 7698 BLAKE MANAGER 7839 81-05-01 2850 - 30 7782 CLARK MANAGER 7839 81-06-09 2450 - 10 7566 JONES MANAGER 7839 81-04-02 2975 - 20 7788 SCOTT ANALYST 7566 82-12-09 3000 - 20 7902 FORD ANALYST 7566 81-12-03 3000 - 20 7369 SMITH CLERK 7902 80-12-17 800 - 20 7499 ALLEN SALESMAN 7698 81-02-20 1600 300 30 7521 WARD SALESMAN 7698 81-02-22 1250 500 30 7654 MARTIN SALESMAN 7698 81-09-28 1250 1400 30 7844 TURNER SALESMAN 7698 81-09-08 1500 0 30 7876 ADAMS CLERK 7788 83-01-12 1100 - 20 7900 JAMES CLERK 7698 81-12-03 950 - 30 7934 MILLER CLERK 7782 82-01-23 1300 - 10
-Selected SQL - RESULTS
-Name: Test
-Area Source Type: SQL Query
-Model region: region report
IN function enter SQL Query or PL/SQL returns a SQL query, I COPY-PASTE the following code to [http://apex.oracle.com/pls/otn/f?p=31517:84 | http://apex.oracle.com/pls/otn/f?p=31517:84]
AND I have this error:DECLARE p_vc_arr2 htmldb_application_global.vc_arr2; p_string VARCHAR2 (2000); BEGIN SELECT ename BULK COLLECT INTO p_vc_arr2 FROM emp WHERE deptno = :p84_select_deptno; p_string := HTMLDB_UTIL.table_to_string (p_vc_arr2, ':'); HTP.p (p_string); END;
+ 1 error has occurred.
Invalid query, no found select statement
Is not a PL/SQP selected?
Do I did wrong?
Thank you
Roseline Paquin
Montreal, Canada1 error has occurred
Invalid query, no found select statementWhat happens if you try
DECLARE p_vc_arr2 htmldb_application_global.vc_arr2; p_string VARCHAR2 (2000); BEGIN SELECT ename BULK COLLECT INTO p_vc_arr2 FROM emp WHERE deptno = :p84_select_deptno; return 'select ''' || HTMLDB_UTIL.table_to_string (p_vc_arr2, ':') || ''' str from dual'; END;
??
-
How to display the serial No. field not to mention that the search results displayed
How to display the serial No. field not to mention that the search results displayedHello
You missed to add the varstatus property in your table
Try with this code:
lines = ' #{bindings. " SahajDetailVO1.rangeSize}.
emptyText = "#{bindings." SahajDetailVO1.viewable? "{'No data to display.': 'Access Denied.'}".
fetchSize = "#{bindings." SahajDetailVO1.rangeSize}.
rowBandingInterval = "0" id = "t1" styleClass = "AFStretchWidth."
varStatus = 'vs' >
-
How to make a loop to display the results of each iteration?
I have a process inside a for loop and I want to display the results of 1, 2, 3 and 4 iterations all at once. Is it possible to do without creating 4 distinct for loops with a different constant for every N?
Thanks for the help.
-
How to display the speaker icon in the taskbar in windows 7?
How to display the "speaker" of the taskbar icon in windows 7?
Thank you
concerning
Jamal
Hi Jamal
1. right click on the taskbar, and then select Properties.
In the Notification area section, click the Customize button.
2. in the Configuration window, find the Volume icon.
The Drop Down Menu to select the icon lounge and Notifications.
3. If you don't see the Volume icon, click system icons activate or deactivate the link at the bottom of the window.
Find the Volume icon and select enabled in the menu dropdown.
Repeat step 2.
Let us know the results.
Concerning
-
How to take a SQL query result in the source section of an APEX "agenda of the page" field and allow this request to be formatted using XML in an HTML format for a Java Script file to perform a function on the result?
Currently I have the following text:
To query the DB table and format the result as HTML:
SELECT XMLELEMENT ("UL id ="ticker01"', XMLAGG (XMLFOREST (Scroll_Mess AS LI))") "item UL' OF Web_Ticker where Mess_Id < 10 order by Mess_Id;
That displays the following:
< UL id = "ticker01" > < LI > HELLO < /LI > < LI > HELLO < /LI > < /UL id = "ticker01" >
I need the output of this to be visible to a JScript function that is currently called the "head of page", but there doesn't seem to be its scope? The function works correctly if there is a list in the page field items 'Text element Pre' but does not work correctly when used in conjunction with the query to generate a table form.
If everyone is happy to help I would be grateful .
James.
Solved!
In order for the request to be part of the DOM of the page of the APEX, the Java Script allows to perform its function on the result marked "HTML" to query, you must set page of the apex on which the query resides and then add the inner text of this page to a second variable for which the function of web ticker can run on as follows:
$(function() {})
var x = $("#P9_TICKER_DATA");
var y = x [0] .innerText;
x.Append (y);
$("UL#ticker01").liScroll ();
});
From there, on the Java script is able to properly see the result of the query in HTML format.
Maybe you are looking for
-
Return all column names of the cells that match a value in a single cell
I want to be able to scan all the cells in column 1 in column 3 (there could be several) which belong to the same line and check if they all have a value y (X). If they have no value, I want all columns to display all the names of the matching column
-
How do horizontal scrolling via mousewheel tilt work in FF 20.0.0.1?
EDIT: I solved this problem on my end. It turns out that my mouse manufacturer had a "helper" program that has been screwing the horizontal tilt support. Stop smoking it solved the problem. To other people having the same problem, I recommend that yo
-
Wireless IP config...
can I have my computer (desktop) search / connect to a 'specific' wireless network, for example enter the RITS, IP, subnet, gateway, DNS ect... for a more precise and immediate connection?
-
Miss me some programs, the registry keys, dll files and some drivers. I can't gt the recovery of the system to work. 11/11/2010 06:53:58 User name: Prine Description of the process: Microsoft Data Access - "the ODBC Administrato
-
How to uninstall IE8 from Windows XP Pro SP3 system?
IE8 does not appear in the list "Add / Remove Programs". Simple removal of icons is futile. REGEDIT is impossible - the entries simply re - appear. Otherwise only by formatting the hard drive or purchase is 3rd party software, there a way to get r