如何从表中获取auto_increment列名(不是最后一个插入ID)?
例如:
create table members (member_id int auto_increment, name char(50), primary key(member_id));
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能member_id
从表中获取成员.
我正在制作一个php类,我将添加一个允许你这样做的方法:
$members->findById(123);
Run Code Online (Sandbox Code Playgroud)
它应该知道找到自动增量列并基于该查询构建查询然后执行查询.
我试图没有提交按钮,当用户选择值时表单是否有任何提交方式?
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" >
<table class="form">
<select name="category" class="formfield" id="category">
<option value="-1"> Category </option>
<?php
$sql_contry = "SELECT * FROM category";
$rs_c = mysql_query($sql_contry);
while ($row_c = mysql_fetch_array($rs_c)) {
echo '<option value="'.$row_c['category'].'">'.$row_c['category'].'</option>';
}
?>
</select>
</table>
</form>
Run Code Online (Sandbox Code Playgroud) 我正在统一创建一个自定义窗口编辑器,当我单击菜单项时,我无法并排加载多个选项卡。
这是我到目前为止得到的:
这是我希望它在加载时的外观:
这是我为获得第一张图像的效果所做的工作。我需要添加/更改什么才能获得第二张图像的效果?
[MenuItem ("GameObject/My Editor")]
public static void ShowWindow() {
EditorWindow hierarchyWindow = GetWindow<QEHierarchy>("Hierarchy");
EditorWindow eventsWindow = GetWindow<QEEvents>("Events", typeof(QEHierarchy));
hierarchyWindow.Show();
}
Run Code Online (Sandbox Code Playgroud) 我有一个看起来像的函数:
module.exports = myFunction() {
//do some stuff
}
Run Code Online (Sandbox Code Playgroud)
我可以使用其他文件很好地访问它 var myFunction = require(.thepath.js)
但是,我如何从它创建的文件中访问它。
我试过了myFunction()
,this.myFunction()
但都不起作用。
谢谢
我有一个 gulpfile,它连接我的依赖项以创建一个文件。
最终的输出文件中包含 CryptoJS。如果我使用整个库:
node_modules/crypto-js/crypto-js.js
我能够加密数据:
async function save(data) {
let saveData = CryptoJS.AES.encrypt(data, 'My Secret').toString();
}
Run Code Online (Sandbox Code Playgroud)
如果我只使用我需要的库的一部分AES
,我会收到以下错误:
未捕获(承诺中)类型错误:无法读取未定义的属性“创建”
我要连接的文件按以下顺序排列:
let fileList = [
'node_modules/crypto-js/core.js',
'node_modules/crypto-js/cipher-core.js',
'node_modules/crypto-js/enc-utf8.js',
'node_modules/crypto-js/aes.js',
]
Run Code Online (Sandbox Code Playgroud)
我缺少文件吗?
编辑
错误堆栈:
Uncaught (in promise) TypeError: Cannot read property 'create' of undefined
at Object.execute (gamesmart.js:2067)
at Object.encrypt (gamesmart.js:2114)
at Object.encrypt (gamesmart.js:1493)
at Object.<anonymous> (gamesmart.js:42)
at Generator.next (<anonymous>)
at gamesmart.js:7
at new Promise (<anonymous>)
at __awaiter (gamesmart.js:3)
at Object.save (gamesmart.js:41)
at HTMLDocument.document.addEventListener (ajax.js:3)
execute @ gamesmart.js:2067
encrypt @ gamesmart.js:2114 …
Run Code Online (Sandbox Code Playgroud) 我试图选择当前元素的同级元素,但是当我a.querySelector(':scope')
在该元素上使用时,它为空。当我尝试向它添加同级选择器时,:scope
它仍然为空,但如果我在其中使用它,.matches(':scope')
它会返回 true。如何使用选择器中的当前元素?
let a = document.querySelector('div > a')
console.log(a.querySelector(':scope'))
console.log(a.querySelector(':scope + span'))
console.log(a.matches(':scope'))
Run Code Online (Sandbox Code Playgroud)
<div>
<a href=""></a>
<span></span>
</div>
Run Code Online (Sandbox Code Playgroud)
我有以下代码将画布上的内容保存到文件中,但是保存时它会保存为download
文件名。我可以做什么来使用自定义文件名而不是download
?
// Get the Canvas
var ctx = document.getElementById("myChart").getContext("2d");
// Handle Saving the Canvas
$(document).on("click", "#save-graph", function(e){
e.preventDefault();
var image = ctx.canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
window.location.href = image;
});
Run Code Online (Sandbox Code Playgroud) 我在创建ImageData时遇到问题.我收到以下错误消息:
未捕获的IndexSizeError:无法构造"ImageData":输入数据字节长度不是(4*宽度)的倍数.
这是我正在运行的方法:
public setPixelData(data: Buffer, width: number, height: number) {
var imageData = new ImageData(new Uint8ClampedArray(data), width, height);
this.canvas.getContext('2d').putImageData(imageData, 0, 0);
}
Run Code Online (Sandbox Code Playgroud)
我已经转储了数据,这就是显示的内容:
data = Uint8Array[632028]
width = 720
height = 720
Run Code Online (Sandbox Code Playgroud)
那么,这个错误的原因是什么,以及如何解决?
我有 3 个文件,它们看起来像这样:
工具/索引.ts
export * from './Vector2'
export * from './Sprite'
export * from './GameObject'
export * from './Component'
Run Code Online (Sandbox Code Playgroud)
util/Component.ts
export interface ComponentType<T extends Component> {
new(gameObject: GameObject): T;
}
export class Component { }
Run Code Online (Sandbox Code Playgroud)
组件/刚体.ts
import { Component } from '../util'
export class Rigidbody extends Component { }
Run Code Online (Sandbox Code Playgroud)
在编辑器中一切正常,当代码编译成 javascript 时。但是,当我在浏览器中运行代码时,出现错误:
未捕获的类型错误:类扩展值未定义不是构造函数或 null
这是指 export class Rigidbody extends Component
如果我将导入更改为导入Component
文件而不是index
文件,则它可以工作:
import { Component } from '../util/Component'
Run Code Online (Sandbox Code Playgroud)
我也有一个Transform
导入Component
文件的文件,它做同样的事情。
是我做错了什么还是我用 webpack 构建它的方式? …
我正在尝试在我的项目中升级 Angular (v15) 和 nx (v16),但我遇到的问题是当我启动项目时 NX 抛出错误:
> NX angular.json format is incorrect
Nx no longer supports the v2 format of angular.json.
Run "nx g @nx/workspace:fix-configuration" to split angular.json into individual project.json files. (Recommended)
If you want to preserve angular.json, run "nx g @nx/workspace:fix-configuration --reformat"
Run Code Online (Sandbox Code Playgroud)
这让我感到困惑,因为我的项目已经分成project.json
文件。我确实尝试运行两个建议的命令,它成功了,但没有文件被更新......
这是我的angular.json
文件,看起来格式正确:
{
"$schema": "./node_modules/nx/schemas/workspace-schema.json",
"version": 2,
"projects": {
"xxx": "libs/xxx",
"xxx-e2e": "apps/xxx-e2e",
"yyy": "libs/yyy",
"yyy-e2e": "apps/yyy-e2e"
}
}
Run Code Online (Sandbox Code Playgroud)
然后,我得到project.json
每个项目的位置如下(xxx
项目在哪里,有些包含-e2e
,有些则不取决于项目是 e2e 应用程序还是库):
{
"$schema": …
Run Code Online (Sandbox Code Playgroud)