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.





Delete Function That Deletes A String Of Text


I am trying to fix my delete function that deletes a string of text that may or may not have single, double quotes, pound signs etc.

function delete_bm($user, $url)
{
// delete one text string from the database NOT a url as would be suggested
if (!($conn = db_connect()))
return false;

// delete the Item
if (!mysql_query( "delete from XMAS_WISH_LIST
where username='$user' and XMAS_ITEM='".mysql_escape_string($url)."'"))
return false;
return true;
}

When I run this on my web page, I don't get an error, it just does not delete the item that I am passing it, like the following: "test" (with quotes).

Any suggestions?




View Complete Forum Thread with Replies

Related Forum Messages:
Delete Row From Mysql Only Deletes The Contents?
mysql_query("DELETE FROM cart WHERE ItemId=$ItemId");

There is the code but the result in my databse is that the ID number changes
from, lets say, 77 to 78 with 78's contents being empty. Therefore when I
look at the results - the deleted ID77 is gone but now I have ID78 with no
content!

Does anyone know why and how do I make it stop?

View Replies !
String Replace :: Delete All [img] Tag In A Text String
i need a function that delete all [img] tag in a text string for sample:

$string = This is my text [img:Blue hills.jpg,align=,width=700,height=525,vspace=0,hspace=0,border=1] it's contain many [img:rings.jpg,align=,width=400,height=325,vspace=0,hspace=0,border=1] i want to delete it";

i want affter processed $string will be "This is my text it's contain many i want to delete it". and two jpg file that included in that tag will be save in a array like this: $image[0] = "Blue hills.jpg" , $image[1] = "rings.jpg" .

View Replies !
Delete Entire Line In Text File If Anything In The Line Matches Search String
how would I code a php script that would open a text file, look for a string i specified, and if it finds that string, it will delete the entire line in the text file that contained that text. I'm new to php, so sorry if this is really obvious..

View Replies !
Make Text String Read From Right To Left In Imagettftext() Function
I want to write a text string from right to left instead of from left to right with the imagettftext (); function

I read in teh manual that the angle variable controls this, it says that 0 angle means left to right, so I tried 180, 360 but nothing happens What angle do I need to put it to get it to write it right to left. Code:

View Replies !
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 !
Delete A Substring In The Middle Of One String To The End Of The String
I have a field in a table which stores strings. The format is: productName <font color=red>()</font>. </font> is the end of the string. My question is, how I can delete the substring starting from <font color=red> to the end of the entire string. Any idea?


View Replies !
Write A Text String From Right To Left Instead Of From Left To Right With The Imagettftext (); Function
I want to write a text string from right to left instead of from left to right with the imagettftext (); function

I read in teh manual that the angle variable controls this, it says that 0 angle means left to right, so I tried 180, 360 but nothing happens

What angle do I need to put it to get it to write it right to left

I am writing a hebrew text string with a font.ttf that supports hebrew characters

<?php   
$white = imagecolorallocate($background, 255, 255, 255);
$fontfile = "davidtr.ttf";
$string = "&#1502;&#1495;&#1500;&#1491;&#1490;&#1499;";
imagettftext($background, 12, 360, 3, 17, $white, $fontfile, $string);
?>

View Replies !
Have A Cookie That Deletes Itself
Is there a way to have a cookie that deletes itself when you leave the site. IE: You log into an index.php. You then view add.php, delete.php, view.php, search.php, finishing off with member.php?userid=12, then you leave the site. Is there a way to set a cookie that doesn't expire until you leave the site?

View Replies !
How To Detect And Delete A String Like This
Someone filled out a comment form to me with the following string
within the message:

#file=E:utilxr32Projectswww42t35Href.txt

The comments are stored in a mysql database
When php generates the page to display this field, it looks like this:

#file=E:utilxr32Projectswww42t35Href.txt

If I use something like
DELETE FROM database where lower(`comments`) like "%file=
%"

or if i try
DELETE FROM database where lower(`comments`) like "%\%"

it fails to detect the string.

How do I detect and rid this kind of posting?

View Replies !
Delete Rags From String
I currently have mysql db with a lot of content. Some of the content has [image]filename here......[/image] tags. How do I strip the strings from [image], [/image] and all the content inbetween these tags? I only want this for an RSS feed I am building, so don't want to update the DB. 

View Replies !
Delete String After Comma
How would I truncate a string after a certain character? I don't know the index of that character.

I think this is close, but I need to replace the 18 with the index of the comma in the variable mystring since I won't know where the user put in a comma.

$mystring = "Hello I'm a string, and I have a comma.";
$mystring = substr_replace($mystring , '', 18, -1);

my result of echoling $mystring would be: Hello I'm a string"

View Replies !
How To Delete Only Certain Text In A Mysql Row?
I have a table setup that has a column setup as friends and users can add friends to this column no problem.

What I would like to know is how to delete only certain parts of the text of the row/cell where their friends are stored.

The friends text is seperated by the following :

" , "

That is a space on either side and comma in the middle of the space.

I know how to explode the results and put into an array to display the reuslts, but is there a way to delete only one of the friends if the text is as follows.

 , thomas , frank , irene ,

I think you can get the idea.

Is it possible to do this or should I just update the whole cell without the array[$i] result being the friend?

View Replies !
Delete Text In Inputboxes
I fill out an inputbox and press submit, when I press back or even reload in firefox, the inputboxes continue to have the same values filled out previously.

View Replies !
Deletes The Comment Data
I have a table with data, and another table that comments on that table. Basicly is a forum. I need some code that deletes the comment data if the main data doesnt exist?

View Replies !
Delete String In External File
I must: open a file, keep out a string and delete it.

View Replies !
Preg_replace :: Take A String, And Delete Part Of It
I need to take a string, and delete part of it that are far from a pattern It's for a search engine, i want to mantain only the part of the strings that are around the query how can i do this through a regular expression and filter the string with preg_replace?

View Replies !
Delete Something From A Table Using A String Variable.
Basically, I am trying to delete something from a table using a string variable.

$tsremove = "Available for All Windows Platforms";
$tscat = "solutions";
mysql_query("DELETE FROM techspecs_'$tscat' WHERE '$tscat' = '".$tsremove."'");

So the mysql_query should be DELETE FROM techspecs_solutions where solutions = "Available for All Windows Platforms";

View Replies !
Delete First Line Of A Text File
how i can open a data.txt file and remove the first line and then save it.

View Replies !
Check ' In Text File And Delete
I have 6 document files and some file has ' each line in text about 1000 lines. I want to clear all ' each line and I save all files same folder, how should I do?

View Replies !
Delete First 9 Lines In Text File
how I can delete the first 9 lines in a text file?

View Replies !
Deletes Every Cookie Set For The Specific Domain?
I've been working with cookies and have made errors in setting them causing them to make weird things happen on my site. Is there a way that for a user going to a page, it deletes every cookie set for the specific domain?

View Replies !
Script That Deletes Records That Are An Hour Old.
I am trying to write a script that deletes records that are an hour old. However, I am working on this project with somebody else and they don't use unix timestamps like I am used to. Rather, they use the SQL timestamp (2007-10-02 07:51:00) method. How would you write a query that does what I am looking for? Also how would I write a query that tells me the time left before expiration?

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 !
How Can I Deletes Files Whose Filenames Are NOT Stored In The Database.
I have a folder containing .jpgs files. I also have a table in the database containing filenames of files I want to keep. How can I deletes files whose filenames are NOT stored in the database. Here's the code I use to list files in the database: Code:

View Replies !
Can Delete Function?
Is there a way to tell if a file can be deleted before trying the unlink() function?

What I'm trying to do is have the ability to delete a folder, but only if that entire folder can be deleted. I don't want to have the script delete half the files because of a permissions issue and leave the other half there. It would be better to leave the whole thing and return an error.

My thought is that is_writable should let me know. Can anyone confirm that? It seems that if the file has the right permissions for the script to overwrite it with nothing, it should have the permissions to remove the file.

My other idea if that doesn't work is to check permissions on every file, but I'm not sure whether it would take write or execute permissions to be able to delete a file.

View Replies !
Delete Function
echo"<td align=center><a href='delete.php?prem77=$row[premPropertyID]'><font size=2 color='#666666'>".Delete."</font>[/url]</td>";in delete.php

<?php
if(isset($_GET[prem77])){
$connection=mysql_connect($server, $user, $pass);
if(!$connection)
die("Connection failed");
else
{
mysql_select_db($db);
$query = "delete from prem_propertyad where premPropertyID = '".$_GET[prem77]."' ";
$exec=mysql_query($query);
echo '<script>alert("Property deleted");</script>';
echo '<script>window.location="myneuproperty-postings.php";</script>';
}
}?>

View Replies !
How To Delete Single Email Adres From Text File
I have a textfile:

bla@domain.com
blabla@domain2.com
haha@domain.com
la@domain3.com
zaza@domain4.com

How can I delete a single email from that text file ? E.g. I want to delete blabla@domain2.com so that the textfile will be:

bla@domain.com
haha@domain.com
la@domain3.com
zaza@domain4.com

How can this be done ??

View Replies !
How Easy Is It To Add A Delete Function
I have now managed to get the script to display all records, but I can't get it to delete any records.  The edit works fine but can someone show me how to add a delete button as well so that I can delete the one chosen with the current id please. Code:

View Replies !
Delete Function On Uploader
I have built an image uploader, but with logins etc. etc. for people to have their own areas. However, it suddenly dawned on me, there is no way to actually delete files. I tried to think of a way, but I can't think of any way to do it. NOTE: This is flat, no SQL. Here's the core code for the uploader: Code:

View Replies !
Delete Image Function
I found this great upload script which works perfectly, except the 'delete' function. I have no idea as to why it does not work..

Here is the delete function. However I am not sure the error is there.. Maybe the code has gone wrong somewhere else?: Code:

View Replies !
Email Delete Function
Im looking for ideas on writing a function or finding one that would delete table content based on email being returned based on either unsubscribe or on email bouncing. I am just in the organization phase of writing this script.

View Replies !
Regular Expression For String That Delete Everything Up To And Including The First Occurrence Of A Forward Slash (/)?
how can i take a string and delete everything up to and including the
first occurrence of a forward slash (/)?

View Replies !
Function To Delete The Whitespace From Xml File
is there any php function (or any way ) to delete the whitespace from xml file. i am having this problem when i tried to get some nodes from xml file using php dom it dosn't give me the correct answer.

View Replies !
Parse Part Of String (mid String Function ?)
Can someone tell me how to parse part of a string? I can use the following:

<?php
$text = $_SERVER['PHP_SELF']; //$PHP_SELF //(document.url);
echo $text;
?>

to get this result:

"Your currently at /test.php "

I just want to get "test.php " without the dash. I also need to parse out
parts of other strings. I know how to use Mid(), Left(), and Right() in VB,
but no clue for PHP.

View Replies !
Purpose Of Function EncodeHeader($String,$String)
is the purpose of function EncodeHeader($String,$String), from class.PHPMailer.php (http://phpmailer.sourceforge.net/) specifically since I am suppossed to come up with documentation for a user who does not know anything about source code...

I understand the regular expressions used, but I can't visualize the input vs outcome, and what is the purpose of such encoding. Is it for the server?

View Replies !
Multi Table Insert Delete Select Function Needed.
I am going nuts here and I know with all the functions out there, there must be an easier way to do this. Maybe someone can point me to the right tutorial or even show me how to do this.

I have a $main_id and many $sub_id tables and like to “SELECT to view” INSERT and DELETE those. UPDATE must not be but would be nice.
Here is how it looks:

View Replies !
Array Function Or String Function To Compare?
Ok Say I have two arrays:

array1('Bill, Gates, Microsoft, Seattle, USA');
array2('Microsoft,Seattle, USA', 'Microsoft, Washington, USA');

I need to match a portion of array 1 which is: Microsoft,Seattle,USA with array2.

Is there a function that can compare this and return true if a portion of array 1 is in array 2? In this case we find 'Microsoft,Seattle,USA' in array 1 and array 2.

View Replies !
Is There A Function To Search A String Within Another String ?
for e.g, fnding the word "hello" in this string : "hello world"...

View Replies !
String Search - Search A String Of Text & Return A TRUE Value.
I'm trying to do something pretty simple but I'm stuck on what function I need to use. Basically, I have a script where you can type a message and submit it. But I don't want people to use bad words, so if they do, it displays an error message. Example:

$string = "Fudge off!"

Let's say I don't like the word "fudge"

if ( stringcontains('fudge', $string) {
echo "No cussing!"
} else {
Post the string
}

Does that make sense? I'm basically trying to find some kind of search that will search a string of text looking for the word "fudge" and if it finds it, return a TRUE value. Does such a function exist?

View Replies !
String Of Text
I am trying to figure out a way to have a script that runs on my site that scans the webpage of an other site for a string of text. Actually there are 4 different strings and I was going to store them into an array and then depending on what one it found then echo so and so.

Is something that would be easy to do? I kind of have an idea of how it might work but my inexperience is keeping me from figuring this out.

View Replies !
Write To File Sometimes Deletes EVERYTHING, Leaving Empty File
I've used PHP to save raw data from Flash to an XML in the past. Load the XML into flash, update a couple variables, then send it to PHP to completely overwrite the old .xml file. This works great most of time, but sometimes after a few days, I'll check the .xml and it will be empty (0 bytes).

Not sure if this is caused by a user who aborted during the writing process, or simultaneous connections, etc. Been thinking about doing a backup every day using CRON, but that's a mission and I'd like for it not to happen full stop. Any suggestions?

View Replies !
Getting Text From The Middle Of A String
I have a text file that I'm going to load into a variable. What I want to do is create a second varibale that contains the comments from the html in the text file so any time it finds <!-- it will put the text afterwards into the comment variable untill it reaches --> and then it will stop.

View Replies !
How Do I Replace Text In A String...
I have a form setup to take text from a user and insert it into a MySQL database. The problem lies when the user uses an apostrophe in his text.

The apostrophe causes the mysql_query statement to end early because it thinks the apostrophe is part of the syntax, not knowing it's only part of the value.

Example:

If the user submits the text "I'm from the Shire!" when it's submitted to MySQL it thinks the statement ends at I' and thus causes a failed query.

How can I escape or process these text strings to avoid this?

View Replies !
Search A String Of Text...
I would like to search a string of text for "x" if "x" is found then it echo's something, else it echo's something else... Anyways I'm kind of lost as to the best way to search a string of text (for example "1,2,3,4,5,6,7,8,9,10,11,12") and find lets say "7,"...

View Replies !
Search Through A String For Various Text
My users enter text into a database field in the form of:

this file {link:afile.pdf} is big and this file {link:another.doc} is small.
I have no idea how many times they may enter {link:xxx} into a given field.
The code we worked out (see other post below) fabulously translates the text into a hyperlink.

The problem is that no matter how often the {link:xxx} is in a given field, I only ever get the first file returned; i.e:
This file afile.pdf is big and this file afile.pdf is small.
But what I should get is, obviously:
This file afile.pdf is big and this file another.doc is small.

I need to use some kind of looping function, or a foreach type function. Does anyone have any clues? Code:

View Replies !
How To Duplicate A Text String?
What code do I use to duplicate a text string? For example I have:
$activ = md5( $activ );The thing is, I want to take $activ and convert into md5 hash and store it AND store it in the original format. As of now, all I have it is that it is converting into md5 hash and storing it that way.

View Replies !
Date To Text String
Is there anyway you could go from lets say 10/24/2006 into Tuesday, October 24, 2006. The last part I could do using explode and cases. But I don't know how to make it find the day of the week. Any Idea?

View Replies !
Parsing A Text String
Because of the nature of a UPS shipping script installed on my site, the value passed from a selected checkbox field in the script is both text and numeric - ex: UPS Ground=11.44. Is there a way to parse the text away from the number so that I could end up with two fields :

$ship_type="UPS Ground"
$shipping="11.44"

?

View Replies !
Removing Text From A String
The variable

$text = "icons/default.gif"

and you wanted to get rid of the ".gif" and the "icons/" so it just said "default", is it possible? I have looked through the PHP site but all my attempts have failed.

View Replies !
Specifying Large Text Into A String
Say I have a long text Say I want to specify that $a contain that long text
How do I do so? I saw the following in a plugin code:

View Replies !
How To Get Special String From Text
I have text like bellows:

$text ="demo demo {dd}hehe ahah {mm}and so on{like}";
how can I get the array $s from $text,whick $s should like this:

$S[0] = "dd";
$S[0] ="mm";
$S[0] = "like";

I can get $s by using str_split, does anyone have some simple way?

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 !

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