Jump to content

Trying to add php in html that's in a .php...ouch


DarthHate

Recommended Posts

Actually, I have a php page, that defines a template. Somewhere in there I have $head = <html> etc etc.
So basically, $head defines what my front page looks like. The thing is, I want to insert some user statistics from my database on the front page. The database query is obviously easy. But how do I slip it in there? I started trying something then I realised I had no idea what i was even trying to do...
Cheers

Link to comment
Share on other sites

That's a little hard to grasp exactly what you're trying to do. Can you post some code? If it's just as simple as displaying HTML along with PHP, you can jump in and out of PHP code as much as you want. And you can store whatever you want to in a PHP variable if that's the problem.
Link to comment
Share on other sites

[code]
<?

include "../mysqlcon.php";

$admin_info = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_admin"));
$n = basename($_SERVER['PHP_SELF']);

.
.(this is still php)
.

elseif($page == "admin_broadcast.php") { $b19 = "<b>"; }

$head = "
<html>
<head>
<title>$admin_header1</title>

.
.(this is html in a php variable)
.

<center>
<br>
<img src='../images/bh.gif' border='0' style='margin-left: 6px;'>
</center>"
[/code]

on the last line, where img src is, i want to make table, and have the img on the center, an ad on the left and my php query on the right.

Hope it's a bit more clear now, sry for the initial crappy explanation :)
Link to comment
Share on other sites

am i missing something here? seems like all you would have to do is:
[code]
.
.
.
$head = "
<html>
<head>
<title>$admin_header1</title>

.
.(this is html in a php variable)
.
.
.
<table><tr>
   <td>
      advertisement stuff
   </td>
   <td>
      <center>
      <br>
       <img src='../images/bh.gif' border='0' style='margin-left: 6px;'>
       </center>"
   </td>
   <td>
      database query stuff
   </td>
</tr></table>
[/code]

well it seems to me that's all you have to do?
Link to comment
Share on other sites

So is this php variable with all of the html in it going to be displayed later in the script? I guess I'm just not seeing why anyone would want to put all of the html inside of a variable. Maybe if I new more about what you're trying to do with the whole page, I or someone else on here could come up with a better solution to your problem.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.