how can we get raw html from mysql database in php [closed] - php

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I have a table in database. this table has one field which consist raw html data below format:
<iframe width="475" height="271" src="http://www.youtube.com/embed/GcUYa4_1aYs?rel=0&hd=1" frameborder="0" allowfullscreen></iframe>
when I am fetching the data from database its rendering the html code. I want to just show as it is(Raw html) in PHP without rendering. how can i display it? when i am showing that, its just rendering the data from database.

You can use htmlentities or use single quote '', this is a very good SO question and answer on difference in php between single and double quotes.

Use htmlentities($your_html_code);
It is your safest bet, it does what htmlspecialchars() does, and more.

Related

XCRUD : how to insert html? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I use an old library xcrud (php) from https://codecanyon.net/item/xcrud-data-management-system-php-crud
And I fo try to insert some HTML tags, but they are all stripped.
Any idea on how to avoid stripping html tags ?
Regards
There is a new Version of Xcrud that could work better for your need. You can find it here www.xcrud.net and they still offer support.
To also avoid the tags from being stripped, you can use tinyMCE by specifying a column to be text.

How to save chemistry equations in MySQL table field [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I want to save chemistry equations in my database, equations for example:
`AB + O2 → Oxide of A & B`
Even typing here 2 is coming beside O whereas it's the symbol of oxygen like below:
 
Please note: If I am trying to directly copy and paste it in MySQL table field using phpMyAdmin, there also O2 is not getting saved as a symbol.
Note: MySQL field is text , collation is utf8mb4_general_ci.
Saving from php to mysql is next step. For now at least simply copying it (from phpMyAdmin) should work in MySQL.
I noticed that the subscript numbers on the web pages aren't actually subscripts, its just the HTML tag making it. (the <sub> tag).
So you have to use some kind of converter for it or do it yourself to convert it to actual unicode subscript.
If you want to print the equations to web page from database, you can save it with the HTML tag e.g.
H<sub>2</sub>O

Scrollable PHP Table [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I am currently working on a website for a client, and the client specifically wants all PHP tables to be scrollable. Is there any way that this can be done? I have tried wrapping in a div and I tried adding it into the php stylesheet, but I am still not getting anything. So any help would be greatly appreciated thanks. It's a data table for live feed data.
I assume you get some data from a database through php and generates a html table through php with the data in it?
Wrap a div around the table with the following css
div{
height: 300px, // or another height
overflow: scroll
}

Strip HTML tags AND double quotes [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I want to clean my entries that look like
“If you think adventure is dangerous, try routine; it is lethal.”
<p>Life isn't about finding yourself it's about creating yourself. </p>
I need to remove HTML tags and double quotes and single quotes if they are in the beginning or the end of the string.
There was a function, but I don't remember what it was or something like a class...
You can remove everything with ^[“"'‘]|[”"'’]$|^<[^>]*?>|<[^>]*?>$
Here is a demo.

how to $_GET when it has a ' in the text [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I pass a variable called txt from one query on a web page to another web page using
<?php echo $_GET['txt'];?>
the problem some time the text will have a word like don't in it. the (') causes things to just stop. I need to output the variable as read from the database which would include any text that was in the field
When using $_GET you should use urlencode() and urldecode().

Categories