Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Extra 1 End Of Array


I decided to print out my array (print_r) and see a 1 at the end or array PHP Code:

Array ( [16] => 16 [19] => 19 [29] => 29 ) 1.




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Extra Item In My Array
Why is my code.

$urlarray = explode("/", "/about/new/index.php");
print_r($urlarray);

returning this

Array ( [0] => [1] => about [2] => new [3] => index.php ).

Perhaps I am being dense but why do I have an extra empty value at the beginning of the array. Is there any way I can make it return the ones I want (ie only those containing an actual value) or do I simply have to work around this.

View Replies !   View Related
Extra Values In Global Array?
I am trying to pass a few arrays to one of the functions w/in a class I've written, and it's doing something very strange. Here's the block of my code where I define my arrays as global: Code:

View Replies !   View Related
An Extra Last Empty Field In An 'mysql_fetch_array' Result Array?
I seem to get an extra empty field in every 'mysql_fetch_array' command I issue. For example:

I have a simple table 'tblName':

ID Name
1 Jane
2 Joe
2 Doe

The following code:

$oCursor = mysql_query("SELECT ID from tblName WHERE Name='Jane'");
if (!$oCursor)
{
$bGo = false;
}
else
{
$aRow = mysql_fetch_array($oCursor);
}

results in:

count($aRow) = 2;

$aRow[0] = 1;
$aRow[1] = ''

Am I missing something, doing something wrong, a wrong PHP setting?

View Replies !   View Related
Extra Fields Vs Extra Queries
Should I use a join in which I will definitely have 2 out of 4 fields that will never be used. PHP code would use these results to decide which fields to use.

OR

Should I only select the minimum fields and then have another query select the two fields I'm going to need. This would be decided using PHP based on results from the first query.

View Replies !   View Related
Getting Rid Of Extra ''
I have a PHP script that adds text to a file. Now when I add the text it escapes any ' and ". I know there are functions to remove the , but there is also some legitimate in the text. How do I stop PHP from taking it upon itself to escape the ' and " for me?

View Replies !   View Related
Extra Characters
I'm trying to create a csv file to download. The file that is being created has three extraneous characters at the end. I experimented with several different versions of
to make sure it wasn't something there. No matter what combination I use, I still get the 3 extra return characters. Is there something that PHP adds to a file?

Here's the code that creates the variable: PHP code:

View Replies !   View Related
Extra Line In Xml
i have this code to insert context into xml the problem is when the context is inserted a extra blank line is inserted..

and if you know about xml you can't have no extra blank line.. this is the code:

View Replies !   View Related
Extra Backlashes
I have an issue that when I extract data from mysql table it's including backlashes with quotes. Example if I enter "james" in the table when I extract the data I get "james"

Is there a function to correct this issue? This is a remote server and I don't have access to the PHP.ini file.I am using the code below to enter a value into the table

trim(mysql_real_escape_string($value))

I am using the follow code to retrieve the data

<?php echo $row['value_name']; ?>

Both codes are incomplete but these are the lines that I think are affecting the output.

View Replies !   View Related
Extra Fields As Necessary
Post was moved here: http://www.webmasterworld.com/javascript/3390539.htm

View Replies !   View Related
Extra In The Mail Message
i use php to process mail form. Mail was sent successfully. but in the message isn't that cool? becomes isn't that cool? there's an extra slash. is there a way to fix this?
also when we check and validate the user input from the mail form, is it better to do it on the server side or client side? i.e using javascrip or php?

View Replies !   View Related
Remove Extra Space
Is there a way to take a string that the user has submitted and check the beginning for any extra spaces, and then remove the extra space up to the first real "character" (letter or number)? I hope that isn't too confusing, just ask if you need me to explain better.

View Replies !   View Related
Extra Space Is Added
I used the search option but i couldnt get solution for my problem. When i retrieve value from mysql db and place in a textbox an extra space is attached at the end.

View Replies !   View Related
Remove An Extra Character From Php
i'm currently working on rss feeder. In that i'm parsing xml values to php. but along with the xml values i'm getting some unwanted characters to like some html tags(i.e. <i> </i>,<br> <br> etc...).

so in php it is showing as below

for eg. : legal+team.+%3Cbr%3E%3Cbr%

in the above example legal+team. are the xml values getting from the rss along with an extra chracter %3Cbr%3E%3Cbr%.

so how should i remove those unwanted extra characters in php.

anybody is having any idea?

View Replies !   View Related
Extra Space From If Statements
For some odd reason, the more fields that I enter information for (that are NOT required) adds more empty, white space to the top of the php page.

It has something to do with all my if statements in the php. I viewed the source and there are not any extra breaks or anything to place the information something like 10 lines down. Code:

View Replies !   View Related
Extra Column In MYSQL
What information goes into Extra? Except auto_increment.

View Replies !   View Related
Strip Extra Breaks
I noticed taht i have some output with extra spaces in the output. I looked at the source and see that there are some breaks that I'd like to remove. I've tried:
PHP Code:

$str = preg_replace('</P><br />', '', $str);

Seems like something is wrong as I loose the output. Do I need to escape something? Coffee, where's my coffee?

View Replies !   View Related
Extra Comma In Update Sql
I am using a foreach loop to create the statement. Everything looks good with the sql statement when I echo it; but the last update field has a comma , that is not needed. How to I account for the last $key => $value set in the array that match my criteria and not have a comma?

        $sql = "UPDATE facform SET ";

foreach ($_POST as $key => $value) {

if($key != 'submit' && $value != ''){
$sql .= "$key = $value, ";
}
}

$sql .= "WHERE id = $id";

View Replies !   View Related
Why The Extra Line Breaks
I'm trying to get something that reads out of a database and then has a drop down menu for each piece it gets out of the data base i.e.

car1 color option box
car2 color option box
car3 color option box
car4 color option box
car5 color option box

where color option box is a drop down menu with different choices, with the eventual goal of updating the database with changes made.

Right now I can't figure out why the drop boxes appear one line below the leader for the line, I also can't figure out why the extra drop box is being generated at the end. Code:

View Replies !   View Related
Remove Extra Caracter
I have problem with extra caracter at the end in my output. We first do some stuff with mysql; Code:

while ($mysql_array = $db->fetch_array()) {

$rednibroj = $mysql_array['rednibroj'];
$nazivbanera = $mysql_array['nazivbanera'];
$image .= "$mysql_array[slikabanera]";
$urlbanera .= "$mysql_array[urlbanera],";
$image = $image.','
}

Code:

print $image.''

The result of this is like this :

var imgList = new Array("ban.jpg,banner.jpg,").

View Replies !   View Related
PHP Commands Vs. Extra MySQL Rows
What's better, storing extra information on something in a mySQL database, or using code to go through the database to find the information? For example, for the forum I am writing, I'm not sure whether I should store the last post of the user in thier row, or I should use the code to search through all the posts and find the last one by the user.
Which do you think is better and why?

View Replies !   View Related
Add An Extra Space After Period In A String
I want to be able to add an extra space in each instance
after a period in a string. I am already stripping out extra
whitespace throughout, so to start I have a nice flat string to work
with. I am struggling getting the syntax right and keep getting funny
results. What is the simplest way to accomplish this?

View Replies !   View Related
Nl2br( ) Function Adds Extra Br
I recently installed phpDev4 (apache, php and MySQL) for local staging of web sites before uploading to my "online" web account. I have a script that takes a field from a database and converts new line characters to <br /> using nl2br( ). I downloaded a csv table from online MySQL and loaded the csv into my local MySQL for testing purposes.

When I run this script from my online account, everything is fine. However when I run this script locally php generates an extra <br />with double quotes and a number at the end of the field data. online html ex. this is a paragraph whose <br /> newline characters are converted to the break xhtml tag.

local html ex. this is a paragraph whose <br /> newline characters are converted to the break xhtml tag."<br />6". Why is "<br />6" added on the end? Is there something within php.conf file that I need to change?

View Replies !   View Related
PHP Reading Extra File Info...
I am an ameture digital photographer (along with a newbie developer) and
I've an album of my pictures online. I've been building this album to be
just how I want it and I've come to one last feature that I can't figure
out.

How do I read the extra file info from a .jpg image file (or any other file
for that matter)?

Each one of my pictures has 10 or 20 things included in the file like the
Camera model, f-stop used, etc... and I want to be able to parse that out
and show it on screen.

Is that possible with PHP?

View Replies !   View Related
Adding And Extra Clause To Php/pdf File
I'm hoping this is relatively straightforward! I generate pdf invoices from php files and depending on which company they are for they load different logos as in }

