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.





Know How To Delete Characters *after* A Specific Character?


If I have "JoeSchmoe - White Sox Rock", is there a way for me to have the script remove all the characters after the "-"?




View Complete Forum Thread with Replies

Related Forum Messages:
Remove Characters Up To Specific Character
I have a funny string that I'm pulling from a database, and I need to take a specific element out of it to try to organize some message statistics. This is what it looks like:

a:1:{s:2:"cc";a:1:{i:3;s:7:"Name";}}
I need to pull the name out of the strong. Luckily, all of the strings only have 4 characters at the end, which makes it easy to remove, but the numbers can change in the first part, making that difficult to do as well. To further complicate it, sometimes the messages may go to multiple users, such as:

a:1:{s:2:"cc";a:3:{i:1;s:6:"Name1";i:5;s:6:"Name2";i:3;s:7:"Name3";}}
Subsequently, the trimming of 4 at the end seems a little uglier. The one thing I can tell from the syntax is that I can ignore the first 2 quotes. The third quote is the start of a name, the fourth quote the end of one. If there are any more, it continues that pattern. Anyone know how I can parse this string nicer?

View Replies !
Truncate Text At Specific Character
how to truncate text at a specific character? For example, I have:

Hallelujah:Ahoy

And I want to return:

Hallelujah

Anyone know how I can do that? I looked at substr, but the # of characters after the colon will change.

View Replies !
How To Find A Specific Character In A Result.
I am using this:

"SELECT vendors.name, SUBSTRING_INDEX(vendors.name, ' ', -1) AS lastname"
Which will take "Smith" out of John Smith or "Anderson" out of Mike J. Anserson.

