Re: why $message cannot to be inserted to mysql? see inside

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Adam
Thank you for your help.
Could you demostrate how to use strip_tags() and other functions to get
"thank you adam" from the code you've given:

<html>
<head><title>Something</title>
</head>
<body>
<!-- advertising -->
"thank you adam"
<!-- start content -->
<p>welcome to the page content</p>
<!-- end  content -->
<!-- more advertising -->
</body>

Thank you.

Bo
----- Original Message -----
From: "Adam Royle" <ifunk@myrealbox.com>
Newsgroups: php.db
To: <bo1st@hotmail.com>; <php-db@lists.php.net>
Sent: Monday, April 21, 2003 5:33 PM
Subject: Re: why $message cannot to be inserted to mysql? see inside


You'll need to use addslashes() before it is put into the database.
Also make sure that your db schema allows for the number of characters
you are inserting. With your second question about only grabbing text,
use strip_tags() to get rid of html tags. You may also wish to use the
other string functions to only grab text within certain tags. Eg. you
may only want the text between certain tags (such as <!-- start content
--> and <!-- end content --> below) I have written some code which lets
me extract this info if you want it.

<html>
<head><title>Something</title>
</head>
<body>
<!-- advertising -->
<!-- start content -->
<p>welcome to the page content</p>
<!-- end  content -->
<!-- more advertising -->
</body>

Hope that helps,
Adam


> how to get "specific" contents of a webpage?
>
> £­£­£­£­£­£­£­£­
> $filename="http://blahblah/index.php";;
> ...........
> ob_start();
> $message = @readfile($filename);
> if (false !== $message) { // no readfile error
> $message = ob_get_contents();
> }
> ob_end_clean();
>
> if I echo $message, there is no problem for it show on the screen,
> however,
> it won't get inserted into database which is frustrating me a lot(if
> change
> $message="ok", it can be inserted perfectly fine):
>
> $insertQuery = "insert into posts values ( \"{$fid}\",
> \"{$tid}\",
> \"{$pid}\",
> \"{$author}\",
> \"{$message}\",
> \"{$subject}\"
>
> )";
> @mysql_query ($insertquery, $conn);
>
> based on this, even if I could insert $message later on, how do I
> differentiate the contents from images, such as I only want to insert
> text
> info of $message and despite all the images.
>
> thank you, I'm getting frustrated.
>
> Bo


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux