我正在使用Google Dashboard的表功能,我想将id的值赋给每个创建的行的tr,我有如下数组
var data = google.visualization.arrayToDataTable([
['Name', 'Donuts eaten','id'],
['Michael' , 5,'1'],
['Elisa', 7,'2'],
['Robert', 3,'3'],
['John', 2,'4'],
['Jessica', 6,'5'],
['Aaron', 1,'6'],
['Margareth', 8,'7']
]);
var table = new google.visualization.ChartWrapper({
'chartType': 'Table',
'containerId': 'chart2',
dataTable: data,
'options': {
'width': '500px'
}
});
table.draw();
Run Code Online (Sandbox Code Playgroud)
我仍然无法弄清楚是否有某种方法将值绑定到DOM元素,任何帮助将不胜感激.
我正在尝试运行一个程序,我收到此错误
Commands out of sync; you can't run this command now
Run Code Online (Sandbox Code Playgroud)
这是我得到的原始错误
命令不同步; 你现在不能运行这个命令
SELECT DISTINCT `property_id`, `pin`, `block_id`, `serial_no`, `status`, `ex_sn`, `ex_code`, `property_date_time`, `street_add`, `lab_name` FROM `view_property_user_lab` WHERE status = '6' AND lab_id = '01' AND designation IN( '5','6') LIMIT 10
Run Code Online (Sandbox Code Playgroud)
可以任何1告诉我为什么我得到这个错误以及如何摆脱它.我正在使用Code igniter,我也试过这个
$query->free_result().
Run Code Online (Sandbox Code Playgroud)
在我的程序中,我使用了这个陈述
SELECT *
FROM
temp_calculated_rates_and_rules;
-- and then
TRUNCATE temp_calculated_rates_and_rules;
Run Code Online (Sandbox Code Playgroud)
因为这个东西在PHP循环中被调用,就像这样
$arrIds = array('5','10');
foreach ($arrIds as $id)
{
$this->_StoredProcedureMapper->setPId($id);
$p10values = $this->_StoredProcedureMapper->fetch_p10_values();
if (intval(@$p10values[0]['is_exempted']) != 1)
{
$this->generate_p10($p10values);
}
}
Run Code Online (Sandbox Code Playgroud)
这是mapper函数
function fetch_p1_values()
{ …Run Code Online (Sandbox Code Playgroud) 以下是我的代码片段,我想要做的是将父表的ID插入子表,同时将数据插入子表.以下是我的代码片段
public function addAction()
{
$ViewModel = new ViewModel();
$form = new TestForm();
$form->get('submit')->setValue('Add');
$request = $this->getRequest();
if ($request->isPost())
{
$TestFilter = new TestFilter();
$test = $this->getServiceLocator()->get('Test');
$form->setInputFilter($TestFilter->getInputFilter());
$form->setData($request->getPost());
if ($form->isValid())
{
$test->populate($form->getData());
$this->getEntityManager()->persist($test);
$this->getEntityManager()->flush();
$TestDetail = $this->getServiceLocator()->get('TestDetail');
$TestDetail->populate($form->getData());
$TestDetail->setTest($test);
$this->getEntityManager()->persist($TestDetail);
$this->getEntityManager()->flush();
return $this->redirect()->toRoute('test');
}
}
return array('form' => $form);
}
Run Code Online (Sandbox Code Playgroud)
我的实体如下
<?php
namespace Test\Entity;
use Doctrine\ORM\Mapping as ORM;
use Zend\Form\Annotation;
use Test\Entity\Test;
/**
* An Test entity.
*
* @ORM\Entity
* @ORM\Table(name="testdetail")
*
* @property int $id
* @property …Run Code Online (Sandbox Code Playgroud) 您好以下是我的关系
用户模型
public function loginlogout()
{
$this->HasMany("App\Models\LoginLogoutLogs");
}
Run Code Online (Sandbox Code Playgroud)
这是我的LoginLogoutLogs模型
public function users()
{
return $this->belongsTo('App\Models\User');
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试从这样的用户访问名称
$loginLogoutLogs = LoginLogoutLogs::all();
foreach($loginLogoutLogs as $loginLogoutLog){
dd($loginLogoutLog->users()->name);
}
Run Code Online (Sandbox Code Playgroud)
但我收到此错误
未定义的属性:Illuminate \ Database \ Eloquent \ Relations \ BelongsTo :: $ name
编辑添加模型
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Zizaco\Entrust\Traits\EntrustUserTrait;
use Session;
use Illuminate\Support\Facades\DB;
class User extends Authenticatable
{
use Notifiable;
use EntrustUserTrait;
protected $table = 'tbl_users';
protected $primaryKey = 'id';
protected $guarded = ['id'];
const API = 'api'; …Run Code Online (Sandbox Code Playgroud) 我有简单的mysql查询
select count(total_profit)as profit from sales_profits
Run Code Online (Sandbox Code Playgroud)
我得到一些这样的结果profit=25000000000.我想要的是profit=25,000,000,000这样的,我们可以通过某种方式在MYSQL中做到这一点吗?
这是我的代码的代码片段,当我尝试这样查询它
if ($request->isPost()) {
$form->setData($request->getPost());
if ($form->isValid()) {
//check authentication...
$this->getAuthService()->getAdapter()
->setIdentity($request->getPost('username'))
->setCredential($request->getPost('password'));
$username = $request->getPost('username');
$password = $request->getPost('password');
$result = $this->getAuthService()->authenticate();
$criteria = array("user_name" => $username,);
$results= $this->getEntityManager()->getRepository('Subject\Entity\User')->findBy($criteria);
print_r($results);
exit;
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
无法识别的字段:user_name
这些是我的包括
使用Doctrine\ORM\EntityManager,Album\Entity\Album;
编辑:这是我的Subject\Entity\User文件
<?php
namespace Subject\Entity;
use Doctrine\ORM\Mapping as ORM;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;
/**
* @ORM\Entity
* @ORM\Table(name="users")
* @property string $username
* @property string $password
* @property int $id
*/
class User implements InputFilterAwareInterface {
protected $_username;
protected $_password; …Run Code Online (Sandbox Code Playgroud) Zend Framework 2中的子查询
我需要的查询:
SELECT `comment`.`id` AS `commentId`, `comment`.`comment` AS `comment`,
(SELECT COUNT(`comment_vote`.`id`) AS `negativeVote`
FROM `comment_vote`
WHERE vote = -1
AND `comment_vote`.`commentId` = `comment`.`id`) AS `nagetiveVoteCount`
FROM `comment`
Run Code Online (Sandbox Code Playgroud)
请帮忙.
谢谢,安吉斯
嗨,我需要一个正则表达式,实际上可以得到任何插入" - "破折号后插入的字母,例如我有一个字符串说
"UpTown-R" , "Category-C"
Run Code Online (Sandbox Code Playgroud)
我得到的回报是"R","C".
这是我的代码片段
jQuery('select[name="' + element + '"]').html('<option value="">Select</option>');
jQuery.each(data, function(key, value) {
jQuery('select[name="' + element + '"]')
.append(jQuery("<option></option>")
.attr("value", key)
.text(value));
});
Run Code Online (Sandbox Code Playgroud)
这是我从响应中得到的数组
{"1":"470 - MAJOR JOINT REPLACEMENT OR REATTACHMENT OF LOWER EXTREMITY W\/O MCC","2":"885 - PSYCHOSES","3":"897 - ALCOHOL\/DRUG ABUSE OR DEPENDENCE W\/O REHABILITATION THERAPY W\/O MCC","4":"885 - PSYCHOSES","5":"470 - MAJOR JOINT REPLACEMENT OR REATTACHMENT OF LOWER EXTREMITY W\/O MCC"}
Run Code Online (Sandbox Code Playgroud)
我收到此错误,我不知道为什么我收到此错误TypeError:无效'在'操作数obj
编辑:为了消除混乱,我发布了我发送请求的功能,如下所示:
function fetchValuesForDrgDefinition(url,drg) {
jQuery.ajax({
type: "json",
url: url,
}).success(function(data) {
appendOptionsInSelectBox(drg,data);
});
}
Run Code Online (Sandbox Code Playgroud) 我只是春天MVC的新手以下是我的代码,当我试图去bye我得到以下错误
Could not find @PathVariable [pathVars] in @RequestMapping Spring MVC
Run Code Online (Sandbox Code Playgroud)
以下是我的代码
package com.springapp.mvc;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import java.util.Map;
@Controller
public class HelloController {
@RequestMapping("/")
public String printWelcome(ModelMap model) {
model.addAttribute("message", "Hello world!");
return "hello";
}
@RequestMapping("/runThis/{bye}/{hye}")
public ModelAndView printBye(@PathVariable Map<String,String> pathVars) {
String Bye = pathVars.get("bye");
String Hye = pathVars.get("hye");
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("message", "you are"+Bye+ "AND Here COmes" +Hye+"!");
return modelAndView;
}
}
Run Code Online (Sandbox Code Playgroud)
编辑完整堆栈.
type Exception …Run Code Online (Sandbox Code Playgroud) 下面是随机字符串生成的代码,它正在工作但是这里有一些问题,我现在无法弄清楚这里发生的是它总是返回长度为1的值,我期待一个长度为10的随机字符串.我也传递10长度.请指导我在这里做错了什么.
<?php
function random_string($length) {
$len = $length;
$base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789";
$max = strlen($base) - 1;
$activatecode = '';
mt_srand((double) microtime() * 1000000);
while (strlen($activatecode) < $len + 1) {
$activatecode.=$base{mt_rand(0, $max)};
return $activatecode;
}
}
?>
Run Code Online (Sandbox Code Playgroud) 我在尝试ORDER BY使用Doctrine 2 ORM 在DQL的子句中实现动态排序时遇到错误.
这是我的代码片段:
$queryBuilder = $categoryEntity->createQueryBuilder('category');
$queryBuilder->distinct();
$queryBuilder->join('Category\Entity\CategoryName', 'category_name', 'WITH', 'category.id = category_name.category');
if($column == 'status'){
$queryBuilder->orderBy("category.status $order");
}else{
$queryBuilder->orderBy("category_name.name $order");
}
Run Code Online (Sandbox Code Playgroud)
这会产生以下错误:
[语法错误]第0行,第189列:错误:字符串的预期结束,得到'ASC'
每当我调用我的showresult();函数时,我都会使用它来删除div .我正在动态创建这个div <div class="sampageswrapper">,因此需要在showresult()调用时删除它.
function showresult(data) {
jQuery('.sampageswrapper div').remove();
// rest of my code.
}
Run Code Online (Sandbox Code Playgroud)
但不幸的是,这个div并没有消除.
<div class="sampageswrapper">
<div id="image_div" class="img_class" name="image_div">
..........
</div>
</div>
Run Code Online (Sandbox Code Playgroud) php ×7
javascript ×3
jquery ×3
doctrine-orm ×2
mysql ×2
belongs-to ×1
codeigniter ×1
doctrine ×1
has-many ×1
html ×1
java ×1
json ×1
laravel-5.4 ×1
random ×1
regex ×1
spring ×1
spring-mvc ×1