html - How to php echo content into <div> classes dynamicaly -
Text after "
My goal is to print all results (received from database) according to print and related formation.
In HTML, I can define it as follows:
& div; Div class = "gallery-item category-birds" & gt; & Lt; Div class = "gallery-item image" style = "background image: url ('_uploads / bc7113a3956b7a45e926f30258fa1b83.jpg');" & Gt; & Lt; Div class = "gallery-item-image-pattern" & gt; & Lt; Span & gt; Show image & lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; H3 & gt; ImageTest1 & lt; / H3 & gt; & Lt; P & gt; MyImageDescription & Lt; / P & gt; & Lt; / Div & gt; In Php, I am trying to print the results in a loop (like I did in other examples first), but for some reason this is not working. "animals.php" Include & php (".. / config.php"); $ Result = mysql_query ("Choose from animals where catid = 2 ID id" by DESC, $ Connect); While ($ myrow = mysql_fetch_assoc ($ result)) {// Loop echo begins with ""; Echo "& lt; div class = gallery-item image style = 'background image: url (_uploads / bc7113a3956b7a45e926f30258fa1b83.jpg);' & Gt; "; Echo "& lt; div class = gallery-item-image-pattern & gt;"; Echo "& lt; span & gt; Show Image & lt; / span & gt;"; Echo "& lt; / div & gt;"; Echo "& lt; / div & gt;"; Echo "& lt; h3 & gt;" $ Myrow ['name'] "& Lt; / h3 & gt;"; Echo "& lt; p & gt;" $ Myrow ['description'] "& Lt; / p & gt;"; Echo "& lt; / div & gt;"; } // loop end? & Gt; index.php " animals.php " is included.
The database connection is okay, because "animals.php"
I have the content desired index.php
where the CSS is linked, where classes and others are defined has gone.
I have tried to change those resonances: "for \" -> Not working.
I have tried to change those reverbs: "for" -> do not work.
Can you help me?
< / P>
There is no one in the freeware if you can access the page and it works, then continue with MySQL. The problem is that when you get it included in another page, this issue comes to mind, if animals.php is located in a folder, for example: / inc /. config.php and index.php is located in your docrot (/). This can be caused by a relative problem in loading config.php < / Em> file, because it is looking out of your docroot. I will check this to verify your error.log on my server. I have any temp PHP website that I have created, normally in my < Em> config.php file will be included in index.php because its usage is complete
Some potential solutions:
- To check your error.log, make sure it's in the right place config.php Searching for file
- Include for config.php in index.php
. - Read on php templateing, Example Tutorial -
Comments
Post a Comment