![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
|
![]() Is this possible to do?
I have some HTML stored in a database and I want to add a query to the HTML code that gets pulled when it gets displayed on a page, is this possible to do? Im not finding anything on Google so I'm thinking it might not be? If not, are there any alternates to storing a query in a database and pulling it through SQL other than including the query itself in an include.php file and inserting that into the .php page? ![]() Basically, pulling one sql querie that includes another in the data that is being pulled, if that makes sense?
__________________
SOMETHING EXTREME IS COMING SOON! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Pay It Forward
Industry Role:
Join Date: Sep 2005
Location: Yo Mama House
Posts: 76,984
|
stackflow for free fast help
__________________
TRUMP 2025 KEKAW!!! - The Laken Riley Act Is Law! DACA ENDED - SUPPORT AZ HCR 2060 52R - email: brassballz-at-techie.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
|
Unfortunately, none of what you wrote makes any sense
![]()
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Just Doing My Own Thing
Industry Role:
Join Date: Jan 2011
Location: London, Spain, New Zealand, GFY - Not Croydon...
Posts: 25,038
|
Damn - That gave me a headache - You need to start that chapter again
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |||
Confirmed User
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
|
index.php - pulls header.php as an SQL query.
header.php - is a blank page that contains an SQL query to pull the html code from a database. Can I include another SQL query in the header.php HTML even though the code is stored in the SQL database, not in the actual header.php file. I know that I can include an SQL query in a regular server side php include, that contains HTML code, not an SQL query to pull the HTML code. Can I do the same thing pulling the code out of my SQL database? Quote:
Quote:
Quote:
It doesnt work when I do it like that, but its entirely possible I'm not using the right method of calling the 2nd query, if it is even possible.
__________________
SOMETHING EXTREME IS COMING SOON! |
|||
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Industry Role:
Join Date: Aug 2006
Location: Little Vienna
Posts: 32,235
|
You want to pull code from SQL ?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
|
I've re-read this like 5 times, and I still don't know what you are trying to accomplish.
Are you asking if you can store PHP code within a mysql database column? Yes, you can. This is an absolutely terrible idea, but yes, it can be accomplished using eval(). I am unable to determine from your post what your end goal is but if eval() is the solution to your problem, then you need to take a step back and redesign this. You should not be storing SQL queries or PHP code in a mysql column. Please explain what you are trying to actually do, without any of your code examples.
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
|
Again I have no idea what you are doing and why you are even using loops if you are doing LIMIT 1, but maybe this will steer you in the right direction.
PHP Code:
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Industry Role:
Join Date: Apr 2019
Posts: 657
|
I like PB, and some of his help threads are reasonable, but I don't know why anyone bothers seriously replying to parody level nonsense like this, where the only possible excuse is trolling, and it's not that.
What he wants is simple to understand, it's just so idiotic that it can't possibly be that. But it is. If you don't know anything about MySQL, or even what a database is supposed to be for, the solution isn't being spoonfed more code to paste into the spaghetti monster you have already, inspiring a new thread tomorrow, it's to stop using it until you know how to use it.
__________________
__________________ |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
Industry Role:
Join Date: Aug 2006
Location: Little Vienna
Posts: 32,235
|
Quote:
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
Confirmed User
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
|
Quote:
Basically, its for a makeshift CMS type admin area to manage a couple of sites via a crud system and on the external side of things, wanted to generate the pages using SQL outputs to save time (and be able to use predefined templates) but I also wanted to include a query in those templates to pull some niche specific data instead of having to hand code it into each template individually, I figured having that data stored in a seperate table and pulling it into the html code (stored in another table) would be the quickest way of doing that?
__________________
SOMETHING EXTREME IS COMING SOON! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
MFBA
Industry Role:
Join Date: Mar 2003
Location: PNW
Posts: 7,230
|
i really dont know what the confusion was. i understood your question quite easily. i will however agree with someone above who said what you want to do is a terrible idea.
also, no one is going to write the code for you, unless you pay us. otherwise the best youll get is psuedo code or a link to more help. asking people to work for free is kinda silly, IMO. will you come do some random stuff for me for free? youd be better off to save those templates to disk, as opposed to in a database, it will be quicker and cheaper. what you want to do is perfectly possible youll just have to play with delimiting things correctly so they come in and out of the database correctly. but not recommended. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 | ||
Confirmed User
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
|
Quote:
Quote:
![]() Pointers in the right direction are always appreicated, as are links to tutorials, etc. The only way I'll learn is by doing things (and messing things up) myself ![]()
__________________
SOMETHING EXTREME IS COMING SOON! |
||
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 |
MFBA
Industry Role:
Join Date: Mar 2003
Location: PNW
Posts: 7,230
|
templates will be faster to load(less work for the system) and safer, also a lot less complexity as you wont have to deal with the issues you are currently trying to solve.
what you what to do is quite literally the purpose of templating systems. diving deeper into what you are doing.... you should never put sql credentials IN a file that is in a public directory. If PHP is broken for some reason in the future it would allow anyone viewing that page to see the database credentials. Always store credentials and other important stuff outside of the public directory and use an include to access it inside code that lives in public directory. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
|
If you have php code in your db, and are running it via eval(), then any sql injection exploit (which there likely is, given you are new to this) will basically mean remote code execution.
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
![]() |
![]() ![]() ![]() ![]() ![]() |