Storing HTML In Database
I want to be able to store HTML input from a text field, and I wanted to encode it when it went in, so that it didn't break the PHP as it was assigning it to the variable. so I used URLEncode and URLdecode, but thenin text, "you'll" ends up as "you�ll", which is not what I want.
Is there something else I could use? I've looked at a few functions in the man pages, but I don't think they're what I need.
View Complete Forum Thread with Replies
Related Forum Messages:
Storing All Html Tags
I have a tab delimited file of items for a shopping cart. Usually I dont have a problem with importing html tags. However this new project uses alot of tags including <table> tags. It seems to be creating a problem with my import. I am already using addslashes for ' but how do I deal with these html tags?
View Replies !
Storing HTML In MySQL
I'm trying to store HTML code in MySQL, to then be rendered from the database as part of a website. The problem I'm having is that the HTML is not rendering when pulled from the database. Instead, the script is treating the entire MySQL field as text and displaying it. For example, instead of rendering "This is my text.", it is simply displaying "<b>This is my text</b>." Code:
View Replies !
Mp3 / Pdf Storing Into Database
What's disadvantages of storing mp3/pdf/doc files into database instead of uploading to a folder . If you store into database its very easy to restrict user to download the files.
View Replies !
Storing Files From Database.
I have a file put into a MySQL database. And when I get this certain file out of the database, the save-as dialogbox wants to save the file as phpgetter.php (this is the same name as the php-file that gets the certain file out of the database). Does anybody know how I can change this? I want to change this "save-as" phpgetter.php into output.ps .
View Replies !
Storing Files On A Database?
I wrote this script to display different files from a database and properly display them by their respective MIME types. I have two questions: the first is that it just so happens not to work, and I'm just wondering if there are any discrepancies that I can't see that maybe someone else can, and the second is what would be the benefits and the drawbacks of storing different types of files in a database, for example files like jpeg and gif images, flash files, and mpeg videos? Code: <?php error_reporting(E_ALL); require 'config.php' $id = $_GET['id']; $dbTable = $_GET['tb']; dbConnect(); $query = "SELECT content, mime_type FROM ".$dbTable." WHERE id=".$id; $result = mysql_query("$query") or die("Invalid query: " . mysql_error()); $data = mysql_fetch_array($result); header("Content-type: ".stripslashes($data['mime_type'])); echo stripslashes($data['content']); dbDisconnect(); ?>
View Replies !
Image Storing In Database
I have script to upload image data to a database, but all that is uploaded is the decription, not the data BLOB itself. There must be something wrong with the code that fread() and fopen() the file, but what? Code:
View Replies !
Storing Sessions In A Database
I know this may be a convulted mess of code but I have spent all day googling, experimenting, and reading tutorials, but to no avail. I want to store sessions in a MySql database to avoid security issues on a shared host. I cannot get this to write my sessions anywhere. Here is the code with questions to follow... Code:
View Replies !
Storing Text In Database
I have a database table that stores text content to appear on a webpage. The user is allowed to edit the content using a textarea field. How do I ensure that line breaks take effect? e.g. The user might have numerous paragraphs to enter in the textarea so how do I ensure that after being stored in db table that they appear correctly in webpage? (should have <p></p> in view source.)
View Replies !
Storing The Images In Database
I have around 500 images each of 70 to 100kb. I want to store it on the webserver. I can store it by directly uploading it (standard way we do it) or can upload to database as medium blob. The upside of storing the images in database is that i can easily have number of views and rating using table fields but i have been suggested by many friends that storing on database using blob is not preferable.
View Replies !
Storing URL's In A Database
I'd think decoding them if they're encoded would result in less space being used. Or is it generally bad practice to use decoded URL's altogether? What about decoding for the DB and encoding for display/links.
View Replies !
Storing Database Resource Links
Could anyone explain to me why the following code fails? // =====Begin sample code===== global $blog; define("dbHost", "localhost"); define("dbUser", "ney"); define("dbPassword", "xxx"); define("dbDatabase", "blog"); function dbConnect() { // Stores the database resource link in the global array $blog["db"] = mysql_connect(constant("dbHost"), constant("dbUser"), constant("dbPassword")) or die("DB connection error: " . mysql_error()); mysql_select_db('blog') or die("Error selecting blog database: " . mysql_error()); } function dbDisconnect() { // Closes the connection represented by the resource link stored // in the global array mysql_close($blog["db"]); } dbConnect(); .. .. .. dbDisconnect(); // =====End sample code===== Upon runtime, PHP produces the following warning: Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/ney/Blog/db.php on line 22
View Replies !
Storing Article Text In A Database
I have a website with an increasing amount of articles and news reports and so I am thinking of moving away from storing each article as a seperate page to having a single page and storing articles in a databasewhich are retrieved using a GET parameter. I see the advantage to me in using this approach as being making use of MySQL's fulltext search capability and less work needed when updating the design of the page. I'm not sure of a few things though: 1. The exact benefits of fulltext. Can someone provide a brief explanation or a good website 2. I imagine that storing just the plain text of the article in the database will result in a single block paragraph when retrieved into the page. Do I need to include the HTML markup with the text in the database or is there a different approach? 3. Will the HTML markup in the article interfere with the ability to search for words i.e. if I have a word "recipes" in an article that is surrounded tags like <b>recipes</b>, will a search on this article pick out the word from in between the tags?
View Replies !
Storing Php Code In A Database (for Use With Eval)
I've got a need to store php code in my database (among the text) that I parse out and execute with eval(), and had it encrypted at first, but have seen now that the decryption process (it's a custom encryption/decryption function set) adds a good half second or so to an already-slow load time. Given that I've taken fairly adequate steps to securing my database, do you suppose there would be a problem storing the code as plain text to shave off that extra time?
View Replies !
Storing Passwords Securely In A Database
I have a login page where a user logs in but I will not have a registration page. I know all about salt, md5, sha-1 and password function by mysql. I am trying to think of the best secure method in storing all the users passwords. I will not have a registration page so I dont know how I can add salt to it without that. Maybe md5 or sha-1 will be secure enought I am not sure yet. *I already have a list of the usernames and passwords that I plan on imporintg into the table .
View Replies !
Storing Checkbox Data In Your Database
Firs of all, I'm thankful the programer ( Dan LaFlamme ) for this code ( Storing Checkbox Data In Your Database ), it is very good, and I have tested it it was excellent, but there is two problems: 1- always appear this message when I'm browsing your code : ( Warning: Missing argument 5 for make_checkbox_html() in c:apachehtdocscheckboxcheckbox.php on line 59 ) 2- I did as you said, and I have designed the database and the tables name as you mentioned, and I have tested your code on your table that you mentioned, but nothing stored in the (lookup_skills) table, so please help me about these problems
View Replies !
Storing String In Database With Variables
I have a string I want to store in a text field in a database. This string has the variable $Name in it. When I pull it out of the database, I want that variable to be substituted with the value I define before I print the string. It doesn't seem to work. I tried looking into eval(), but that doesn't do what I want it to do. Has anyone who has done this before want to shed some light on how to do it?
View Replies !
MYSQL Database Storing And Recall
Im not the ebst when it comes to explaining thngs so if you need any information mroe i'd be happy to give you it. I have a database (That i did not create, Im just using it), that is laid out like this: ID - itemno - elementname - elementdescription ----------------------------------------------- 1 - 998 - title - Brand new house! 2 - 998 - sqft - 807 3 - 998 - address - 1234 one lane 4 - 998 - features - Pool, sauna, backyard, basement Now what I want to do is write a simple way of storing all of that info so that I can recall it by using something like: echo $items['sqft']; and it will return 807.
View Replies !
Storing File Path In Database
Just upload images/videos as normal upload, and store the path to the file in the database. Have a field for views, rating, etc. Then on the script that displays the image or video, mysql_query() to update the database. How to go about each step, is there any tutorial for doing do or please suggest some sample code to do the above. My main concern is how to store the path of the file in database and how to retrieve the file. Means first take the id then query the database get the path and then display it?
View Replies !
Storing Sessions In Mysql Database
I've written a class to store sessions in a database and everything initially seems to be working great. The session information is recorded in the database and the information is updated each time the page is refreshed. The problem though, is that a cookie is still set by the browser and PHP uses the cookie to track the session instead of using the database information. I was under the impression that if you were to use a database to track sessions, then a cookie wouldn't be used or set. I have set the session hander using session_set_save_handler(). How do I correct this problem and make it so that cookies aren't used?
View Replies !
Storing Images In The Filesystem Versus A Database
Spin-off from How to convert image blob files back to image More often than not you will notice programmers storing the path to an image rather than the file itself as a binary object. A path to the image is often referred to as a file-pointer. It is simply a string-type column in your table that allows you to store the directory path in which the actual image file is stored. Storing the binary data is called a binary large object or BLOB. There are advantages and disadvantages and any discussion on the topic usually stirs lively debate. Debate seems an agressive word, doesn't it? Discussion is much more inviting. Debate is good though, as long as the discussion remains on track and highlights pros and cons, advantages and disadvantages. Let's keep this in mind as we discuss ... Storing Images in the Filesystem Versus a Database As always, there is usually no right or wrong way to program everything. Each application should be analyzed, designed and programmed to the predetermined specification with future growth and enhancement in mind. So what primary areas of concern should we keep in mind when dealing with image storage and management in a web application? I'll start with a few and hopefully others can offer more ... Performance Storage Portability Performance The biggest advantage to storing a file-pointer as opposed to the binary data in a database table is speed. Period. And I'm not just talking about database-retrieval speed here so let's clarify that first. It should be quite obvious that reading from a table containing mere text as opposed to large binary objects is going to be faster. This issue can be circumvented in binary storage solutions by keeping the actual BLOB column in a table all by itself with a foreign-key relationship to the other tables -- no need to be reading this table into memory when all I really want is the end result, the image itself, right? Right. But, even after that we have to read that column's binary data from the database and then push it out to the browser. In my experience, allowing the HTTP server to retrieve an image from the filesystem versus reading binary data from the database table has always been faster. If you have a setup that proves this wrong you are going to have to share it here because I would truly love to learn from you. Storage The database is going to be a fraction of the size when using file-pointers as opposed to BLOBs but the filesystem is going to be the same either way. Security and Disaster Recovery? You can secure, backup and restore directories and databases equally when structured correctly. A well-designed application and well-designed database structure within that application (which is stating the same thing if you ask me) makes the difference. You are going to incur the Hard Disk Drive (HDD) storage somewhere whether it is in the filesystem or the database. That much can be agreed upon. Portability If and when I need to port my appication and/or the data along with it, how well does it lend itself to portability? BLOB solutions make this pretty easy. Just move the database. But the same can be said for file-pointers if you store them correctly. The biggest key to storing the path though is how you store the path. For Windows users you can save the file's Universal Naming Convention (UNC) instead of the actual disk location (such as path oimagesexample.jpg instead of c:imagesexample.jpg). Other filesystems have lots of ways to overcome this minor limitation (symbolic links, samba shares, etc.). This is quite helpful when it comes to application portability. Summary The original question that prompted this topic was something along the lines of "Would I be designing it wrong if I stored the path in the database rather than storing the image itself?" to which I would reply no, you can do it that way, but do you want to? Hopefully this discussion will take off and others will offer valuable input.
View Replies !
Identifier For An Object When Storing In A Relational Database
I'm currently in the middle of writing a persistence framework, and I have to make a design decission. The framework will take care of all the saving and restoring objects, and also the relationships between them. Obviously, I need a way to identify objects uniquely. Now, one way would be to use an autogenerated id from a autoincremental field in the DB. Code:
View Replies !
Calculating The Size Of A Web Page And Storing It Into A Database.
I tried filesize(), but it only calculates the size of a file placed within the folder (I want to calculate the size of a page/site which is of course not in the root, and is somewhere else). In other words, it gave me the following error: Warning: filesize(): Stat failed for ht*p://www.foo-site.com/foo.html (errno=2 - No such file or directory) in /home/www/size.php on line 136 Next, I tried the readfile() function, which worked, and stored the size of the document into the MySQL db - but it showed a preview of the whole webpage I applied (as you see when using the include() function) instead of showing it's size. Code:
View Replies !
Storing Variables In Forms And Insert To Database
I have 4 forms(A,B,C,D) and a thank you page for my questionnaire. People will be redirected to B or C depending on the last question's answer. B or C will redirect to D after B or C is finished. D then goes to the thank you page. I want to get all the answers from A,B/C,D first and then insert all the answers into the database instead of getting each form's answers and update the database each time when people click the continue/sumit button on each page. Code:
View Replies !
Storing BINARY File Uploads Into A Mysql Database
I know I do a column with a BLOB of size of the max file size I guess... then I tell php to do: fopen($FILE,'rb'); fread($file,1024); (loop) then I send the info to the db??? How would I download the file later then, would I have to write it to a fiel first? or could I ouptu it to the browser if I supply , content-type: binary?
View Replies !
Storing Images In Database - Makes Page Load Much Slower?
I have just taken over a site which was developed in php / mySQL. It is a large shopping cart system. I was shocked to learn that their mySQL database was over 1GB in size. I have seen forum DB's get very large but never that large for a shopping cart site so I investigated further. It turns out they have stored all of the product images and I believe even many of the basic site images in the database itself as a longblob type. There is one table that is 860MB in size. Code:
View Replies !
HTML In A Database
I've been using BLOBs to store the HTML coding in the database - and I can easily pull them back and spit them right into the PHP driven page to have all the bolds and italics and picture links and so on. but is there a better way to put them in the database.
View Replies !
Inserting HTML Into A Database?
I'm trying to upload HTML into my database. I'm using: $description=addslashes($_POST['description']); However, when i use HTML inside the content that i'm uploading, the code gets all messed up, when viewing the code inside the textarea? I'm trying to build an EDIT section, But the code i want to edit is not user friendly? Code:
View Replies !
HTML Form To Database
Is it easy to create an HTML form that connects to a database through a data handling form. I have php 4.4 on my server and wrote all my scripts in 5.0 language and they dont run so i just wanna use an HTML form to submit to a database and to retrieve info from it.
View Replies !
How Do I Write This Html From A Database?
I have a small database "Database.txt", each line of which looks something like: rv001,Some More Cities,112.00,OK,*1R: Paris*2_4R: London*4_6R: New York*8R: Moscow*10R: Rome*, I use a bit of php code to find an entry like the one above "rv001", and print an element of it out, like so: Code:
View Replies !
Database As Html Page
At both these sites. is there a way to make an .html page for each row of a database,and then to have a directory created automaticall for the date it's in. i thought i saw this done converting to html pages in a forum once. is this clear?
View Replies !
How To Get Html Tags From A Database ?
I have a database where people themself put a profilname into. I have just had a user who called his profil HisName<something> When this was written in my profil name list it only said HisName. Probably because the browser thought that <something> was html coding. So how can I get a name like that from the database without any mistakes by the browser. Is there some special way I should get the data from the database, or ?? I looked in MyPhpAdmin and here his name was HisName<something> so it is put in the database OK, it's when I get the name in the browser it can't get it right.
View Replies !
Html Email Into A Database
I can't seem to find the exact answer when I do a search for this topic. Let me take a shot here to see if anyone knows what I am seeking. I want to use imap_open() to parse a POP email box. I can connect to the server just fine and download the mail. What I want to do is, I want to download the entire email message instead of just the parts of the email.
View Replies !
HTML Tags In Database
I'm using WYSIWYG editor to add some contents into database. When i add the contents in the database they are displayed the same way as when i write them in the editor, however i want them to be displayed with html tags. e.g i don't want them saved in the db as 'text' but as '<p>text</p>'. $text = htmlspecialchars($text) before adding contents into the db should be working.
View Replies !
HTML Table Fetched From A Database
I want to generate a HTML table based on names fetched from a database. The tricky part is that I want to generate the table so that the names is written on both the top row and the left collumn. Should look something like this ---------------------------------------------- | ||NAME 1 | NAME 2| NAME3| |NAME 1| | | | ---------------------------------------------- |NAME2| | | | ---------------------------------------------- |NAME3| | | | ---------------------------------------------- Hope that anybody has a idea how to solve this.
View Replies !
Secure Way To Store HTML In The Database?
to my understanding it is very unsafe to allow users to submit HTML from a form to the database. What if I allowed the user to use HTML, but when they submitted it I would change all the >'s and <'s into backets [ and ]. So the user would type out: <img src="image.jpg"> and it would be inserted into the database like this: [img src="image.jpg"] Would this be a secure way of doing it? Or is there a better way?
View Replies !
Convert Text From Database For HTML
I'm pulling text from a database (MySQL) and I'm using the nl2br () function to convert the line breaks DESCRIPTION="<?php echo nl2br($row_rsttheJobResults['description']); ?>" This creates the following example "A new line will be created soon < 'br' > and here it is." However the website that receives this cannot accept the characters < and > So I want to convert this "< br >" into this "<p>" Could anybody help me add to the nl2br () function to convert the < br > tags? * the spaces between the < and br are there because they won't show in the message otherwise
View Replies !
Publish JPEG Or HTML From A Database
I have a jpeg file and a HTML page that are stored in two separate blob fields of a databses, namely interbase, what is the best method of pulling each of these items out so that they can be displayed in a web browser.
View Replies !
Needs Guidance On Database And Html Integration
I have looked through forums and tutorials and with the advice there I have managed to manipulate my MYSQL database. I have created HTML forms to add data and select data with PHP to handle the file processes. However I have not been able to find an example of how to do this in a single HTML, or PHP, file. At the moment what happens is that data, or a search request, is entered, the user presses the validate button, the variables are processed by the PHP file and that is it, single time, ie no loop back for more data entry. Code:
View Replies !
Importing Html To Mysql Database
I'm preparing to convert my "old" non-dynamic html website to php and mysql. I finally found a mediumly fast way to turn the html pages into raw data, but it has html codes within the content that I want to stay within the database. For example, I have DIV and CLASS codes with quote marks (div id="fred" - p class="red") that I want to stay. I've read through the mysql documentation and understand that I can set the fields-terminated-by, fields-enclosed-by and lines-terminated by with characters, but I can't find which characters are allowed. I also am not sure about doubling the quotes in order to keep them ("") or adding slashes ("), or what. I did a test run with phpmyadmin to add a simple four field test text file to a table I set up with phpmyadmin. I tried changing from the default field separators of ";" to "^" and record ends of "#". Nothing. Code:
View Replies !
Insert Data To The Database From An HTML Form
i want to insert data to the database from an HTML form but when i run the script it will insert NULL to the database. On that note i like to request for help from anyone. This is my code <?php include "connect.php" $sql = "insert into TEST values(:name)"; // Parse SQL $stmt = OCIParse($conn,$sql); // Bind php variables to Oracle columns OCIBindByName($stmt,"NAME",$name); // Oracle converts all column names into UPPERCASE // Run SQL OCIExecute($stmt);
View Replies !
|