Now how can I also create a lastname_alpha to get S or A (just the first character out of the lastname.

View Replies !
Delete Specific Row Out Of 3
Say i have three rows:

row1
row2
row3

How do i make a mysql query to delete a specific row out of the 3 only? So say i wanted to delete row2 from the 3.. ?

View Replies !
Delete A Specific Row
How can i delete a specific row from a mySQL table. I want to delete Image2 (or make the value of it is nothing, NULL)

<?php
$con = mysql_connect("localhost","name","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("npsari_other", $con);

mysql_query("DELETE Image2 FROM ads WHERE ID='$ID'");

mysql_close($con);

?>

Is this code right, because it doesnt work.

View Replies !
Delete Specific Entry
I'm working on a CPanel on my website that gives me the posibility to edit both the blog, news and shoutbox. So far I'm done with adding new: news, shout & blog. But I'm stuck when it comes to deleting. Like if someone is spamming my shoutbox I want to be able to log in and delete the spam shout. I wish I had some code to show you for the delete part, but I dont even know where to start.


View Replies !
Delete Specific Records
On clients machine, currently to delete on trainee record it runs 10 queries to delete records from 10 tables. At the time of running all queries, server shows (104) Connection reset by peer. An error condition occurred while reading data from the network. I think it because of running 10 queries at a same time. Is there any possibility that through one line of query we can delete record from 10 tables. I've tried following query

DELETE FROM table1, table2, table3, table4, table5, table6, table7, table8, table9, table10 WHERE empID = 11;

But it gives ' error in query.

View Replies !
Delete Specific Texts From File
The text file is in variable length. We can't point to where to delete. But there are texts we want to delete in the text. How can I do ?

The only way I can think of is load entire file, match the text we want, replace the text, and then rewrite the file. Is this way correct ?

View Replies !
Completely Delete A Specific Array Index
I was wondering if anyone could tell me if there is a way to completely delete a specific array index once it has been set. For instance, I have an array with 50 indexes (0 - 49) sizeof = 50. Now, I want to eliminate 10 indexes, making my array sizeof 40 and having array indexes 0-39.

View Replies !
Specific Characters
i want to match some specific character set 10 odd characters in a user input string.
i want to find all occurences of the any of such characters. i am using preg_match_all for this.the string pattern that i am giving is a regular expression having those characters i.e "ch1|ch2|ch3" but i am getting only first occurence of the the char which is there in the regular expression. where i am goin wrong and how can capture all occurences of those chars.

e.g  pattern-  "x|y|z"

string to search "this is the X string for test Z and Y are at end and are not detected" in above case the character that is matched is only X at 13th position and z and y are not matched. i want to detect presence of all 3 chars. i.e x,y as well as z.
how can i achieve this.

View Replies !
How Do You Pull Specific Characters In From A $string
I want to create a method that will tell me the 10th and 11th character
in a string, and store it as $something. How can this be done?


View Replies !
Can A String Be Searched For Specific Characters?
Can a string be searched for specific characters? Each time a 6 is found, can "Six" be displayed on the screen, and each time a 5 is found, can "Five" be displayed on the screen.

View Replies !
Get Alot Of Funky Character Instead Of The Known Special Characters
building a site with a backend controlpanel that's made in flash and writes all info thru php scripts to the mysql database... Problem is that i get alot of funky character instead of the known special characters... Since i didn't immediately found how to fix this i wrote a function that goes pretty much like this:

View Replies !
Deleting Characters In A Variable Until You Reach A Certain Character?
I'm making an ftp/file manager, i have a variable, ($dir), and lets say $dir consists of "./forums.tech-devil.co.uk/lang", but i want to go up one folder to "./forums.tech-devil.co.uk/", so obviously i want to delete the "lang" from the varable. so i realy just want to delete characters until i get to a "/". how can i do this?

View Replies !
Html-encode All Characters Not In The Current Character Set
Is there a function that will allow me to
output text written in utf-8 (from db for example)
if my document has

Content-Type: text/html; charset=ISO-8859-1

I mean htmlspecialchars() and htmlentities() will only convert
characters that have an associated entity defined in HTML.
I would also like to translate all non-latin1 characters using
numeric references.

&#355 is for a Romanian letter, ţ, for example, and letter ţ
written in UTF-8 is not translated by htmlentities(), even if
I give the function the optional character-set argument, 'UTF-8'
(you can actually see the letter I typed if your system and your
news reader understand and can display ISO latin 2 characters,
encoded in utf-8).

I mean HTML documents can use characters in the entire UNICODE
set, even if the document source is written in ASCII for example,
by encoding any non-ASCII character with HTML entities.

Is there in PHP a function that will encode in HTML all non-ASCII
characters, or all non-latin1 characters, or all characters not in the
source character set ?

View Replies !
Delete Invisible Control Characters
Looking for any PHP pros who know of a way to delete hidden control characters from a text file? I am using an excel reader class which outputs a hidden control charcter, the inverted question mark, in between each character. I have posted on thier forum about this problem, but have recieved no response.

I have tried a string replace using the ascii value

str_replace(chr(168),'',$str);

but that doesn't work.

I have also tried trim() using the hex value of the char, but no luck there.

View Replies !
Substr To Check And Delete First And Last Characters Of A String?
Hi - I have a string of numbers separated by commas like so:

280,253,279

But sometimes the string ends up with a comma at the begining or end like so:

,280,253,279 or 280,253,279,

How would I go about checking to see if the first or last character in the string is a comma and then if so delete it?

View Replies !
Delete Multiple Spaces And Special Characters
Is it possible to delete special caracters from a string and multiple spaces?

When the input is : "a&*bbb cc/c d!d"
I want the result : "abbb ccc dd"

View Replies !
How To Tell To Send A Specific E-mail At A Specific Time
How to tell PHP to send a specific e-mail at a specific time (newsletter).

View Replies !
Echo To A Specific Div On A Specific Page
Is it possible to echo something from a php file to a specific div in a different specific html file?If so, can you let me know how to specify where the data should displayed.

$myName="john";

echo '$myName'//but i want to echo to a different page on a certain part of that page.

View Replies !
Delete Record - When The Delete Link Is Clicked The Next Page Is Blank And Nothing Is Deleted.
This is my "delete.php" and this "todo/delete.php?id=64" an example of a link to it generated from the index.php page. When the delete link is clicked the next page is blank and nothing is deleted. What have I done wrong?

<?
include("dbinfo.inc.php");

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$id="delete from todo where id='$id'";
mysql_query($id);

mysql_close();
?>

View Replies !
Mysql Delete - $query = Mysql_query("DELETE
how would i do the following ?

$query = mysql_query("DELETE notes, datestamp, abs_value, ID FROM absence_mgt  WHERE datestamp='$date' AND ID='$vtc_login' ") or die(mysql_error());
im just getting "Unknown table 'notes' in MULTI DELETE" ?

View Replies !
Sending People To Specific Pages That Are Coming From Specific Pages...
I want to show some specific pages to people that comes to my site from
specific urls, I know the variable $_SERVER['HTTP_REFERER'] will be
used but how?

For ex if the visitor comes from a site that is like:

I want to send this person a specific.php . I used below code but not
worked:

<?php

if($_SERVER['HTTP_REFERER'] == "www.cominghost.com" ||
$_SERVER['HTTP_REFERER'] == "cominghost.com" ||
$_SERVER['HTTP_REFERER'] == "www2.cominghost.com"){

// Specific page html goes here

}
else
{
header("Location: index.php");
}
?>

This code not worked for some cases like if the visitor comes from
http://www.cominghost.com/account/targeturl.php or
http://cominghost.com/account/targeturl.php Ok I know the if statement
not working but How?

View Replies !
Special Characters - Convert To Html Code The Characters ã, á, à, é, ç, ...
How ould i convert to html code the characters ã, á, à, é, ç, ...

View Replies !
Although English Characters Appear Correctly Into The String, The Greek Characters Are All Replayed By '?'.
I am using php 5.2.2. I implement a web site that invokes a java web service (using nusoap.php).

The web service queries a table from an sql server 2000 database and returns a string with the records returned. The problem is that although english characters appear correctly into the string, the greek characters are all replayed by '?'.

The reason must be that the web service returns multibyte charecters (greek characters) and php cannot read them.


View Replies !
Session Id Contains Illegal Characters, Valid Characters Are A-z, A-Z, 0-9 And '-,'
Unknown: The session id contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,'

I'm getting this appear fairly frequently in my logs. Each time it appears it seems to be a different client (i.e. IP) but that client will cause 40+ errors in my logs. Is this an attempted hack?

View Replies !
Replace All Characters In String Except Keyboard Characters
I've been trying to figure this one out for a few hours and I'm not making much headway. Hoping someone here knows the quick solution...

I'd like to replace all characters in a string except for the set of keyboard characters. I figure this can probably be done with a preg_replace and some regex, but I'm afraid I need to bone up on my regex some...

View Replies !
Special Characters - Foreign Characters
I'm experiencing a strange problem in displaying some text I have extracted from an XML file that I haven't had much success in solving. I am retrieving some remote XML, placing it in an array, and extracting the data I need, then inserting that into a MySQL database so it can be manipulated and merged with other data.

Some of the data includes location names, such as the one below, which include foreign characters that have been translated into a special character. For some reason, these are actually being displayed in the form shown below. For example and ampersand appears as &amp; and not as &. PHP Code:

C&#244;te d'Ivoire

View Replies !
Shrink Many Characters To Few Characters
I am using this code to shrink URL to a desired number of characters Code:

View Replies !
The Character '
well i've made a form and when i type something with an ' in it like "it's" then i get an error like this: You have an error in your SQL syntax near 's a shiny day at line 2
the colum type is text.

View Replies !
Character Â
The character  shows up multiple times on my parsed strings. I tried to get
rid of it with the following code without success. Is that character
represented by anything else? Thanks

$bad_chars = array(chr(194), 'Â');
str_replace($bad_chars, '', $parsed_string)

View Replies !
Add A Character
I have inherited some data from a client with one particularly irksome field, namely, the "birthdate" field. They have the dates formatted as "mmdd" with no character to separate the mm from the dd. What I would like to do is to simply add a dash ("-") after the 2nd character in the string. Is there a way to do this in PHP 5?

View Replies !
Character Instead Of #
Is it possible to do something like wordwrap, but inserting a new line after a certain character (in my case: >), instead of after a certain number of characters.

View Replies !
Specific IF/Then...
I have a code that displays a value from a row in a mysql db. The code is this:

echo "<td>" . $row['year'] . "</td>";

When the user submits their information, there is an option that says "hide the year I was born." Since the row for "year" is set it INT, if they choose that option it returns "0."

I was wondering if there was a way to do something like if $row['year'] = "0"{
echo"hidden by request"
}
else{
echo "<td>" . $row['year'] . "</td>";
}

but still have it work with my existing code.

View Replies !
Help On Character Encoding
I have a string in windows-1256 character set. But i would like to change from this chracter set to utf-8. (actually it is for to display arabic text). I am using in my whole site utf-8.
Any help highly appreciated.

View Replies !
Trouble With '>' Character
I'm trying to get the '>' in a string into a variable but it doesn't display and everything in front it of disappears. I've tried using '' to escape it but this has no effect. What a m I missing?

View Replies !
Mac Character Translation
I've got a problem with special Apple-Macintosh characters, and I want to translate them to the corresponding PC characters.

I found the recode function on php.net, but although php version 4.2.1 is running on the server, the recode funktion does not work. Maybe the whole recode program is not compiled on the server or whatever.

In an older post to this subject I found the suggestion to simply do an preg_replace for the Mac characters, what was also my first idea.

THE PROBLEM is, that I don't know, how the Mac characters look like and (believe me, I searched quite a long time) I cannot find any list with the mac characters.

View Replies !
Character Count
i need to know how to count the number of characters in a variable. E.g.

$a = "hello";

i want something to tell me how many letters are in $a.

View Replies !
Extracting First Character
I was wondering how would I extract the first letter or number of a string. Like if the string was "Goat Chesse" only extract the "G".

View Replies !
Using The $ Character In Query
Does anyone know a successful way to use the dollar sign character
within a query and not generate an error?

Here's what I'm trying to do... I have a query that successfully
counts the number of records within a query as well as totalizes the
dollar amount. What I'd like to do is show a dollar sign ahead of the
'amount' total when it queries back to the screen in my html document.

Is there something I can use to null the normal relationship PHP has
with the $ character where again, I can use it for text purposes?

View Replies !
Character Set Problem
I have a php app that works great on the development machine(s), but
fails on the production server! Two problems.

A comment field is entered including the £ symbol - the single character
for sterling. The database should store that as £. The display as normal
and a field content should also display it as £....

View Replies !
Character Conversion
I'd like to convert this kind of character :

#48;

into a human readable character :

0

I can't find the function that does this in the doc, so I used
str_replace...

View Replies !
How To Substitute A Character For Another One
I want to substitute a character (e.g. 'R') for another one ('-R')
within a word: 'RECORD' ---> '-RECO-RD'

Is it possible by using any PHP command?

View Replies !
Finding A TAB Character
Does anyone know how to find a TAB character in a string or explode
on TAB into an array?

View Replies !
How To Get Rid Of Control M Character
I'm using PHP code to develop a www interface to let users edit text
files stored on a Solaris UX server. Users are using Windows based
WWW browser access this web site. Once they have selected the file
they want to edit, it's presented in a text window (form) so thay can
modify the file.

The submit button passes the contents of the field to a variable and
it is saved to disc.

From the WWW interface everything seems OK, but when I look to the
file, each line has a "^M" (control-M) at the end.

This makes the files bigger and it can cause problem in a near future
because these files have to be processed by shell scripts to populate
a mySQL DB.

Someone has seen that before and what was the solution.

View Replies !
GD And Chinese Character
I've been around trying to find a solution to write chinese characters on an image (png or jpg) with the GD support in PHP4 (and TTF support)...but still looking for!

View Replies !
Escape Character & And #
Does anyone know the escape character for & and # like in :
Update GDO_INFO_ER set V_COMMENTAIRE='B&A' where V_USERMODIFICATION='bilal123'
or
Update GDO_INFO_ER set V_COMMENTAIRE='B#A' where V_USERMODIFICATION='bilal123'
I would like to insert & and # literally in the table.

View Replies !
Everything After ' Character Is Not Displayed
I have been getting strange behaviour when using ' in by textboxes.

eg inputting the following
this is some test text ' and so is this

is saved to the mysql database ok as

this is some test text /' and so is this (with add slashes)
or
this is some test text ' and so is this (without add slashes)

mysql field is VARCHAR(255)

but when I retreive the data and display in textboxes on my web page, text
area type (below) is ok
<textarea class='BodyText' style='WIDTH: 85%' name="textarea"><?php echo
$opta; ?></textarea>

but input type (below) cuts everything off after the ' character. However
this does not happen with other characters such as " or /
<input type='text' class='BodyText' style='WIDTH: 85%' name='test'
value='<?php echo $opta; ?>'>

can anyone explain this behaviour and have a solution so that text with any
' characters in it is fully displayed?

View Replies !
Replace Character (UTF-8)
I apologize in advance if a similar question was already posted, but I
didn't find it.
Here is my problem:

I would like to replace all the special characters ' ¾' with another
special character 'ž' in a string (retreived by an SQL). After that I
would like to update the field with the corrected string.

The table and the field are correctly set to UTF-8.

Is there a way? I have tried with the usage of functions such as
'str_replace', 'utf8_decode', 'utf8_encode' but without sucess.

View Replies !
Match Any Character But
Can I use any reg exp(mainly for mod rewrite) where I can match any
character but a fixed list?

I need to match a string that does not contain any /'s but I don't want to
have to use a character search string. (I don't see any need to have to
hardcode it)

that is,

..

matches any single charactr

and (.*) matches any string

what I want to do is use something like % that means

..%/

which means match any character but /.

Of course it would need to be valid and I know I can't make up semantics for
the reg ex. My point is is that, is that I don't want to have to use
[a-z0-9-%&^$#@!etc...] to mean . but not /.

Surely there is a way to exclude a few characters from . without having to
increase the complexity of the expression 1000 fold?

If you don't get that, then a simple example would be that I have an
arbitrary string and I want to match only if that string does not contain an
a. Sure I can so something like
[bcdefghijklmnopqrstuv1234567890!@#$%^&*()_+]['/.,<>?:"{}+-=~`..........................]
but surely reg exp has an easier way??? (again, this is specifically for mod
rewrite)




View Replies !
Getting Right Character-set From MySQL
I have created MySQL database on XP SP2 machine in cp1250 character-set, and
loaded some data
in the same character-set. When I read table using EMS MySQL Managet 3 Lite,
I get croatian characters displayed correctly, but when I show this data in
php page, I get '?' instead of croatian characters.
I put <meta http-equiv="Content-Type"
content="text/html;charset=windows-1250"> at the HEAD section of the page,
and all text is displayed correcty, except those fetched from MySQL
database.

View Replies !
PHP Character Classes
i'm quite new to php but i can do some of the basics like: initial and response pages and entering data into MySQL database, the problem is i got stuck when i was about to validate the form entries, i want to do it using ereg and eregi but i'm having a hard time looking for an in-depth reference for character classes and their brief descriptions and how to use them.

View Replies !

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