![]() |
![]() |
![]() |
||||
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. |
|
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Jul 2001
Posts: 3,766
|
php help, real easy, for free porn! :D lol
Help me and i'll toss ya a membership haha ;)
I am trying to setup a table where i have it as a template and one with all my data. id like to load some fields from table one, and have them displayed from templates made in table 2. below is an example, however it doesnt seem to parse the variables pulled from the database when its encoded into another template.. below is my example - the field is set to text, also tried longtext $DBLINK = mysql_connect($DBHOST, $DBLOGIN, $DBPASSWORD); mysql_select_db($DBNAME, $DBLINK); $result = mysql_query("SELECT * FROM galleries WHERE ID = $gid",$DBLINK); if ($myrow = mysql_fetch_array($result)) { do { $result2 = mysql_query("SELECT * FROM templates WHERE ID = 1",$DBLINK); if ($mytemplate = mysql_fetch_array($result2)) { do { echo $myrow["modelname"], $myrow["modeldir"], $mytemplate["format"]; } while ($mytemplate = mysql_fetch_array($result2)); } else { echo "Sorry, no templates were found!"; } } while ($myrow = mysql_fetch_array($result)); } else { echo "Sorry, no records were found!"; } ?>
__________________
![]() be our partner - join nichepartners today will.assum.producer @ AmateurCanada.com / icq: 30146166 / facebook.com/will.assum / #amateurcanada |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Jul 2001
Posts: 3,766
|
"tear" no help
__________________
![]() be our partner - join nichepartners today will.assum.producer @ AmateurCanada.com / icq: 30146166 / facebook.com/will.assum / #amateurcanada |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Sep 2005
Posts: 794
|
so you have a table full of templates and you want to load a template that will pull data from another template? If that's what you're trying to do I think you're going about it wrong. If that's not what you're trying to do then please explain again.
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Jul 2001
Posts: 3,766
|
Yes, the page i showed you is a sample of what i want displayed. so it will load sql values from the request ID (e.g. a model set) and then bring up a template from sql (ill have multiple templates)
so the template loads, with variables i bring up from the sql above, which doenst work. in the text field it parses the text but not the php or varialbles <? echo $blah; ?>
__________________
![]() be our partner - join nichepartners today will.assum.producer @ AmateurCanada.com / icq: 30146166 / facebook.com/will.assum / #amateurcanada |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#5 |
MOBILE PORN: IMOBILEPORN
Join Date: Jan 2004
Location: Tinseltown NL
Posts: 16,502
|
would be better to pull templates from flat file, as your way adds an unneeded query that could cripple your server under high loads
example: create a file say post.html and put it in templates folder then put variables such as ##header## in that file then create a php page with this code $SQL = mysql_query("SELECT * FROM Table WHERE ID = '1'"); $Data = mysql_fetch_ojbect($SQL); $Template = file_get_contents("templates/post.html"); $Output = str_replace("##header##", $Data->Title, $Template); echo $Output; |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: Oct 2005
Posts: 143
|
Try this:
$DBLINK = mysql_connect($DBHOST, $DBLOGIN, $DBPASSWORD); mysql_select_db($DBNAME, $DBLINK); $result = mysql_query("SELECT * FROM galleries WHERE ID = $gid",$DBLINK); if ($myrow = mysql_fetch_array($result)) { do { $result2 = mysql_query("SELECT * FROM templates WHERE ID = 1",$DBLINK); if ($mytemplate = mysql_fetch_array($result2)) { do { extract($myrow); echo $modelname, $modeldir, $format; } while ($mytemplate = mysql_fetch_array($result2)); } else { echo "Sorry, no templates were found!"; } } while ($myrow = mysql_fetch_array($result)); } else { echo "Sorry, no records were found!"; } ?> |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Industry Role:
Join Date: Jul 2001
Posts: 3,766
|
I guess its most efficient to do a template html file or to setup individual php pages per template and go from there.. thanks guys...
__________________
![]() be our partner - join nichepartners today will.assum.producer @ AmateurCanada.com / icq: 30146166 / facebook.com/will.assum / #amateurcanada |
![]() |
![]() ![]() ![]() ![]() |