小编Mih*_*rga的帖子

将具有单个键和字符串值的数组拆分为具有多个键和值的数组

我有一张桌子,存放学生在一个学期和一个学期注册的课程.我用特定学生的课程代码填充它.以下是获取以下课程代码的功能:

function get_course_code(){
    global $connection;

    $query = "SELECT DISTINCT course_code ";
    $query .= "FROM tbl_registered_courses_400 ";
    $query .= "WHERE matric_no = '03/55ec101' LIMIT 10";

    $course_code_set = mysql_query($query, $connection);
    confirm_query($course_code_set);
    return $course_code_set;
}
Run Code Online (Sandbox Code Playgroud)

当我在主页面中调用该函数时.它返回了以下结果

$courseCode = get_course_code();
$courseFilter = '';
while ($courseList = mysql_fetch_array($courseCode)){
    $courseList['course_code']; 
    $courseFilter .= "\""."{$courseList['course_code']}"."\",";
    $courseFilter;
}

$course = array($courseFilter);

print_r($course);
Run Code Online (Sandbox Code Playgroud)

Array ( [0] => "PHY 432","CSC 491","CHM 401","CHM 402","MAT 451","MAT 452","CSC 423","BLY 401", )

我想将$ course数组拆分成一个数组,该数组将具有上面要读取的字符串值

array(
    [0] => PHY 432
    [1] => CSC 491
    [2] => …
Run Code Online (Sandbox Code Playgroud)

php mysql arrays

4
推荐指数
1
解决办法
188
查看次数

Highcharts定制PHP/MySQL

我正在尝试自定义图表并为我们的客户提供演示以供他们批准.

我们现在面临的一些最终问题是,

  1. 问题:在柱形图的高位图中可以进行分页.假设我们有50或100列.

    我们怎样才能避免我们的图表变得拥挤.

    例如,看看这个js小提琴

    http://jsfiddle.net/justin69/4xSNU/1/

  2. 问题:如果我们将图像或徽标嵌入到图表中并尝试使用其中任何一个导出它jpg/ jpeg我们会收到错误.

    在jsfidlle它的作品,

    但在我们的localhost上它给出以下错误消息.

    About to transcode 1 SVG file(s) Converting 551bc090a93c120f987375135e7744db.svg to temp/551bc090a93c120f987375135e7744db.jpg ... ... error ( SVGConverter.error.while.rasterizing.file)
    Error while converting SVG. SVG code for debugging:

javascript php mysql jquery highcharts

3
推荐指数
2
解决办法
2043
查看次数

输入类型日期html5和从数据库接收数据

我工作的Chrome地方规定WAMP,PHP版本5.我使用的输入型日期,这显示日历.事实上,我在用户的数据编辑页面中得到了一些变量.我担心的是收集了所有数据.但是对于日期而言,不是在数据库中显示记录(由其确认var_dump),而是显示占位符Day / Month / Year

我不感兴趣的是,当且仅当我的字段为空时,我想要这个占位符.

以下是该字段的语法:

<input name="datedepart" type="date"  value="<?php echo date('d/m/Y',strtotime($data["congestart"])) ?>"/>
Run Code Online (Sandbox Code Playgroud)

有办法吗?

亲爱的,尊敬的.

php html5 date input

3
推荐指数
1
解决办法
5万
查看次数

在zend_pdf中生成完整大小和高质量的图像

我尝试过类似的东西

public function getPdf()
{
  $imagePath=C:\Users\Hp\Desktop\image.jpg;
  $image = Zend_Pdf_Image::imageWithPath($imagePath);
  $page->drawImage($image, 40,764,240, 820);
  $pdf->pages[] = $page;
  $pdf->save('new.pdf');
}
Run Code Online (Sandbox Code Playgroud)

它成功生成PDF图像.但它不能保持图像质量.即图像的高度和宽度变形并显示小图像.

任何人都可以帮我解决这些问题.我希望显示的图像在页面上应该是完整的大小.另请注意,横向或纵向图像应相应地适合页面.

php zend-framework magento zend-pdf

3
推荐指数
1
解决办法
4875
查看次数

SQL查询 - 从另一个表中获取名称

基本上我有2个表:uclk_useruclk_task

uclk_user表有user_id,name,postcode

uclk_task表有user_id,job_id,description,fully_completed,date_due

我想uclk_user在下面的任务查询中包含用户名...显然user_id是关键.

select job_id, user_id, fully_completed, description, date_due
from uclk_task
WHERE date_due <= NOW() AND fully_completed = 0
ORDER BY date_due ASC
Run Code Online (Sandbox Code Playgroud)

应该怎么做?

mysql

3
推荐指数
1
解决办法
3543
查看次数

包含/要求默默地发挥作用

在我的代码中,我有一个include语句,它从外部URL加载代码,如下所示:

include 'http://123.123.123.123:8080/servlet/statemodel'
Run Code Online (Sandbox Code Playgroud)

问题是,servlet需要大约35秒才能加载.

如果我http://123.123.123.123:8080/servlet/statemodel在浏览器中访问,一切正常(我修改了IP,因为它无法通过互联网访问).

但是,使用iclude语句会PHP尝试大约20秒来包含该文件,然后继续使用include语句之后的代码.

没有错误消息.使用require也不会带来任何错误消息.

包括超时吗?为什么没有错误信息?

也许tomcat实际上发送数据(http-header),但PHP只等待大约20秒才能跟随某些内容?

我可以选择更改此超时吗?

php tomcat http include

3
推荐指数
1
解决办法
961
查看次数

getElementsByClassName> get children

我有这个HTML代码:

<div id="channels_0">
   <div id="channels">
      <h4 class="date"><span id="date">Sat 22nd Sep</span> @ 
      <span id="time">12:45</span></h4>
      <h3 class="teems"><span id="date">Swansea City v Everton </span></h3>
      <h4 class="tv"><span id="mychannels"></span>Sky Sports 2/Sky Sports 2 HD</h4>
   </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我有这个JS:

document.getElementById('channels').innerText)
Run Code Online (Sandbox Code Playgroud)

