PHP表溢出
我正在建立一个系统,让你跟踪你的作业。 我现在遇到了一个问题,我希望放置此表的DIV导致溢出。。。。。好的,没问题-只是它不会水平溢出…有人能帮我吗 有人能帮我把这个装进去吗。。。。或者帮我把这张桌子放在一张桌子里,以适应1100 x 545像素的区域 我有一些好看的东西的间隔。。。把它放在水平方向上PHP表溢出,php,html,css,Php,Html,Css,我正在建立一个系统,让你跟踪你的作业。 我现在遇到了一个问题,我希望放置此表的DIV导致溢出。。。。。好的,没问题-只是它不会水平溢出…有人能帮我吗 有人能帮我把这个装进去吗。。。。或者帮我把这张桌子放在一张桌子里,以适应1100 x 545像素的区域 我有一些好看的东西的间隔。。。把它放在水平方向上 $UArr = array("u1" => "Introduction to Marketing ", "u2" => "Maintenance Unit
$UArr = array("u1" => "Introduction to Marketing ",
"u2" => "Maintenance Unit ",
"u3" => "Starting a biz",
"u4" => "Web Design",
"u5" => "Webserver / PHP",
"u6" => "Modeling / Multimedia Design" ,
"u7" => "CISCO 1 " ,
"u8" => "CISCO 2 " ,
"u9" => "C&G Marketing"); ///unit array
$AArr = array("a1" => "Assignment 1", "a2" => "Assignment 2", "a3" => "Assignment 3", "a4" => "Assignment 4"); //assigment array
$TArr = array("t1" => "Task 1", "t2" => "Task 2", "t3" => "Task 3", "t4" => "Task 4"); //task array
$Connection = mysql_connect($host,$username, $password);
mysql_select_db("dbname");
$Result = mysql_query("SELECT * FROM `tracker` WHERE `CollegeID`='collegeid' ");
if(mysql_num_rows($Result) == 1) {
while($Data = mysql_fetch_array($Result)){
$i = 0;
$Assignment = "";
$Unit = "";
$Task = "";
echo "<table style=\"float:left;\" width=\"200\" border=\"0\" overflow:scroll;>";
foreach($Data as $Item => $Value) {
if(!is_numeric($Item) && $Item !== "CollegeID") {
if($i == 0) {
$Unit = substr($Item, 0, 2);
$Assignment = substr($Item, 2, 2);
$Task = substr($Item, 4, 2);
echo "<tr style=\"text-align: center\"><td colspan=\"4\"><p>".$UArr[$Unit]."</p></td></tr>";
echo "<tr style=\"text-align: center\"><td colspan=\"4\"><p>".$AArr[substr($Item, 2, 2)]."</p></td></tr>";
echo "<tr><td width=\"10\">".$TArr[$Task]."</td><td width=\"10\">".DropDown($Item, $Value)."</td></tr>";
}
if($Unit !== substr($Item, 0, 2)) {
echo "</tr>";
echo "</tr>";
echo "<table style=\"float:left;\" width=\"200\" border=\"0\">";
$Unit = substr($Item, 0, 2);
echo "<tr style=\"text-align: center\"><td colspan=\"4\"><p>".$UArr[substr($Item, 0, 2)]."</p></td></tr>";
}
if($Assignment !== substr($Item, 2, 2)) {
$Assignment = substr($Item, 2, 2);
echo "<tr style=\"text-align: center\"><td colspan=\"4\"><p>".$AArr[substr($Item, 2, 2)]."</p></td></tr>";
}
if($Task !== substr($Item, 4, 2)) {
$Task = substr($Item, 4, 2);
echo "<tr><td width=\"10\">".$TArr[$Task]."</td><td width=\"50\">".DropDown($Item, $Value)."</td></tr>";
}
$i++;
}
}
echo "</table>";
$UArr=array(“u1”=>“营销简介”,
“u2”=>“维护单元”,
“u3”=>“创业”,
“u4”=>“网页设计”,
“u5”=>“Web服务器/PHP”,
“u6”=>“建模/多媒体设计”,
“u7”=>“思科1”,
“u8”=>“思科2”,
“u9”=>“C&G营销”)///单元阵列
$AArr=数组(“a1”=>“作业1”、“a2”=>“作业2”、“a3”=>“作业3”、“a4”=>“作业4”)//分配数组
$TArr=数组(“t1”=>“任务1”、“t2”=>“任务2”、“t3”=>“任务3”、“t4”=>“任务4”)//任务数组
$Connection=mysql\u connect($host、$username、$password);
mysql_select_db(“dbname”);
$Result=mysql\u查询(“从`tracker`中选择*,其中`CollegeID`='CollegeID'”;
if(mysql_num_rows($Result)==1){
而($Data=mysql\u fetch\u数组($Result)){
$i=0;
$Assignment=“”;
$Unit=“”;
$Task=“”;
回声“;
foreach($Item=>$Value的数据){
如果(!is_numeric($Item)&&$Item!=“CollegeID”){
如果($i==0){
$Unit=substr($Item,0,2);
$Assignment=substr($Item,2,2);
$Task=substr($Item,4,2);
回声“”$UArr[$Unit]。“”;
回声“”$AArr[substr($Item,2,2)]。“”;
回显“$TArr[$Task]”。下拉菜单($Item,$Value);
}
如果($Unit!==substr($Item,0,2)){
回声“;
回声“;
回声“;
$Unit=substr($Item,0,2);
echo“”$UArr[substr($Item,0,2)]。“”;
}
如果($Assignment!==substr($Item,2,2)){
$Assignment=substr($Item,2,2);
回声“”$AArr[substr($Item,2,2)]。“”;
}
如果($Task!==substr($Item,4,2)){
$Task=substr($Item,4,2);
回显“$TArr[$Task]”。下拉菜单($Item,$Value);
}
$i++;
}
}
回声“;
要使其水平溢出,只需将其放入另一个宽度精确值(一个表的宽度*您有多少个表)的
在本例中,使用9个表*200px=1800px
我还建议在样式或css类中使用表格宽度,如:
<table style="float:left;width:200px;border-width:0;overflow:scroll;">
您的代码很乱,需要重新排列
Not an big issue with the scrolling. what i suggest to you that take a div and put a desired height width you want and apply the css as
.divName
{
height: //specify
widht: //specify
overflow:scroll;
overflow-x:scroll;
overflow-y:hidden;
}
把结果放在这个div中目前我已经在单元名数组中用
替换了…我会在其他浏览器和分辨率中看到这是什么样子…但是我要结束了…我开始代码盲了…谢谢你的帮助,我已经将它包括在div的CSS中,并且为了调整大小,我增加了在表格中,在单元标题上使用了大量的
。现在看来,接受代码还不错,希望我以后能多做些工作。