473,796 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Foreach displaying data twice

I must be missing something rather obvious. I have the following
snippet of code that echo's my result twice when it should be echoing
just once (only one element in the array). What am I overlooking?
*************** *************** **
$OpenQ = mysql_query("SE LECT column FROM table WHERE q_uid =
$_SESSION[userid] AND status = 1",$db); // SQL query on DB returns 1
result

$Qresult = mysql_fetch_arr ay($OpenQ); // Fetch the array

if ($_GET['OQ']) { // If the get variable is recieved
foreach ($Qresult as $Q) {
echo "<br>" . $Q;
}
}

*************** *************** ***

TY.

Jun 1 '07
16 4514
Message-ID: <MM************ ******@bignews3 .bellsouth.netf rom tomb
contained the following:
>Try www.technetcenter.com - they aren't perfect, but they are very
helpful and the hosting packages are really great.
Changing to a more helpful host is probably the best idea but it's not
really an option at the moment.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jun 2 '07 #11
Geoff Berrow wrote:
Message-ID: <MM************ ******@bignews3 .bellsouth.netf rom tomb
contained the following:
>Try www.technetcenter.com - they aren't perfect, but they are very
helpful and the hosting packages are really great.

Changing to a more helpful host is probably the best idea but it's not
really an option at the moment.
Changing hosts is *always* an option.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 2 '07 #12
At Sat, 02 Jun 2007 10:57:13 +0100, Geoff Berrow let h(is|er) monkeys
type:
Message-ID: <wt************ *************** ***@comcast.com from Jerry
Stuckle contained the following:
>>Any suggestions?
Thanks Jerry, I suspected I was being fobbed off and told them so.

An equally unhelpful reply followed:-

"Dear customer,

The script might work elsewhere, but that is on a different server with
a different configuration. We will not assist you with troubleshooting
your scripts. You will need to establish the cause of the problem
yourself and resolve it accordingly. "
Aha, the typical "Not my problem" approach. Goes hand in hand with "We
don't make any mistakes. Your fault". Change hosts. ASAP. Waste of money &
energy. And tell them why you leave. And make sure you tell everyone about
this utterly poor service. Take your losses, and if they sold you a
product including service, just don't pay for what they don't deliver.

Good luck.
--
Schraalhans Keukenmeester - sc*********@the .Spamtrapexampl e.nl
[Remove the lowercase part of Spamtrap to send me a message]

"strcmp('apples ','oranges') < 0"

Jun 2 '07 #13
Geoff Berrow kirjoitti:
I have an upload script which I want to use to upload word documents.
This works fine on my Gradwell account. However on the client's
(windows) hosting it fails.

C:\WINDOWS\TEMP \php29D.tmp
Warning: copy(papers/1180718015test. doc) [function.copy]: failed to open
stream: Permission denied in
\\nas01\nas\i\s \isbe2007.org\w eb\uploaddoc.ph p on line 22

I emailed support (Namesco) and received this reply
>>There is no need to change permissions on Windows hosting. Your files by
default have the permissions to write to directories owned by your own
user.

Any suggestions?
Did you try move_uploaded_f ile() instead of copy()? If the host has
configured php to safe mode, this might make a difference.

It also might be that the host company are wankers who don't know their
heads from their asses, but the basic thing is that when you handle
uploaded files, you should always use move_uploaded_f ile() instead of
copy, and it's worth testing at least.

--
Ra*********@gma il.com

"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
Jun 2 '07 #14
Message-ID: <x4************ *************** ***@comcast.com from Jerry
Stuckle contained the following:
>Changing to a more helpful host is probably the best idea but it's not
really an option at the moment.

Changing hosts is *always* an option.
It may come to that but the possible disruption would not be welcome at
the moment as the site is in active use.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jun 2 '07 #15
Geoff Berrow wrote:
Message-ID: <x4************ *************** ***@comcast.com from Jerry
Stuckle contained the following:
>>Changing to a more helpful host is probably the best idea but it's not
really an option at the moment.
Changing hosts is *always* an option.

It may come to that but the possible disruption would not be welcome at
the moment as the site is in active use.
And when will it never be "in active use"? Once a site is exposed to
the internet, it's ALWAYS considered active.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 3 '07 #16
Message-ID: <a7************ *************** @news.speedlinq .nlfrom
Schraalhans Keukenmeester contained the following:
>The script might work elsewhere, but that is on a different server with
a different configuration. We will not assist you with troubleshooting
your scripts. You will need to establish the cause of the problem
yourself and resolve it accordingly. "

Aha, the typical "Not my problem" approach. Goes hand in hand with "We
don't make any mistakes. Your fault". Change hosts. ASAP. Waste of money &
energy. And tell them why you leave. And make sure you tell everyone about
this utterly poor service. Take your losses, and if they sold you a
product including service, just don't pay for what they don't deliver.
I've had an apology and personal phone call from a senior developer.
They are blaming on 'a bug in FrontPage that causes it to remove the
permissions required for uploading from a script when it is installed'.

In addition we are also moving the site to Linux hosting as soon as
possible.

So, a result. Thanks for all your help and support guys.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jun 4 '07 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2922
by: Mountain Man | last post by:
Hi, I'm having trouble with the foreach function. I'm using it twice inside a user defined function with two different arrays, and in the second instance it's returning the value of the first key for all the keys. My code is shown below and the problem areas are marked with comments. In case you're wondering, this script is for generating sticky checkboxes that include an event handler. Many thanks to anyone who can help.
3
1964
by: pmud | last post by:
Hi, I have 4 columns in my sql database table. I added a data adapter , data set & a data grid to view this information. But the data grid is displaying those 4 columns TWICE , i.e in the data grid i see 8 columns. In case this is useful, the primary key is Serial no. which is an identity ....i.e everytime a row is added to the database, it increments by1. Also, when i configured the data adapter, it couldnt Generate the UPDATE &...
7
5551
by: Phil | last post by:
Hi, I read somewhere that the new version (v1.1) has improved the performance of 'foreach' over 'for'. Is that true? I did some measurements and I still think for has an upperhand... ? Phil
104
7204
by: cody | last post by:
What about an enhancement of foreach loops which allows a syntax like that: foeach(int i in 1..10) { } // forward foeach(int i in 99..2) { } // backwards foeach(char c in 'a'..'z') { } // chars foeach(Color c in Red..Blue) { } // using enums It should work with all integral datatypes. Maybe we can step a bit further: foeach(int i in 1..10, 30..100) { } // from 1 to 10 and 30 to hundred
2
4364
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control displaying the contents of the data source, whilst another control updates the datasource via a command buttons implementation of 'Click', an event raised in the 'Handle Postback Events' stage of the control execution life cycle (via the...
4
1912
by: Jack | last post by:
Hi, I have the following Access DDL statment from which I generated a access table: CREATE TABLE TEST1 (ID COUNTER, NAME TEXT(50), STORAGESPACEASSIGNED TEXT(50) )
3
3011
by: monomaniac21 | last post by:
//this loop doesnt work as intended, each row displays twice, once with a number as $key and again with key name as $key!? Any ideas why? $result = mysql_query("SELECT * FROM tbl WHERE id = '1' "); while($row = mysql_fetch_array($result)) { foreach ($row as $key =$value) {
0
1200
by: arunpulikkan | last post by:
hi,guys im new to asp.in my option list one value is displaying twice.following is the code if not rs1.eof then thispagesForm = rs1(0) sql2 = "select formname, local_url from xwhere formid = "& thispagesForm set rs2 = conn.execute(sql2) thispagesFormName = rs2(0) local_url = rs2(1)
4
2567
by: Peter Morris | last post by:
I am not sure what you are asking. You seem to be asking how to implement a plain IEnumerable on a composite structure, but then your example shows a flat structure using "yield". Your subject makes me infer that you think foreach is enirely useless for composite structures. I will address the subject text, because that makes the most sense to me :-) Take the following class public class MyTreeNode : IEnumerable<MyTreeNode> {
0
9684
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10182
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10017
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5445
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.