哪个输出:

Sat 22nd Sep @ 12:45
Swansea City v Everton
Sky Sports 2/Sky Sports 2 HD
Run Code Online (Sandbox Code Playgroud)

我如何得到一个句柄并输出单个项目,如:mychannels,或teems或时间或日期,即我需要得到孩子,这是怎么做到的?

我试过了:

document.getElementById('channels').getElementsByTagName('date').value; 
Run Code Online (Sandbox Code Playgroud)

document.getElementsByClassName('date').value;
Run Code Online (Sandbox Code Playgroud)

和其他人一样,但似乎无法掌握它.

javascript dom getelementbyid

3
推荐指数
2
解决办法
2万
查看次数

获取经过身份验证的用户 onAuthenticationSuccess

我有以下身份验证处理程序:

class LoginAuthSuccessHandler implements AuthenticationSuccessHandlerInterface, AuthenticationFailureHandlerInterface
{
    private $router;
    private $container;

    /**
    * Constructor
    * @param RouterInterface   $router
    */
    public function __construct(RouterInterface $router, $container)
    {
        $this->router = $router;
        $this->container = $container;
    }

    public function onAuthenticationSuccess(Request $request, TokenInterface $token)
    {
        if ($request->isXmlHttpRequest()) {
            $user =  $this->container->get('security.context')->getToken()->getUser();
            $result = array('success' => true, 'user' => $user);
            return new Response(json_encode($result));
        } else {
            $route = $this->router->generate('ShopiousMainBundle_profile');

            $referrer_url = $request->server->get('HTTP_REFERER');
            if (strstr($referrer_url, '/items/')) {
                 $route = $referrer_url;
            }

            return new RedirectResponse($route);
        }
    }

    public function …
Run Code Online (Sandbox Code Playgroud)

php symfony php-5.3 fosuserbundle

3
推荐指数
2
解决办法
2965
查看次数

JQuery不适用于WordPress

我正在尝试在WordPress页面中使用JQuery,但它不起作用:

<script>
    $('a[href="http://domain1"]').attr("href","http://domain2");
</script>
Run Code Online (Sandbox Code Playgroud)

wordpress jquery

3
推荐指数
1
解决办法
225
查看次数

MySQL PDO最后插入了ID

我有一个关于MySQL的表与主键,我插入到该表,我想恢复已插入的最后一行的ID,我知道我必须使用LAST_INSERT_ID 但我的问题是在使用该语句后将值插入另一个表没有主键,我可以再次使用它来获取第一个插入的确切ID吗?

$ php pdo#

include_once 'type_model.php';
        $t = new Type_Model();
        $typeID = $t->getTypeID($type);
        include_once 'informationObject_model.php';
        $i = new InformationObject_Model();
        $answerIoID = $i->getIOID($ioAnswer);
        $query = "INSERT INTO question (info, text, answer, answerIoID, firstChoice, secondChoice, thirdChoice, 
            firstHint, secondHint, typeID) VALUES (:info, :text, :answer, :answerIoID,
            :firstChoice, :secondChoice, :thirdChoice, :firstHint, :secondHint, :typeID)";
        $sth = $this->db->prepare($query);
        $sth->execute(array(
            ':info' => $info,
            ':text' => $text,
            ':answer' => $answer,
            ':answerIoID' => $answerIoID,
            ':firstChoice' => $choices[0],
            ':secondChoice' => $choices[1],
            ':thirdChoice' => $choices[2],
            ':firstHint' => $hints[0],
            ':secondHint' => …
Run Code Online (Sandbox Code Playgroud)

mysql database pdo

2
推荐指数
1
解决办法
2万
查看次数