473,508 Members | 2,226 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP script dies after while loop

1 New Member
So I have this while loop in a function that is called in the middle of a page:

Expand|Select|Wrap|Line Numbers
  1.             while(count($showarray) <= $show_link){
  2.                 $randindex = rand(0, count($newlinks));
  3.                 if(!in_array($newlinks[$randindex], $showarray) && $newlinks[$randindex] != "") {
  4.                     $showarray[$showindex] = $newlinks[$randindex];
  5.                     //print_r($showarray);
  6.                     $showindex++;
  7.                 }
  8.             }
The funny thing is: it works for one page (it's used to list randomly generated links depending on which ID is taken from the URL) - that is, where ID = 1, but on all other pages, it just kills the script and nothing after it is outputted. I would really appreciate any help on figuring this out.
Aug 19 '11 #1
1 1565
dlite922
1,584 Recognized Expert Top Contributor
there's an error. make sure you have read this:

http://bytes.com/topic/php/answers/8...e-useful-stuff

Turn error reporting on and you'll be able to see the problem faster than us humans manually debugging your code.
Aug 22 '11 #2

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

Similar topics

1
1523
by: shivers3000 | last post by:
Can someone explain why $displayResults will not query twice? Scripts Objective: to take a car's VIN retrieve the car info and display in nice rows Issue with Script: The while loop displays...
23
3892
by: ern | last post by:
I have a program that runs scripts. If the user types "script myScript.dat" the program will grab commands from the text file, verify correctness, and begin executing the script UNTIL... I need...
6
71933
by: John Pass | last post by:
What is the difference between a While and Do While/Loop repetition structure. If they is no difference (as it seems) why do both exist?
14
2647
by: dawnerd | last post by:
Hi, I am developing a CMS and came across something which has never happened to me before, and I re-wrote the specific script twice, both differently, and still had the same error. I'm not sure...
2
2062
by: d3vkit | last post by:
Okay so I can NOT get my while loop to work. It's the most confusing thing I've ever come across. It was working fine and then suddenly, nothing. No error. The page just dies. I am using PHP5 with...
3
1363
by: Jesse Burns aka jburns131 | last post by:
I've got a coding problem here that I could use some help with. Here's my db class (the config.php only has db connection info): ...
16
2288
by: sessmurda | last post by:
I am writing a fairly simple script that is supposed to print out lines from a txt file and group them based on where I want them. The general format of the files I am using the script on is as...
15
3228
by: Lawrence Krubner | last post by:
Does anything about this script look expensive, in terms of resources or execution time? This script dies after processing about 20 or 25 numbers, yet it leaves no errors in the error logs. This is...
2
2403
by: sha37 | last post by:
Hi, I have to code this part in perl and using DBI. 1. I have a SQL select query which fetches some rows based on order. 2. I have to fetch each row at a time, once i fetch the first row i...
0
7383
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...
1
7046
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...
0
7498
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...
0
5627
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,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3194
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...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1557
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 ...

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.