Dynamic table with random records
What I'm trying to do is to select random records from a table and display them in a dynamic table with columns maximum equal to 3 and the 4th record to be on a new line. Here is what I have at the moment and he strives to select random records, but has no function to define the columns of a table. If there is a easier way feel free to let me know. I tried different ways to do it, but none seem not to work.< CFQUERY NAME = "getItems" DATASOURCE = "absi" >
SELECT catfit.*, modcats.*, prodmat.*, prod.* FROM catfit, modcats,.
prodmat, prod WHERE prodmat.prodid = catfit.prodid and catfit.catid is modcats.catid
ORDER BY ASC modl < / cfquery >
< cfif getItems.recordCount >
< cfset showNum = 3 >
< cfif showNum gt getItems.recordCount >
< cfset showNum = getItems.recordCount >
< / cfif >
< cfset itemList = "" > "".
< cfloop to = "#getItems.recordCount # '1' = ' index 'i' = >"
< cfset itemList = ListAppend (itemList, i) >
< / cfloop >
< cfset randomItems = "" > "".
< cfset itemCount = ListLen (itemList) >
< cfloop from = "1" = "" #itemCount # "index 'i' = >"
< cfset random = ListGetAt (itemList, plageAleatoire (1, itemCount)) >
< cfset randomItems = ListAppend (randomItems, random) >
< cfset itemList = ListDeleteAt (itemList ListFind (itemList, randomly)) >
< cfset itemCount = ListLen (itemList) >
< / cfloop >
< cfloop from = "1" = "" #showNum # "index 'i' = >"
< cfoutput >
< table width = "205" border = "0" align = "left" cellpadding = "0" cellspacing = "0" >
< b >
' (< td largeur = «235» height = «116» >< div align = «center» >< img src =»... /Products/ProductPictures/#GetItems.pic[ListGetAt(randomItems, i)] # "width ="100"> < / div > < table >
< /tr >
< b >
< class td = "ProdTitle" > #getitems.brand [ListGetAt (randomItems,
(i)] # #getitems.modl [ListGetAt (randomItems, i)] # < table >
< /tr >
< b >
< class td 'paragraph' = > $# getitems.prc [ListGetAt (randomItems,
(i)] # < table >
< /tr >
< b >
"< td > < A href =".. /Products/details.cfm? ' ProdID = #GetItems.ProdID [ListGetAt (randomItems, i)] # "class ="linkcontact"> more
Info < /a > < table >
< /tr >
< b >
< td > < table >
< /tr >
< /table >
< / cfoutput >
< / cfloop >
< / cfif >
To start a new line after 3 disks, do something like this.
#data #. | |
You should also know that your approach is very inefficient in what you bring to cold fusion more data that you need. First you select all fields from 3 tables when you don't seem to use all the. Then, you select all the records and you only want to use 3. There are better ways out there, but they are specific db and you didn't say what you use.
Tags: ColdFusion
Similar Questions
-
create a table with 2000 records
Hello
can someone guide me to create a table with 2000 records
the columns and data types are as follows
number of inventory_item_id
number of organization_id
number of process_flag
transaction_type varchar
number of set_process_id
number of min_minmax_quantity
number of max_minmax_quantity
process_flag is always have a value of 1, set_process_id always has the value 3 and transaction_type should be done with the update and the remaining columns will have different values
kindly guide me
thanking in advanceIt doesn't really matter what you... just trying to generate the insert statement in excel first on each row and then cut and paste... and make sure that they are syntactically correct before running each other and engage
-
Dynamic table with drop-down lists
I have a dynamic array with a header row, row in Section, and footer.
Section has the cells (columns) next: Cell1 (drop-down with locations), button (to remove the line), CCode (RAL color Code), CName (name of the color).
I start with 1 row.
now what I want to do is, when they select in Lignesde for example RAL 1003 (rawValue '1') then in CName must appear the name "yellow signal" (rawValue '1').
I am using javascript
My first problem is how do I know what value is chosen, because this does not work:
If (this.rawValue == 1)
{
xfa.host.messageBox ('Today')
}
and on the other hand, how to set the CName value
because it affects only in the first cell CName:
xfa.form.DataSheet.TechnicalInformation.Markings.THatchPatterns.Section.CName.rawValue
= '1';Please help me, I'm totally lost
solved the problem, instead on the change event to put the script on the exit event.
and the trick is the following line:
xfa.resolveNode ("THatchPatterns.Section [" + this.parent.index + "]"). This.rawValue = CCode.rawValue
-
Fill the table with random values
Another thing I've come across is this:
the table name is LOR, who has 3 fields NUMBER, DATA, TEXT with number, date and varchar2 data type.
On a page, I have a text field where if I write 3, then it would add 3 lines to the table with predefined values ("number, something like 2222, for 12 January 09, and for text, something like" Lorem ipsum dolor sit amet, 195kgs adipisicing elit"). So basically, with the number that I give, it populates the table with lines... How can I do this? Thanks for helping meINSERT INTO LOR SELECT 222 , sysdate , 'you string' FROM dual CONNECT BY level <= :Pxx_
-
Matching records between 2 tables with duplicate records
Hi all
I need help in what follows.
I have 2 tables Received_bills and Send_bills.
-------------------------------------------------------
-The DOF for Table SEND_BILLS
--------------------------------------------------------
CREATE TABLE SEND_BILLS
(DATE OF "DATUM",
NUMBER OF "PAYMENT."
'CODE' VARCHAR2 (5 BYTE)
) ;
--------------------------------------------------------
-The DOF for Table RECEIVED_BILLS
--------------------------------------------------------
CREATE TABLE 'RECEIVED_BILLS '.
(DATE OF "DATUM",
NUMBER OF "PAYMENT."
'CODE' VARCHAR2 (5 BYTE),
VARCHAR2 (5 BYTE) 'STATUS' ) ;
INSERTION of REM in RECEIVED_BILLS
TOGETHER TO DEFINE
Insert. RECEIVED_BILLS (DATUM, PAYMENT, CODE, STATE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 'A5', 'SUCCESS', 25);
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
INSERTION of REM in SEND_BILLS
TOGETHER TO DEFINE
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('09-OCT-15','DD-MON-RR'), 19, 'A8');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 20, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
I match all records of send_bills and received_bills with a status of 'SUCCESS' There is no single column in the table.
Correspondence held payment of columns, the code and the scratch cards, but it may also duplicate records. But even if there are duplicates, I also need those records in the query results
the query I wrote is this:
SELECT SEND.*
REC received_bills, send_bills send
WHERE send.datum = rec.datum
AND send.payment = rec.payment
AND send.code = rec.code
AND 'rec.status =' SUCCESS
;
The query results give me this
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 The result of the correct application would be
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 The select statement that I need I want to use a loop to insert records in another table.
Can someone help me please?
Thanks in advance.
Best regards
Caroline
Hi, Caroline.
Caroline wrote:
Hi all
I need help in what follows.
I have 2 tables Received_bills and Send_bills.
-------------------------------------------------------
-The DOF for Table SEND_BILLS
--------------------------------------------------------
CREATE TABLE SEND_BILLS
(DATE OF "DATUM",
NUMBER OF "PAYMENT."
'CODE' VARCHAR2 (5 BYTE)
) ;
--------------------------------------------------------
-The DOF for Table RECEIVED_BILLS
--------------------------------------------------------
CREATE TABLE 'RECEIVED_BILLS '.
(DATE OF "DATUM",
NUMBER OF "PAYMENT."
'CODE' VARCHAR2 (5 BYTE),
VARCHAR2 (5 BYTE) 'STATUS');
INSERTION of REM in RECEIVED_BILLS
TOGETHER TO DEFINE
Insert. RECEIVED_BILLS (DATUM, PAYMENT, CODE, STATE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 'A5', 'SUCCESS', 25);
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
INSERTION of REM in SEND_BILLS
TOGETHER TO DEFINE
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('09-OCT-15','DD-MON-RR'), 19, 'A8');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 20, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
I match all records of send_bills and received_bills with a status of 'SUCCESS' There is no single column in the table.
Correspondence held payment of columns, the code and the scratch cards, but it may also duplicate records. But even if there are duplicates, I also need those records in the query results
the query I wrote is this:
SELECT SEND.*
REC received_bills, send_bills send
WHERE send.datum = rec.datum
AND send.payment = rec.payment
AND send.code = rec.code
AND 'rec.status =' SUCCESS
;
The query results give me this
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 The result of the correct application would be
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 The select statement that I need I want to use a loop to insert records in another table.
Can someone help me please?
Thanks in advance.
Best regards
Caroline
Want to get answers that work? Then make sure that the CREATE TABLE and INSERT statements you post too much work. Test (and, if necessary, correct) your statements before committing. You have a stray "." in the first INSERT statement for received_bills and receikved_bills.status is defined as VARCHAR2 (5), but all values are 6 characters long.
There are 5 lines in send_bills that are similar to the
10 OCTOBER 2015 19 A1
Why do you want that 2 rows like this in the output, not 1 or 3, or 4 or 5? Is it because there are 2 matching rows in received_bills? If so, you can do something like this:
WITH rec AS
(
SELECT the reference, payment, code
, ROW_NUMBER () OVER (PARTITION BY datum, payment, code)
ORDER BY NULL
) AS r_num
OF received_bills
Situation WHERE = 'SUCCESS'
)
send AS
(
SELECT the reference, payment, code
, ROW_NUMBER () OVER (PARTITION BY datum, payment, code)
ORDER BY NULL
) AS r_num
OF send_bills
)
SELECT send.datum, send.payment, send.code
REC, send
WHERE send.datum = rec.datum
AND send.payment = rec.payment
AND send.code = rec.code
AND send.r_num = rec.r_num
;
Note that the main request is very similar to the query you posted, but the last condition has changed.
If you need to insert these lines in another table, you can use this query in an INSERT statement. There is no need of a loop, or for any PL/SQL.
-
a few fields in double writing to another table with separate records
I have a requirement to write a few fields in duplicate a table and writes the separate records to another table. Please find the script below and share your ideas
TableName: EMP_DETAIL
EMPNO Date of birth CITY STATE GRADE 123 05051982 FREMONT CA A 456 05051982 FREMONT CA B 789 05051982 FREMONT CA C 222 02021975 SANJOSE CA D (1) in table EMP_DETAIL, if we have duplicate fields date of birth, CITY AND STATE and take everything save random duplicates of this field and write in another table EMP_DETAILS_DISTINCT
EXPECTED RESULTS: EMP_DETAILS_DISTINCT
EMPNO Date of birth CITY STATE GRADE 123 05051982 FREMONT CA A 222 02021975 SANJOSE CA D (2) in the EMP_DETAIL table, I want to search only duplicates of birth date, CITY AND STATE fields and write only duplicate in another EMP_DETAILS_DUPLICATE table records
EXPECTED RESULTS: EMP_DETAILS_DUPLICATE
EMPNO Date of birth CITY STATE GRADE 123 05051982 FREMONT CA A 456 05051982 FREMONT CA B 789 05051982 FREMONT CA C Thank you!
For the first query
1) insert into EMP_DETAILS_DISTINCT select * from EMP_DETAIL where rowid in (select min (rowid) of the EMP_DETAIL group by date of birth, CITY, STATE);
For the second query
(2) insert into select EMP_DETAILS_DUPLICATE * from EMP_DETAIL where rowid not in (select min (rowid) of the Group EMP_DETAIL by DOD, CITY, STATE)
Hope this will help you.
Good day.
-
Create a table with blank records
Hello
I want to create a form in a table to insert several records! However, I have difficulties to identify ways to display the form as 'not empty' i.e. no table existing records appear on the form. I tried to resolve the query, the form is based on the 'automatic' query returns no records, but this caused the fields "disappear". Can anyone recommend the best way to do it (if possible)
Kind regards
Kevin.Kevin,
In this case what you can do, is make the unconditional dynamic action and change your query does not return all records.
select "EXPENSE_ID", "DESCRIPTION", "SPEND_DATE", "SPEND_COST" from "#OWNER#"."EXPENSESSPEND" where 1=2
See you soon,.
Janet Tyson -
Rendering a table with several records by "rank".
OK, that's how. I have a collection that I want to make it as Table of ADF with a single column. Unless I want to make several entries in the collection by the row in the table
that is a normal table of the FAD would be like:
[Column header]
[Row1.TextField]
[Row2.TextField]
[Row3.TextField]
[Row4.TextField]
[Row5.TextField]
I want to make something like:
[Column header]
[Row1.TextField] [Row2.TextField] [Row3.TextField]
[Row4.TextField] [Row5.TextField]
That is, I want to add the fields in each record horizontally first before adding a new row vertically.
Any way to do it with the Table of the ADF? Or is there something else I should use?Hello
You can try the component 'af:iterator '.example of
Concerning
Nicolas
-
dynamic table overlap other objects!
Hello world
I created a dynamic table with button to add a line
Please can someone tell me how to avoid the overlapping of dynamic array objects below when several lines are created?
what I wish is that the table bumps everything on its way like MSWord packaging option
Please provide a flash tutorial if you can train a lot of people ask this topic
Hello
Use fluid page layout to avoid overlapping of table on other objects. This fluid layout must be set on the container parent (form/subform) of the table. Put also other objects in the same container. It results in dynamic container resizing, whenever the new row is added.
Thank you.
-
Afonso
-
I have a problem with a CS6 dynamic table creation
I have 2 tables, 1 of them is caled 'user', the other a "cars" they are inked with a foreign key in the table of cars there is a column called UserID and takes the value of "user", so my question is I tried to make it dynamic table when the user is connected to display its cars that have his Userid on them only unfortunetly when I do this I get a blank table with nothing in it anyone can help me solve this problem. This is the code I use:
<? php require_once('Connections/MyConnection.php');? >
<? PHP
initialize the session
If (! isset {})
session_start();
}
* Log out the current user. **
$logoutAction = $_SERVER ['PHP_SELF']. » ? doLogout = true;
If ((isset & & ($_SERVER ['QUERY_STRING']! = "")) {})
$logoutAction. = '& '. htmlentities($_SERVER['QUERY_STRING']);
}
{If ((isset($_GET['doLogout'])) & & ($ {_GET ['doLogout'] == "true"))}
to completely disconnect a visitor, you must delete the session varialbles
$_SESSION ['MM_Username'] = NULL;
$_SESSION ['MM_UserGroup'] = NULL;
$_SESSION ['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "/ cars/LogOut.php";
If {($logoutGoTo)
Header ("Location: $logoutGoTo");
"exit";
}
}
? >
<? PHP
If (! isset {})
session_start();
}
$MM_authorizedUsers = '1', 2;
$MM_donotCheckaccess = "false";
Restrict access to Page: grant or deny access to this page
Function isAuthorized ($strUsers, $UserGroup, $strGroups, $UserName) {}
For safety, first assuming that the visitor is NOT allowed.
$isValid = false;
When a visitor is connected to this site, the MM_Username of Session variable value equal to their username.
So, we know that a user is NOT logged if this Session variable is empty.
If (! empty ($UserName)) {}
In addition to being connected, you can restrict access to only certain users based on a created ID when they connect.
Analyze the channels in the tables.
$arrUsers = explode (",", $strUsers);
$arrGroups = explode (",", $strGroups);
If (in_array ($UserName, $arrUsers)) {}
$isValid = true;
}
Or, you can restrict access to only certain users based on their user name.
If (in_array ($UserGroup, $arrGroups)) {}
$isValid = true;
}
If (($strUsers == "") & & false) {}
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "/ cars/Home.php";
If (!) {(((isset($_SESSION['MM_Username']))) & & (isAuthorized ("", $MM_authorizedUsers, $_SESSION ['MM_Username'], {$_SESSION ['MM_UserGroup']})))}
$MM_qsChar = ';?
$MM_referrer = $_SERVER ['PHP_SELF'];
If (strpos ($MM_restrictGoTo, "?")) $MM_qsChar = "&";
If (isset($_SERVER['QUERY_STRING']) & & strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer. = « ? ». $_SERVER ['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar. "accesscheck =". UrlEncode ($MM_referrer);
Header ("Location:".) $MM_restrictGoTo);
"exit";
}
? >
<? PHP
If (! function_exists ("GetSQLValueString")) {}
function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
If (via PHP_VERSION < 6) {}
$theValue = get_magic_quotes_gpc()? stripslashes ($TheValue): $theValue;
}
$theValue = function_exists ("mysql_real_escape_string")? mysql_real_escape_string ($TheValue): mysql_escape_string ($theValue);
Switch ($theType) {}
case 'text ':
$theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";
break;
case "long":
case "int":
$theValue = ($theValue! = "")? intval ($TheValue): 'NULL ';
break;
case "double":
$theValue = ($theValue! = "")? doubleVal ($TheValue): 'NULL ';
break;
case "date":
$theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";
break;
case "set":
$theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;
break;
}
Return $theValue;
}
}
If (! function_exists ("GetSQLValueString")) {}
function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
If (via PHP_VERSION < 6) {}
$theValue = get_magic_quotes_gpc()? stripslashes ($TheValue): $theValue;
}
$theValue = function_exists ("mysql_real_escape_string")? mysql_real_escape_string ($TheValue): mysql_escape_string ($theValue);
Switch ($theType) {}
case 'text ':
$theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";
break;
case "long":
case "int":
$theValue = ($theValue! = "")? intval ($TheValue): 'NULL ';
break;
case "double":
$theValue = ($theValue! = "")? doubleVal ($TheValue): 'NULL ';
break;
case "date":
$theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";
break;
case "set":
$theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;
break;
}
Return $theValue;
}
}
$maxRows_cars = 10;
$pageNum_cars = 0;
If (isset($_GET['pageNum_cars'])) {}
$pageNum_cars = $_GET ['pageNum_cars'];
}
$startRow_cars = $pageNum_cars * $maxRows_cars;
$colname_cars = "-1";
If (isset($_SESSION['MM_Username'])) {}
$colname_cars = $_SESSION ['MM_Username"];
}
@mysql_select_db ($database_MyConnection, $MyConnection);
$query_cars = sprintf ("" SELECT * FROM cars WHERE UserID = %s ", GetSQLValueString ($colname_cars,"int")");
$query_limit_cars = sprintf ("%s LIMIT %d, %d", $query_cars, $startRow_cars, $maxRows_cars);
$cars = mysql_query ($query_limit_cars, $MyConnection) or die (mysql_error ());
$row_cars = mysql_fetch_assoc ($cars);
If (isset($_GET['totalRows_cars'])) {}
$totalRows_cars = $_GET ['totalRows_cars'];
} else {}
$all_cars = mysql_query ($query_cars);
$totalRows_cars = mysql_num_rows ($all_cars);
}
$totalPages_cars = ceil($totalRows_cars/$maxRows_cars)-1;
$colname_user = "-1";
If (isset($_SESSION['MM_Username'])) {}
$colname_user = $_SESSION ['MM_Username"];
}
@mysql_select_db ($database_MyConnection, $MyConnection);
$query_user = sprintf ("SELECT * FROM 'user' WHERE Email = %s", GetSQLValueString ($colname_user, "text") ");
$user = mysql_query ($query_user, $MyConnection) or die (mysql_error ());
$row_user = mysql_fetch_assoc ($user);
$totalRows_user = mysql_num_rows ($user);
$colname_user = "-1";
If (isset($_SESSION['MM_Username'])) {}
$colname_user = $_SESSION ['MM_Username"];
}
@mysql_select_db ($database_MyConnection, $MyConnection);
$query_user = sprintf ("SELECT FirstName, LastName FROM 'user' WHERE Email = %s", GetSQLValueString ($colname_user, "text") ");
$user = mysql_query ($query_user, $MyConnection) or die (mysql_error ());
$row_user = mysql_fetch_assoc ($user);
$colname_User = "-1";
If (isset($_SESSION['MM_Username'])) {}
$colname_User = $_SESSION ['MM_Username"];
}
@mysql_select_db ($database_MyConnection, $MyConnection);
$query_User = sprintf ("SELECT * FROM 'user' WHERE Email = %s", GetSQLValueString ($colname_User, "text") ");
$User = mysql_query ($query_User, $MyConnection) or die (mysql_error ());
$row_User = mysql_fetch_assoc ($User);
$colname_User = "-1";
If (isset($_GET['MM_Username'])) {}
$colname_User = $_GET ['MM_Username"];
}
@mysql_select_db ($database_MyConnection, $MyConnection);
$query_User = sprintf ("SELECT * FROM 'user' WHERE Email = %s", GetSQLValueString ($colname_User, "text") ");
$User = mysql_query ($query_User, $MyConnection) or die (mysql_error ());
$row_User = mysql_fetch_assoc ($User);
$colname_User = "-1";
If (isset($_SESSION['MM_Username'])) {}
$colname_User = $_SESSION ['MM_Username"];
}
@mysql_select_db ($database_MyConnection, $MyConnection);
$query_User = sprintf ("SELECT * FROM 'user' WHERE Email = %s", GetSQLValueString ($colname_User, "text") ");
$User = mysql_query ($query_User, $MyConnection) or die (mysql_error ());
$row_User = mysql_fetch_assoc ($User);
$colname_User = "-1";
If (isset($_SESSION['MM_Username'])) {}
$colname_User = $_SESSION ['MM_Username"];
}
@mysql_select_db ($database_MyConnection, $MyConnection);
$query_User = sprintf ("SELECT * FROM 'user' WHERE UserID = %s", GetSQLValueString ($colname_User, "int") ");
$User = mysql_query ($query_User, $MyConnection) or die (mysql_error ());
$row_User = mysql_fetch_assoc ($User);
? >
< ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""
" < html xmlns =" http://www.w3.org/1999/xhtml ">
< head >
< link href = "CSS/Layout.css" rel = "stylesheet" type = "text/css" / > "
< link href = "CSS/Menu.css" rel = "stylesheet" type = "text/css" / > "
"< link href="/Cars/CSS/VerticalMenu.css "rel ="stylesheet"type =" text/css"/ >
< meta http-equiv = "Content-Type" content = text/html"; charset = utf-8 "/ >"
< title > Untitled Document < /title >
< / head >
< body >
< div id = 'Holder' >
< div id = "Header" >
< div id = "HeaderContentRight" >
< table width = "0" border = "0" align = "right" >
< b >
< td > logged in as: <? PHP echo $row_user ["FirstName"];? > <? PHP echo $row_user ['name'];? > < table >
< td > < a href = "<?" PHP echo $logoutAction? > "> sign out < /a > < table >"
< /tr >
< /table >
< / div >
< / div >
< div id = "NavBar" >
< nav >
< ul >
"< li > < a href="/Cars/HomeAccount.php "> home < /a > < /li >
< /ul >
< / nav >
< / div >
< div id = "Content" >
< div id = "PageHeading" >
Welcome < h1 >, <? PHP echo $row_user ["FirstName"];? > <? PHP echo $row_user ['name'];? >! < / h1 >
< / div >
< div id = "ContentLeft" >
Control Panel < h6 > < / h6 >
< p > < / p >
< ul id = "MyMainMenu" >
< li > < a href="/Cars/Account.php" > account < /a > < /li > ".
< li > < a href="/Cars/UpdateAccount.php" > update account < /a > < /li > ".
< li > < a href="/Cars/CarManagment.php" > car management < /a > < /li > ".
< /ul >
< / div >
< div id = "ContentRight" >
< table border = "1" align = "center" >
< b >
CarBrand < td > < table >
CarModel < td > < table >
YearOfProduction < td > < table >
< /tr >
<? PHP {? >}
< b >
< td > <? PHP echo $row_cars ["CarBrand'];? > < table >
< td > <? PHP echo $row_cars ["CarModel'];? > < table >
< td > <? PHP echo $row_cars ["YearOfProduction"];? > < table >
< /tr >
<? PHP} while ($row_cars = mysql_fetch_assoc ($cars));? >
< /table >
< / div >
< / div >
< div id = "Footer" > < / div >
< / div >
< / body >
< / html >
<? PHP
mysql_free_result ($CARS);
mysql_free_result ($User);
? >
Thank you for your time!
Nowhere on this page I see that you have found the "UserID" variable that is used to query the database of cars everywhere.
You must get that table "user" when a successful connection occurred.
Go to your login page and find the code which queries the database (it will look something like the below, your request will be slightly different)
$LoginRS__query = sprintf ("SELECT username, password loginUsers WHERE username = %s AND password is %s",
MAKE SURE YOU add to THE QUERY "UserID" (see below.) This is the column of your 'user' table and the foreign key record unique identifier in your table 'cars')
$LoginRS__query = sprintf ("SELECT UserID, username, password AND password loginUsers WHERE username = %s is %s",
Then, find the lines of code below:
$LoginRS = mysql_query ($LoginRS__query, $MyConnection) or die (mysql_error ());
$loginFoundUser = mysql_num_rows ($LoginRS);
Include these two lines of code directly after the above code:
$row = mysql_fetch_assoc ($LoginRS);
$UserID = $row ['UserID']
Can find these lines of code:
If {($loginFoundUser)
$loginStrGroup = "";
Declare two session variables and assign them
$_SESSION ['MM_Username"] = $loginUsername;
$_SESSION ["MM_UserGroup"] = $loginStrGroup;
Add this line of code directly after the above code:
$_SESSION ['username'] = $UserID;
Now, go to the login page of success (whatever you call that)
Find the code at the top of the page below:
If (! isset {})
session_start();
}
Add the line of code below:
If (! isset {})
session_start();
$userID = $_SESSION ['username'];
}
Look for the query:
@mysql_select_db ($database_MyConnection, $MyConnection);
$query_cars = sprintf ("" SELECT * FROM cars WHERE UserID = %s ", GetSQLValueString ($colname_cars,"int")");
$query_limit_cars = sprintf ("%s LIMIT %d, %d", $query_cars, $startRow_cars, $maxRows_cars);
$cars = mysql_query ($query_limit_cars, $MyConnection) or die (mysql_error ());
$row_cars = mysql_fetch_assoc ($cars);
and replace with:
@mysql_select_db ($database_MyConnection, $MyConnection);
$query_query_cars = "SELECT * FROM cars WHERE userID ="$userID "";
$query_cars = mysql_query ($query_query_cars, $MyConnection) or die (mysql_error ());
$row_query_cars = mysql_fetch_assoc ($query_cars);
$totalRows_query_cars = mysql_num_rows ($query_cars);
Now, you can pass the details of the car associated with the user ID in the 'user' table and a foreign key in the table "cars."
You probably want to use a / while loop to get all the information from the database. With a DW repeat region behavior.
-
Dynamic SQL with in bulk in the record type
Oracle 10.2 g
I received this Tom
[http://asktom.oracle.com/pls/apex/f?p=100:11:0:NO:]
I'm able to do this without dynamic SQL, but my requirement is to do it in dynamic SQL
There is a work around in 11g, but can we do something in 10g?create table t1 ( x int, y int ); insert into t1 select rownum, rownum+1 from all_users where rownum <= 5; create table t2 ( x int, y int, z int ); declare type array is table of t1%rowtype; l_data array; begin select * bulk collect into l_data from t1; forall i in 1 .. l_data.count execute immediate 'insert into (select x, y from t2) values :x' using l_data(i); end; Error at line 1 ORA-06550: line 9, column 90: PLS-00457: expressions have to be of SQL types ORA-06550: line 9, column 20: PL/SQL: Statement ignored
Thank you
HESH.HESH wrote:
but following does not.
declare type array is table of t1%rowtype; l_data array; begin select * bulk collect into l_data from t1; forall i in 1 .. l_data.count execute immediate 'insert into (select x, y from t2) values :x' using l_data(i); end;
I want just a dynamic SQL code for the insert with FORALL statement would adopt as well as collections.
Doesn't make much sense.
Extract you the data from the SQL engine in the table of the record type. If the output data that cursor SQL must be read in the SQL engine and copied into the memory of PL/SQL engine.
Then, you send that VERY SAME DATA back to the SQL engine to be used by a SQL insert cursor.
Where is the logic behind the extraction of data from SQL in a PL/SQL table structure and then push this same structure table on the SQL engine database? What is the purpose to send data on a detour of underperforming and non-scalale through the PL/SQL engine?
You have any justification (technical or functional wise) to back up this absurd approach?
Why this can be achieved using a single SQL cursor that does both the choice (extraction) and (in bulk) insertion - using the plain old INSERT... SELECT structure?
And if the insert is variable, then what? Create a dynamic INSERT... SELECT cursor and execute it (using bind values). This simple... Right?
-
DB update multiple records in a table with a form
I'm developing an online proofing system that displays a number of images and then allow the client to approve each image, but also to comment.
I currently have a configuration table with the different elements (an image dynamically takes its name, details about the image and the required form fields). See this Image for layout
I would then apply a repeat region (the number of signs vary) and you want to update all records with feedback from the customer and approval with a single form. How this is done? I downloaded a trial of the Toolbox for developers, but the documentation is horrible. I'd be willing to buy an extension that will allow, as appropriate.
I found an extension that does this in two minutes:
http://www.WebAssist.com/Professional/products/ProductDetails.asp?pid=117
Great software, highly recommended. Easy to figure out and got this "problem" solved quickly.
-
because I don't have a sensor now, I am currently generating a table of random numbers 30. After each 5 readings a warning should be given to the user 5 readngs are completed. This cycle must be repeated. the size of the table is 30.
Please help me, waiting for response as soon as possible.
Once I have the transducer, I'll take 30 analog samples and then after each 5 smaples this wraning will be displayed din a new VI
Use a while loop with a delay time representing your sampling interval.
Use is equal to the count Terminal to see if 4, then 4th iteration = 5th sample.
Use a box structure. The real deal will only run on the 4th iteration.
In the case of true place a Subvi with your message of your choice in the front panel. Go to the properties of the VI window and set ' open the front panel when it is called.
The condition to closing of attention is not given to your description.
Consider that rather than usign a Subvi to do this, you can use the "dialog box one/two/three button" or "display message" live in the palette "user interface and dialogue."
Please try it out and send your own VI. Do not provide us with a working solution.
Kind regards
-
How can I cerate a table with a set of numbers saying 1 to 12 random order but no recurrence.
How can I cerate a table with a set of numbers saying 1 to 12 random order but no recurrence.
I know it should be easy, but my brain doesn't work right now
-
Best way to generate a record per day from a table with the dates of the FEP/exp
Hello
A table equipped with various attributes and a date of eff and exp. for example Attributeto, 05/01/2012, 16/05/2012
We want to create another table in this table for a record per day. for example 16 documents.
What is the best way to achieve this in OWB?
Thank youAssuming that you have a calendar table, then you can reach your rate table corresponding to the date table schedule between the table rates start date and end date.
Something like:
Select a.rate, rate_table b., calendar_table b.
where b. between a.start_date and a.end_dateshould translate easily into a join of two tables in OWB?
Concerning
User909022
Maybe you are looking for
-
I found that after a few weeks of non-use, some of the keys on my keyboard no longer works, 'remove' caplock and 'space '. Everything else works. No calamity to the keyboard that I am aware. Is it repairable?
-
Why in my iphotos should I "4 568" in my photo section but in events I "6 091" should not be the same number in both sections. Im confused?
-
Xbox Gears of War Ultimate Edition
Do not write in 'support' so I write here. I bought thexbox a ultimate edition of war gear, and the problem is that I don't know how to get gears of war 2, Gears of war 3 and gears of war stop. They go to komlekte, I read that you need to wait for ba
-
Password: can not get in line and my laptop will not accept my password
yesterday morning I went online with no problems, but when I tried later in the day that my phone does not accept that my password so could not get online - tried again this morning without modification.
-
8 of window relocation ASSISTANCE
I have a laptop 2c25dx 2000, and I hated window 8 so I tried to install Windows 7 but did not work. Readers are all deleted so how can I reinstall window 8? I don't have any drive in my possession. Help, please.