Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 更改个别事件的背景颜色_Php_Mysql_Pdo_Fullcalendar - Fatal编程技术网

Php 更改个别事件的背景颜色

Php 更改个别事件的背景颜色,php,mysql,pdo,fullcalendar,Php,Mysql,Pdo,Fullcalendar,我想更改单个事件的背景色。代码是我将数据发送到事件的方式。textColor似乎会更改,但backgroundColor或borderColor的颜色不会更改。我做错了什么,或者颜色可以改变。我用的是v1 include("connect.php"); require_once("function.php"); $pid = $_SESSION['pid']; $events = array(); foreach($db->query("SELECT * FROM `signings` W

我想更改单个事件的背景色。代码是我将数据发送到事件的方式。textColor似乎会更改,但backgroundColor或borderColor的颜色不会更改。我做错了什么,或者颜色可以改变。我用的是v1

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);

您的foreach后面的第一行出现拼写错误:

$notaryid = $row['notayid'];
应该是:

$notaryid = $row['notaryid'];

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

背景颜色现在正好在文本颜色之上。在这段代码中,我有颜色,但我也使用了背景颜色。我修复了拼写错误,现在可以使用了。我真不敢相信我错过了。一周来,我一直在看《代码的和平》,但没有看到这一点。