473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Duplication of Records

With this simple query, I am getting a duplicated record of sets. Can any body help me in this regard


<?php
$conn = oci_connect('INKFISH_FAROOQ', 'farooq', '//localhost/XE');
$stid = ociparse($conn, 'SELECT * FROM INKFISH_ADMIN.INKFISH_USER');

$results=ociexecute($stid, OCI_DEFAULT);
print '<table border="1">';
while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS))
{
$item=null;
foreach ($row as $item) {
echo '<tr><td>'.($item?htmlentities($item):'&nbsp;').' </td></tr>';
}
}
print '</table>';
oci_close($conn);
?>
Aug 2 '06 #1
4 1787
ronverdonk
4,258 Expert 4TB
Do you mean that you have double $items in your table row? The result of statement

[PHP]echo '<tr><td>'.($item?htmlentities($item):'&nbsp;').' </td></tr>';[/PHP]

If so, the first item of the ternary probably is not seen as an expression by PHP.
In that case you could do this

[PHP]echo '<tr><td>'.(!empty($item)?htmlentities($item):'&nb sp;').'</td></tr>';[/PHP]

Hope this works.

Ronald :cool:
Aug 2 '06 #2
hi

I think u have to find the solution in SQL query.
while executing 'select * from table' , it fetches all the data .U have to try
this using primary key value. Since, it is used to avoid duplicates.

somas
---------




With this simple query, I am getting a duplicated record of sets. Can any body help me in this regard


<?php
$conn = oci_connect('INKFISH_FAROOQ', 'farooq', '//localhost/XE');
$stid = ociparse($conn, 'SELECT * FROM INKFISH_ADMIN.INKFISH_USER');

$results=ociexecute($stid, OCI_DEFAULT);
print '<table border="1">';
while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS))
{
$item=null;
foreach ($row as $item) {
echo '<tr><td>'.($item?htmlentities($item):'&nbsp;').' </td></tr>';
}
}
print '</table>';
oci_close($conn);
?>
Aug 6 '06 #3
bevort
53
Testing the echo(.... command works in both the original way and the included test with !empty(). The last is not nessecary but can be used to make the command more readable.
The ternary conditional operator structure uses the first expression to determen if the second or the third must be used. If a first string is not assign, so NULL, or "" (empty) does not matter. they will return False. If there is a single caracter or more the test will return True and use the second value

So it must be in the database.
I should check your table using a query tools and ask the same query directely to the database. If you have dubbles there they will show upp. Try diffeant sortings also

Vincent
Aug 7 '06 #4
epuck
1
You should add in "OCI_ASSOC" flag

Expand|Select|Wrap|Line Numbers
  1.  while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS))
This function was changed because of a php bug. http://bugs.php.net/bug.php?id=37487

gl
Nov 27 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: | last post by:
I have 2 tables from which I am pulling data for my query. If I pull ID from Table 1 and then pull corresponding measures from table 2, I get several repeats of my records for each row. So, if...
20
by: Steve Jorgensen | last post by:
A while back, I started boning up on Software Engineering best practices and learning about Agile programming. In the process, I've become much more committed to removing duplication in code at a...
2
by: perryche | last post by:
Experts, Bascially I want to avoid people entering duplicated records. However, the check for the duplication are in 2 separate fields. i.e. Field1 + Field2 can not be duplicated. What's the...
3
by: Tcc | last post by:
Hi All, Assume there are some data in "a.txt": e.g. ABC
0
by: darrel | last post by:
Hi vb wizard just wanna ask how can i prevent duplication of records in my records fields in access,,, i hope somebody can help me out here... am using sql statements, thank you
15
by: darrel | last post by:
hi vb master good day! i just wanted to ask for some help here.. i'am trying to prevent duplcation of records that will be save in my table... here my code: Private Sub cmdVerify_Click() Dim...
12
by: nathan | last post by:
Hello, Has anyone experienced that records get duplicated by itself. When I look in my tables backend mdb file there are 2 records with the same information. I'm sure the frontend created this...
7
by: =?Utf-8?B?S2F2aXRh?= | last post by:
We have one web application developed in .Net framework 1.1. This site is live on production server since one year and used across world by many users. But only one of the users is facing...
1
by: xraive | last post by:
I have a problem with this. Currently I am trying Allen's code and i am not successful. Current Design Table1 (Main Form) TravelID (PK) ApprovedBY EntreredBy BudgetCode ExpenseCode
3
by: boardingbo | last post by:
I'm using Access 2003 and have ran into an issue with one of my queries. The query pulls from two different queries and when it does so, it will squar the number of records that are duplicated. For...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.