I have used below mentioned code :
<html>
<head>
<title>test Document</title>
</head>
<body>
<!--#exec cgi="calc.php" -->
<table>
<tr>
<td></td>
</tr>
<tr>
<td><img src="images1.jpg"></td>
<td><img src="images2.jpg"></td>
<td><img src="images3.jpg"></td>
</tr>
<tr>
<td colspan=3><img src="common.jpg"></td>
</tr>
</table>
</body>
</html>
If I use above mentioned code it show
[an error occurred while processing this directive]
error in front end, now what I have to do should I configure in cpanel and htaccess ?
Related
I have the following code, and the tutorial I followed says that the table should show up, but it doesn't. All that shows up is the text inside the <h1> and <h4> tags, and the external CSS file is also not taking effect. The code I have is as follows:
<?php
include_once('connection.php');
$query="select * from myanimelist";
$result=mysql_query($query);
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles-2.css">
</head>
<body>
<h1> Callum Stewart's Amazing Website. </h1>
<h4> The Home of Entertainment. </h4>
<table align="center" border="1px" style="width: 300px" color="black">
<tr>
<th>Anime Database</th>
</tr>
<tr>
<th>Title</th>
<th>MediaType</th>
<th>Rating</th>
<th>NumOfEpisodes</th>
<th>NumOfVolumes</th>
</tr>
</table>
</body>
</html>
I have a problem with displaying files added by the logged user.
I do not know how to pass the variable correctly to the sql query.
Can anyone help me with this?
Currently, the code looks like this:
<?php
include_once 'dbconnect.php';
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>File Uploading With PHP and MySql</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div id="header">
<label>File Uploading With PHP and MySql</label>
</div>
<div id="body">
<table width="80%" border="1">
<tr>
<th colspan="4">your uploads...<label>upload new files...</label></th>
</tr>
<tr>
<td>File Name</td>
<td>File Type</td>
<td>File Size(KB)</td>
<td>View</td>
</tr>
<?php
$sql="SELECT * FROM files";
$result_set=mysql_query($sql);
while($row=mysql_fetch_array($result_set))
{
?>
<tr>
<td><?php echo $row['file'] ?></td>
<td><?php echo $row['type'] ?></td>
<td><?php echo $row['size'] ?></td>
<td>view file</td>
</tr>
<?php
}
?>
</table>
</div>
</body>
</html>
I am trying to change this record :
$sql="SELECT * FROM files";
to
$sql="SELECT file, type, size FROM files WHERE userId ='$_SESSION[userId]'";
but I still do not get the correct result. Can anyone help?
It looks like the issue with that line is in how you are including the $_SESSION variable. You should have quotes around userId like $_SESSION['userId'] or {$_SESSION['userId']}.
More importantly you should avoid entering variables directly into MySQL queries. I would recommend using MySQLi or PDO instead of MySQL, and look into prepared statements (here or here, for example).
Hello I write PHP header for downloading excel.
If I have 1 table I can set the width of <td> successfully by use width attribute
but if I have two table it's not working. How could I do? because I need multiple table in my excel page file
<?php
header("Content-Type: application/vnd.ms-excel; charset=TIS-620");
header('Content-Disposition: attachment; filename="report_schedule_teacher.xls"');#ชื่อไฟล์
?>
<html>
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=TIS-620" />
</head>
<body>
<table width="100%" style="border-collapse: collapse;overflow:wrap; font-size:9pt;">
<thead>
<tr>
<td width="300">Hello1</td>
<td width="400">Hello2</td>
</tr>
</thead>
<tbody>
<tr>
<td>World1</td>
<td>World2</td>
</tr>
</tbody>
</table>
<table width="100%" style="border-collapse: collapse;overflow:wrap; font-size:9pt;">
<thead>
<tr>
<td width="300">Why I cannot set width if I have multiple table</td>
<td width="400">Noooo</td>
</tr>
</thead>
<tbody>
<tr>
<td>kub</td>
<td>pom</td>
</tr>
</tbody>
</table>
</body>
</html>
Excel, when reading HTML files, really only has one HTML table. If you look at the Excel window you'll see that physically it's just a single table. If you insist on separating the data (which makes no difference to Excel) you can use multiple table bodies:
<html>
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=TIS-620" />
</head>
<body>
<table width="100%" style="border-collapse: collapse;overflow:wrap; font-size:9pt;">
<thead>
<tr>
<td width="300">Hello1</td>
<td width="400">Hello2</td>
</tr>
</thead>
<tbody>
<tr>
<td>World1</td>
<td>World2</td>
</tr>
</tbody>
<thead>
<tr>
<td width="300">Why I cannot set width if I have multiple table</td>
<td width="400">Noooo</td>
</tr>
</thead>
<tbody>
<tr>
<td>kub</td>
<td>pom</td>
</tr>
</tbody>
</table>
</body>
</html>
Output:
By the way, you are abusing MIME types terribly here! This document is not application/vnd.ms-excel or application/xhtml+xml, it's text/html and should not be saved with an XLS extension. Excel can read HTML files, but that doesn't make HTML files Excel files!
I am new to PHP and am running into a small problem with this code. I am trying to make a layout for a page that uses more PHP to fill in the blanks.
When I view the source <? include $navbar ?> is commented out but <?=$pagetitle?> works, why is that?
For reference:
$navbar = "navbar.php";
and navbar.php:
<?php echo "Select Car Change Profile"; ?>
Layout.php:
<?php
echo "
<html>
<head>
<title>Race Data. <?=$pagetitle?></title>
</head>
<body>
<div id='page'>
<table border='1'>
<tbody>
<tr>
<td colspan='3'>Banner goes here.<?=$pagetitle?></td>
</tr>
<tr>
<td rowspan='2'>Left menu</td>
<td colspan='2'><? include $navbar; ?></td>
</tr>
<tr>
<td>Content</td>
<td>Right menu</td>
</tr>
<tr>
<td colspan='3'>Footer</td>
</tr>
</tbody>
</table>
</div>
</html>
";
?>
I'm sure knowing this will help amny future problems I run into.
Also, what are the diferences in using <? ?> vs <?php ?>?
In php, you always need to use <?php /*code*/ ?>
The shorthand version to echo something is <?= /*string*/ ?>, but to run code, such as an include you would need to start with <?php. In your example, this would be:
<tr>
<td rowspan='2'>Left menu</td>
<td colspan='2'><?php include $navbar; ?></td>
</tr>
Correction
I only just noticed that you placed the PHP tags inside another set of PHP tags. You're kind of doing it the hard way. In a PHP file, anything is regarded as an echo, except for content inside <?php ?> tags. So this should work perfectly for you:
<html>
<head>
<title>Race Data. <?=$pagetitle?></title>
</head>
<body>
<div id='page'>
<table border='1'>
<tbody>
<tr>
<td colspan='3'>Banner goes here.<?=$pagetitle?></td>
</tr>
<tr>
<td rowspan='2'>Left menu</td>
<td colspan='2'><?php include $navbar; ?></td>
</tr>
<tr>
<td>Content</td>
<td>Right menu</td>
</tr>
<tr>
<td colspan='3'>Footer</td>
</tr>
</tbody>
</table>
</div>
</html>
The difference is that I didn't put <?php ?> tags around the whole thing.
Try
short_open_tag=On;
in php.ini
And restart your Apache server.
I don't profess to be any good at php, so those who are expert please don't bash me for my noob approach. I am trying to learn.
Some time back, I had someone show me how to break up parts of my web pages and write them as includes so that I wasn't having headers, footers, and navigation repainting for every page. As of yesterday morning, my pages were loading fine, and have been for many years now. However, something seems to have gone wrong, possibly on my server, and now all pages go to home page.
I have my pages set up as such:
index.php
<?php
if (! isset($HTTP_GET_VARS['content']) || ! $HTTP_GET_VARS['content']){
$content="squeeze";
}
else
$content=$HTTP_GET_VARS['content'];
//1
if ($content == "do-you-have-success-habits"){
$page_title="Do You Have Success Habits?";
$keywords="Booking Agent Book, Music Business Career Development Information, Performing Arts Entertainment Information";
$desc="Music Business Booking Management artist career development for musicians, performing artists, agents and managers";
$style="../scripts/style.css";
$popupjs="none";
$storbutnjs="none";
$retreatjs="none";
$rolloverjs="none";
$readform_chkjs="none";
$logo="req-files/logo.html";
$navbar="req-files/navbar.html";
$sidebar="req-files/sidebar.html";
$main="weekly/2013/do-you-have-success-habits.html";
}
include ("req-files/head.html");
include ($logo);
include ($navbar);
include ($sidebar);
include ($main);
include ("req-files/footer.html");
?>
This is a chopped down version of what I have. The whole index.php has all pages written like this, but it also contains includes to other php pages. There is so much content to this site that I've had to build php pages with like informations within one page... I.E. all affiliates would go into affiliates.php and then included into my index.php as such.
// INCLUDE AFFILIATES HERE
include ("affiliates.php");
I'm hoping this is enough information to help me troubleshoot my problem.
A sample of my pieces are like this header file. My variables are in the pieces.
head.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php print $page_title ?></title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="author" content=" " />
<meta name="keywords" content="<?php print $keywords ?>" />
<meta name="description" content="<?php print $desc ?>" />
<meta name="copyright" content="2006-2013" />
<link rel="stylesheet" type="text/css" href="<?php print $style ?>" />
<link href="scripts/twoColLiqLtHdr.css" rel="stylesheet" type="text/css" /><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColLiqLtHdr #sidebar1 { padding-top: 30px; }
.twoColLiqLtHdr #mainContent { zoom: 1; padding-top: 15px; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
<link rel="stylesheet" type="text/css" href="scripts/style.css" />
<script src="scripts/stuHover.js" type="text/javascript"></script>
<link href="scripts/dropdown_menu.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.png" />
<?php
if ($popupjs != "none") {
print("<script src=\"${popupjs}\">");
print("</script>\n");
}
if ($storbutnjs != "none") {
print(" <script src=\"${storbutnjs}\">");
print("</script>\n");
}
if ($retreatjs != "none") {
print(" <script src=\"${retreatjs}\">");
print("</script>\n");
}
if ($rolloverjs != "none") {
print(" <script src=\"${rolloverjs}\">");
print("</script>\n");
}
if ($readform_chkjs != "none") {
print(" <script src=\"${readform_chkjs}\">");
print("</script>\n");
}
?>
</head>
As stated before, I am inexperienced with php. So, I'm having trouble understanding why my pages linked in my nav are going to home (squeeze) page.
Now, my hosting tech support states that it could be deprecated code that is causing this to fail. They are migrating my site, probably to a previous version of php. But I need to know where to begin fixing this. I hope it is a simple fix because this site is huge!
Thank you for your patience and your help.
Heidi
#DrCord:
On this particular example I gave, there are two nav systems. One I call sidebar the other menu. Both are set up as partial html pages.
menu.html
<tr>
<td align="center"><img src="images/design_elements/yellow_spacer.gif" alt="Yellow line" width="745" height="2" border="0" /></td>
</tr>
<tr>
<td align="center" valign="middle" background="images/design_elements/navbar.jpg" width="760" height="42" class="menubar"><nobr>About</nobr> | <nobr>Articles</nobr> | <nobr>Consulting</nobr> | <nobr>Booking Tools</nobr> | <nobr>Seminars</nobr> | <nobr>Teleseminars</nobr> | <nobr>Contact</nobr> | <nobr>Media EPK</nobr> | <nobr>Links</nobr></td>
</tr>
<tr>
<td align="center"><img src="images/design_elements/yellow_spacer.gif" alt="Yellow line" width="745" height="2" border="0" /></td>
</tr>
<tr>
<td><img src="images/design_elements/spacer.gif" alt="spacer" width="1" height="10" border="0" /></td>
</tr>
</table>
sidebar.html
<div id="container2">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td background="images/design_elements/lt-side-shadow.jpg" width="40"><img src="images/design_elements/lt-side-shadow.jpg" border="0" width="40" height="10" alt="Design Element" /></td>
<td valign="top">
<div id="sidebar1">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" style="padding: 10px;">
<table width="90%" border="0" cellpadding="0" cellspacing="0" id="cont">
<tr>
<td class="head">Articles</td>
</tr>
<tr>
<td class="head">Biz Coaching</td>
</tr>
<tr>
<td class="subhead" style="padding-left:10px;" nowrap="nowrap">Programs</td>
</tr>
<tr>
<td class="subhead" style="padding-left:10px;" nowrap="nowrap">Testimonials</td>
</tr>
<tr>
<td class="head">Books</td>
</tr>
<tr>
<td class="subhead" style="padding-left:10px; font-size:95%;" nowrap="nowrap">Huge Success</td>
</tr>
<tr>
<td class="subhead" style="padding-left:10px;" nowrap="nowrap">Guide to Touring</td>
</tr>
<tr>
<td class="subhead" style="padding-left:10px;" nowrap="nowrap">E-Book</td>
</tr>
<tr>
<td class="subhead" style="padding-left:10px;" nowrap="nowrap">I Recommend</td>
</tr>
</table>
<!-- end #sidebar1 --></div>
Again, I thank you for your patience and your help. I know that I need to learn more about PHP, and I am. I am just not clear on what the actual problem is here.