if($bookerCompany='CIMINT'){
$logo="printlogo1.jpg";
}else{
$logo="printlogo_iwant.jpg";
}
I now need to seperate these into sterling and non sterling print batches. I have any existing line that differentiates between UK and non UK documents if ($currency!='Sterling'){ this being non sterling and dropping the '!' for sterlings docs. Now I need to combine the booker company with the currency type to make all the right bits load into the doc.

View Replies !   View Related
Renaming A File And Add An Extra Bit Of Text To The End
when a user uploads an image file i delete the name of the file and append a random 8 digit number to it (keeping the files original extension)

so : graham23spic.jpg would be 12345678.jpg, i was wanting to add an extra bit of text to the end of the photo kinda like: 12345678.jpg-Users_Photo

but i'm not sure how to do this my rename code is:

View Replies !   View Related
Upload And Extra Characters In Word Doc
I have a question that is holding my development up - and it's down to Microsoft!

I am developing a site where users upload documents (using php upload), and the content of the uploaded file is inserted into a mysql database. It all works fine - apart from the hundreds of extra characters added by Microsoft Word, above and below the content.

We do not want to restrict the doc type on upload as there will be many different formats used and we want to make it as easy for the user as possible.

Most solutions I have seen simply say to save the Word file as a .txt file - this is not an option. We MUST be able to upload many different types of Word processing files and strip out the extra characters.

View Replies !   View Related
Remove Extra Line Breaks
What is the correct expression to remove any extra line breaks beyond two in a string?

View Replies !   View Related
Getting Extra Line Space In Mail...
I have a txt file with a canned message. When it is sent and arrives at my mailbox it has doubled line breaks... Code:

View Replies !   View Related
Preg_replace - Remove Extra New Lines?
how come this doesn't work?

# convert to unix new lines
$text = preg_replace("/
/", "
", $text);
# remove extra new lines
$text = preg_replace("/
+/", "
", $text);

is there better ways to remove extra new lines?

View Replies !   View Related
Freakish Problem -- Extra Char
I have a code snippet that generates a random code 10 character. PHP Code:

function generator($lenght=10)
{
     for($i = 0; $i <= $lenght; $i++)
     {
          $uniqKey .= chr(rand(97,122));
     }
     return $uniqKey;
}
$randomN = generator();

When echoed $randomN == ymtkasvaae

But when I change the code to a upper case it adds a character. PHP Code:

$code = strtoupper($randomN);

When output the $code == YMTKASVAAEI

View Replies !   View Related
Session Value Returns Extra Numbers
i am trying to do a captcha, image verification i am using this code to check the cookie if they have successfully vertified every 15 mins Code:

View Replies !   View Related
See Extra Characters While Executing Web-script
I've just installed PHP 5.0.4 and Apache 1.3.31 on Linux. I'm facing the following problems:

1) While trying to execute the following code:

(http://myhost/cgi-bin/test.php), I see some trailing php code
characters!!? Code:

View Replies !   View Related
Imageline And Extra Contiguous Pixels
I'm using PHP Version 4.3.3RC5-dev with GD Version bundled (2.0.15
compatible) to generated some graphics based on mysql data and to my
surprise when I use the GD function imageline($im, $x1, $y1, $x2, $y2,

$cl); (with $cl being the collorallocated via function) the line is
draw dirtying the contiguous pixels of the image ($im), making some
extra pixels around the background. I've removed my jpeg background
and the problem remains. It's something like when we zoom in too much
and got some block

pixels with "random" colors. I don't know what to do. If someone want
to help me I can send two little .jpg (each 20kb) showing the problem.
I'm wondering to use only 16 colors pics (I don't know how to create
it with only 16 colors (4bits?)) to see if I can "fool" the imageline
to avoid extra dirty pixels...

View Replies !   View Related
Erasing Extra Characters/shortening Strings
I have a piece of code that looks inside a text file at a list of numbers that are then used to locate files. When the text file is simply Code:

View Replies !   View Related
Trimming Extra Spaces From Large DB File
Hi, I need some advice on what to do. I have this MySQL insert file,
with about 30,000 records. One of the datafields has names in it. When
this list was put together, apparently there was extra space formatting
inserted at the end of each name. I want to remove these, so for
example:

INSERT INTO `table_one` VALUES ('John Doe ', 1);
INSERT INTO `table_one` VALUES ('Jane Doe ', 2);
INSERT INTO `table_one` VALUES ('Baby S. Doe ', 3);

I want:

INSERT INTO `table_one` VALUES ('John Doe', 1);
INSERT INTO `table_one` VALUES ('Jane Doe', 2);
INSERT INTO `table_one` VALUES ('Baby S. Doe', 3);

I was thinking some kind of script could be put together to trim the
extra spaces out. I have this entire insert list as a text file and can
re-insert it, or leave it in the DB and run queries against it. What
complicates this for me is some of the name fields have middle names,
some do not. Maybe something to remove all spaces greater than one on a
first pass, and then on a second pass trim the extra space at the end
only. That is what I think of in theory - but have no idea how to
create such script.

View Replies !   View Related
Extra Newline Characters When Ftp'ing Php Scripts
I just used FileZilla (on windows) to download a site for testing in IE,
and it seems a couple of newline characters are added to all the php
scripts.

This isn't much of a problem until I get to my AJAX stuff, where I have
to include a couple of scripts before setting the xml content-type header.

All the scripts are also double-spaced, which I suspect is the same
issue Anyone seen this?

View Replies !   View Related
Formatting A String And Strip Out The Extra Commas
if i have a string like this:

id=14,15,16,17

and some of the ids can be missing
e.g. id = 14,,16,17

I would like to strip out the extra commas. Ive had a few goes trying different ways.

View Replies !   View Related
Result Query - Producing Extra Results?
what am i doing wrong here?

$startrow=0;
$limit=20;

$qry = mysql_query("SELECT bodycare.*, haircare.* FROM bodycare, haircare WHERE bodycare.avail='true' AND haircare.avail='true' LIMIT $startrow, $limit")or
die(mysql_error());

it should return 6 results between bodycare and haircare. instead it returns 8, - 4 repeats of the first haircare product and 4 of the second haircare product. There are only 2 haircare products in total and 4 bodycare, but the bodycare aren't turning up at all

why? can you help me fix it?

View Replies !   View Related
Extra Secure Way To Protect Your Pages Using Strpos?
I was in search of a method to search the browser parameters for all of the program execution functions. I did alittle toying around and I came up with this..It works pretty good, but I am unsure of how exactly one does sql injections, and other things like that through the browser parameters..So I figured I would ask some of you here:

Can this script be trusted to protect me against a more broad range of hacking attempts then without it. Not neccesarily all, or even ALOT, but am I at a higher risk without it than I am with it? Is it worth adding it to my CMS backend code?

PHP Code: ....

View Replies !   View Related
PHP Inserting Extra Data At Start Of Response Body
PHP version: PHP5
Server version: Apache 1.3 and 2.0 (observed on both version)
Platform: observed on Darwin-8.6.0/PPC and FreeBSD-6.1/i686

example:

=====
HTTP/1.1 200 OK
Date: Fri, 30 Jun 2006 09:24:48 GMT
Server: Apache
X-Powered-By: PHP/5.1.4
Content-language: en
ETag: W/"blogurk_wiki:pcache:idhash:1-0!1!0!0!!en!2--20060114114008"
Vary: Accept-Encoding,Cookie
Expires: -1
Cache-Control: private, must-revalidate, max-age=0
Last-modified: Sat, 14 Jan 2006 11:40:08 GMT
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8

21af
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
dir="ltr">
<head>
<meta http-equiv="Content-T...
=====

Things I've noticed:

- browsers don't seem to mind it
- I've only seen hexadecimal characters
- only changes when page content changes (checksum of some kind?)

View Replies !   View Related
File_get_contents - Strip All The Extra Characters And Just Have Text From The File?
when using the get_file_contents function i allow users to upload doc and txt files, but i have noticed when PHP hits unusual character in the doc or txt files it, doesn't upload properly, is there a way i could strip all the extra characters and just have text from the file?

     $filename = $files;
     $content = file_get_contents("uploaded_files/$filename");     
     $files_for_mysql = mysql_real_escape_string($content);

View Replies !   View Related
Xml Parsing Issue - See Some Extra Information Which Creates Problem
I am using for web service client and been able to get correct results. Now i have problem in parsing it, I have methods available for this either get data form array which in user debug or i can parse the xml.

When i put the who xml in file and try to parse it it works file, but when i try to parse it directly you can see some extra information which creates problem, please check this issue and help me out. Code:

View Replies !   View Related
Function To Trim Out Extra Spaces Between Words In A String
I was looking for a function to trim out extra spaces between words in a string. The trim() function works, of course, to take extra white space before and after a string, but I couldn't find anything to remove extra spaces between words in a string.

I've come up with this function - and since I'm still new to PHP I'd appreciate if some of you experts would critique my code. Code:

View Replies !   View Related
Extra Backlashes - Extract Data From Mysql Table
I have an issue that when I extract data from mysql table it's including backlashes with quotes. Example if I enter "james" in the table when I extract the data I get "james" Is there a function to correct this issue? This is a remote server and I don't have access to the PHP.ini file am using the code below to enter a value into the table

trim(mysql_real_escape_string($value))

I am using the follow code to retrieve the data

<?php echo $row['value_name']; ?>

View Replies !   View Related
Extra Newlines In Output Text Added By PHP File Include
I have a simple PHP script that outputs a string requested by an Ajax
page. XMLHttpRequestObject.responseText as received from the PHP script
begins with 2 extra newline characters (

MyString):

<?php
require_once('DB.php');
require_once('../myDir/myFile.php');
.......
echo('MyString');
?>

myFile
<?php
$var1 = 1;
$var2 = 2;
$var3 = 3;
?>

If I manually write the contents of myFile.php into the script, there
are no extra newlines in responseText.
Am I missing something?

View Replies !   View Related
When Text String Is Mailed, Extra Line Breaks Are Introducd
I have the following message string:

$message = <<<EOT
Personal Information:
Name: {$_POST["name"]}
Address: {$_POST["address"]}

EOT;

Now, when I echo this to the browser, (and view the source), it is exactly
what you would expect. Three lines of information. However, if I use
mail() or the PEAR Mail class to send $message via email, I get an extra
line break at the end of every line. What in the world would cause this?
Any ideas?

View Replies !   View Related
Email Formatting - Extra Blank Lines In Certain Places To Break It Up A Bit
I have a form that outputs to email. PHP Code:

foreach($_POST as $key => $value) {
$message = $message . "$key: $value
";
}

At the moment the email has about 100 lines of data, one after the other. What I want to do is put extra blank lines in certain places to break it up a bit. For example, the $key for the 6th line is "Nationality" - after which I would like a line break. And in several other places.

View Replies !   View Related
Remove Extra Characters From A Title That The User Types In To Make It More URL-friendly.
I am trying to remove extra characters from a title that the user types in to make it more URL-friendly. I am trying to use preg_replace() for it, but I keep getting errors. Here's my code: Code:

$urlFriendlyTitle = preg_replace("/[/", "", $_POST['title']);
$urlFriendlyTitle .= preg_replace("/]/", "", $urlFriendlyTitle);
$urlFriendlyTitle .= preg_replace('/ /', '_', $urlFriendlyTitle);

When I remove the space it's fine, but trying to remove brackets just doesn't work. I haven't tried to remove Quotaion Marks or Slashes/ other characters yet(ex @, #, $, &, etc..), but hopefully I can figure that out once I fix the bracket problem.

View Replies !   View Related
Need Function: Split String By List Of Strings And Return Delimiters And Extra Text
I am looking for a function that takes in a string and splits it using a
list of other strings (delimiters) and can return the delimiters as well
as the extra parts of the string. I was trying the split with a regex
built up of the delimiters separated by "|", but it doesn't return the
delimiters which I need. Code:

View Replies !   View Related
Image UPLOAD Form With Extra Form Fields
I got the image upload to work and upload to a direvtory on my server but the other information on the form is not dealt with and since I can not use this: PHP Code:

View Replies !   View Related
Extra Characters After A "while" Loop
When I'm creating sets of links seperated by " | ", while reading out of a text file line by line, php attaches one more character onto the hyperlink. instead of getting "hyperlink I get hyperlink . any ideas? im using the fgets function.

View Replies !   View Related
Importing Txt File Into DB,and Importing An Extra Variable For Each Row....
I want to allow the user to select a CSV file to upload details into my Db, along with a seprate variable, which is a session variable called $vendorid, this is set when they login.

So far I have the following, how can I insert the $vendorid in each row, along with the data from the text file? The Db has 11 columns, but the text file has 10, I want to set the 11th column to $vendorID for each row in the text file. Code:

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved