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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 01-24-2022, 08:06 PM   #1
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 770
Whats this called?

I want to take data from an SQL database and have specific parts of it included on a .php page using a placeholder, something like this:

[title1] - Which inserts the first title in a column, [title8] would insert the 8th title in that same column, anywhere on the page where that placeholder tag is used.
[image1] - Inserts the first image in a column [title28] would insert the 28th image in that same column again, anywhere that placeholder tag is used.

But then further down the same page, I want to be able to use that same placeholder, to pull exactly the same data again.

Does that have a specific name I should be looking for? Ive tried a few Google searches to find what I want but I'm coming up blank :/
__________________
DMCASUITE
BETA Testers Needed.
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-24-2022, 08:29 PM   #2
sarettah
I'll make you famous
 
Industry Role:
Join Date: Oct 2002
Posts: 13,941
You just do a str_replace in the page. https://www.php.net/manual/en/function.str-replace.php

Pull the text for your page into a string.

Pull your data from the database.

Replace any tags in the data string with the appropriate data.

For example:

Database of people and in there are their first name, last names and age.

We are going to send out multiple letters to various people.

So, here is the text that we are going to use:

"Dear [first_name] [last_name],
We see that you are [age] years old, [first_name]. "

We have that stored in a variable called datastring


Then we pull the data:

Select firstname, lastname, age from data_table

Then we loop through the returned data

while we have data:

Letter=str_replace(array($row['firstname'],$row['lastname'],$row['age']),array('[first_name]','[last_name]','[age]'), datastring);

Each occurrence of [first_name] will be replaced by the data in $row['firstname'], etc.

send the letter

then next letter

That make sense?

You might be able to find other stuff by searching on replacing template tags, things like that. The text is the template and the tags are the fields in the template that designate what to replace.

There are several template systems out there that are pre-canned also.
.
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-24-2022, 11:01 PM   #3
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 770
I think so, I'll have a play around over the next couple of days, I'm not entirely sure that will do what I'm envisaging though, but it seems usable for something if not this specific piece of code I'm wanting to throw together.

Thanks for the response
__________________
DMCASUITE
BETA Testers Needed.
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-25-2022, 07:24 AM   #4
CurrentlySober
Too lazy to wipe my ass
 
CurrentlySober's Avatar
 
Industry Role:
Join Date: Aug 2002
Location: A Public Bathroom
Posts: 38,196
I was hoping to find a picture of an unusual looking poo, to which I would have answered 'Delightful'
__________________


👁️ 👍️ 💩
CurrentlySober is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-25-2022, 09:09 AM   #5
TheLegacy
SEO Connoisseur
 
TheLegacy's Avatar
 
Industry Role:
Join Date: Apr 2003
Location: Brantford, Ontario
Posts: 15,549
Quote:
Originally Posted by CurrentlySober View Post
I was hoping to find a picture of an unusual looking poo, to which I would have answered 'Delightful'
Is that better?

__________________
SEO Connoisseur


Skype: robjameswarren
RobertWarrenSEO.com

TheLegacy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-26-2022, 01:45 PM   #6
CurrentlySober
Too lazy to wipe my ass
 
CurrentlySober's Avatar
 
Industry Role:
Join Date: Aug 2002
Location: A Public Bathroom
Posts: 38,196
Quote:
Originally Posted by TheLegacy View Post
Is that better?

That's 'Utterly Delightful'
__________________


👁️ 👍️ 💩
CurrentlySober is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
column, placeholder, page, inserts, title, image, tag, insert, data, specific, pull, coming, blank, searches, google, 28th, [title8], included, .php, [title1], 8th, [image1], [title28], database, sql



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.