更改单个事件的背景颜色

时间:2014-09-07 21:08:37

标签: php mysql pdo fullcalendar

我想更改单个事件的背景颜色。代码是我将数据发送到事件的方式。 textColor似乎有所改变,但backgroundColor或borderColor的颜色没有改变。我做错了什么或者可以改变颜色。我正在使用V 1

include("connect.php");
require_once("function.php");
$pid = $_SESSION['pid'];
$events = array();
foreach($db->query("SELECT * FROM `signings` WHERE `pid` = '$pid' AND `done`= 0") as $row) {
    $notaryid = $row['notayid'];
    $title = $row['fname'].' '.$row['lname'] . ' ' . $row['coname'] . ' ' . $row['city'] . ' ' . $row['state'];
    $signstart = $row['signstart'] . ' ' . $row['starttime'];
    $id = $row['id'];
    $ordern = $row['ordern'];
    $address = $row['street1'] . ' ' . $row['street2'] . ' ' . $row['city'] . ', ' . $row['state'] . ', ' . $row['zip'];
    $hphone = 'Home Phone ' . $row['hphone'];
    $cphone = 'Cell Phone ' . $row['cphone'];
    $wphone = 'Work Phone ' . $row['wphone'];
    $custid = $row['custid'];

    $sql1 = "Select name from customers WHERE custid = '$custid'";
    $stmt1 = $db->query($sql1);
    $row1 = $stmt1->fetchObject();
    $name = $row1->name;  


    $sql2 = "Select firstname,lastname,color from notarys WHERE nid = '$notaryid'";
    $stmt2 = $db->query($sql2);
    $row2 = $stmt2->fetchObject();
    $colors = $row2->color;
    $notary = $row2->firstname . " " . $row2->lastname;


    $eventsArray['id'] = $id;
    $eventsArray['ordern'] = $ordern;
    $eventsArray['title'] = $title . ' ' . $name;
    $eventsArray['start'] = $signstart;
    $eventsArray['date1'] = phpdatetimeam($signstart);
    $eventsArray['address'] = $address;
    $eventsArray['hphone'] = $hphone;
    $eventsArray['cphone'] = $cphone;
    $eventsArray['wphone'] = $wphone;
    $eventsArray['notary'] = $notary;
    $eventsArray['allDay'] = "";
    $eventsArray['color'] = $colors;   <-- This is were I change the color
    $eventsArray['textColor'] = "#FFFFFF"; I have tried backgroundColor and
                                 BorderColor but now of them work
    $events[] = $eventsArray;
}


echo json_encode($events);

1 个答案:

答案 0 :(得分:0)

你的foreach之后的第一行你有拼写错误:

$notaryid = $row['notayid'];

应该是:

$notaryid = $row['notaryid'];

我不知道这是否是一个问题,我正在尝试查看你在events数组中设置背景颜色的位置,我只看到文本颜色,这是你数组的最后一个元素。 / p>

相关问题