如何使用JQuery在图像旁显示数据库信息?(How to display database information next to an image with JQuery?)
嗨,大家好,我希望在库中的每个不同图像上显示来自数据库的任何类型的信息( 这看起来与RedBox非常相似),但我不知道如何去做,有没有人有任何解决方案这个?
PS:顺便说一句,我正在使用SQL Server 2008
这是我迄今为止...
的index.html
<!DOCTYPE html> <html> <head> <title>Tablero</title> <link rel="stylesheet" href="css/style.css"> <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> </head> <body> <section class="tagline"> <h1>Jueces</h1> </section> <div id="container"> <h1 id="heading"> Projects</h1> <ul id="gallery"></ul> </div> <script> $(document).ready(function() { setInterval(function() { $("#container").load('connection.php'); }, 1000); }); </script> </body> </html>
Connection.php
<?php $server = "localhost"; $user = "perron"; $password = "hasg"; $database = "ejemplo"; $conn = odbc_connect("Driver={SQL Server Native Client 10.0}; Server=$server; Database=$database;", $user, $password); $sql = "SELECT * FROM Prueba"; $rs = odbc_exec($conn, $sql); if (!$rs) { exit("Error en la consulta SQL"); } ?> <div class="container"> <div id="container"> <h1 id="heading"> Projects</h1> <ul id="gallery"> <?php do{ ?> <?php $resultado_img = odbc_result($rs, "img"); $resultado_id = odbc_result($rs, "id"); $resultado_nombre = odbc_result($rs, "nombre"); $resultado_fecha = odbc_result($rs, "fecha_aud"); $resultado_hora = odbc_result($rs, "hora_aud"); $resultado_juzgado = odbc_result($rs, "juzgado"); ?> <?php echo '<li><img src="img/' . $resultado_img . "\" alt=\"\" height=\"200\" width=\"200\" /></li>"; ?> <?php } while ( odbc_fetch_row($rs) ) ?> </ul> </div> </div>
style.css文件
body { margin: 0; padding: 0; font-family: "Arial", sans-serif; font-size: 15px; color: #666; text-decoration: none; line-height: 1.6em; } a { color: #666; text-decoration: none; } .container { width: 80%; margin: auto; overflow: auto; } .logo { float: left; width: 30%; margin-top: 15px; } section { padding: 20px 0; overflow: hidden; } .tagline { background: #03899c; color: #fff; } .tagline h1 { text-align: center; font-size: 35px; } #gallery { list-style: none; margin: 0; padding: 0; width: 100%; } #gallery li { display: block; float: left; width: 23%; cursor: pointer; border-radius: 5px; box-sizing: border-box; margin: 0 12px 7px 0; } #gallery img { width: 100%; border-radius: 5px; }
Hi everybody I want to display any kind of information from the database on every different image in the gallery (This is how it looks) pretty similar to RedBox but I don't have any idea how to do it, does anybody have any solution for this?
P.S: btw I'm using sql server 2008
This is what I have so far...
Index.html
<!DOCTYPE html> <html> <head> <title>Tablero</title> <link rel="stylesheet" href="css/style.css"> <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> </head> <body> <section class="tagline"> <h1>Jueces</h1> </section> <div id="container"> <h1 id="heading"> Projects</h1> <ul id="gallery"></ul> </div> <script> $(document).ready(function() { setInterval(function() { $("#container").load('connection.php'); }, 1000); }); </script> </body> </html>
Connection.php
<?php $server = "localhost"; $user = "perron"; $password = "hasg"; $database = "ejemplo"; $conn = odbc_connect("Driver={SQL Server Native Client 10.0}; Server=$server; Database=$database;", $user, $password); $sql = "SELECT * FROM Prueba"; $rs = odbc_exec($conn, $sql); if (!$rs) { exit("Error en la consulta SQL"); } ?> <div class="container"> <div id="container"> <h1 id="heading"> Projects</h1> <ul id="gallery"> <?php do{ ?> <?php $resultado_img = odbc_result($rs, "img"); $resultado_id = odbc_result($rs, "id"); $resultado_nombre = odbc_result($rs, "nombre"); $resultado_fecha = odbc_result($rs, "fecha_aud"); $resultado_hora = odbc_result($rs, "hora_aud"); $resultado_juzgado = odbc_result($rs, "juzgado"); ?> <?php echo '<li><img src="img/' . $resultado_img . "\" alt=\"\" height=\"200\" width=\"200\" /></li>"; ?> <?php } while ( odbc_fetch_row($rs) ) ?> </ul> </div> </div>
Style.css
body { margin: 0; padding: 0; font-family: "Arial", sans-serif; font-size: 15px; color: #666; text-decoration: none; line-height: 1.6em; } a { color: #666; text-decoration: none; } .container { width: 80%; margin: auto; overflow: auto; } .logo { float: left; width: 30%; margin-top: 15px; } section { padding: 20px 0; overflow: hidden; } .tagline { background: #03899c; color: #fff; } .tagline h1 { text-align: center; font-size: 35px; } #gallery { list-style: none; margin: 0; padding: 0; width: 100%; } #gallery li { display: block; float: left; width: 23%; cursor: pointer; border-radius: 5px; box-sizing: border-box; margin: 0 12px 7px 0; } #gallery img { width: 100%; border-radius: 5px; }
原文:https://stackoverflow.com/questions/37780625
最满意答案
这将有助于表明你已经做了一些功课......
library(sos) findFn("perceptron") RSiteSearch("perceptron") ## after running this, click on some buttons on the web page to expand the search
在http://rseek.org上搜索“perceptron”
也搜索
[r] perceptron
StackOverflow,虽然这并没有太多; 你也可以尝试[r] neural net
...It would help to show that you've done some homework ...
library(sos) findFn("perceptron") RSiteSearch("perceptron") ## after running this, click on some buttons on the web page to expand the search
Search "perceptron" at http://rseek.org
Also search StackOverflow for
[r] perceptron
, although that doesn't get much; you might try[r] neural net
too ...
相关问答
更多-
感知器分类和R(perceptron classification and R)[2022-04-06]
这将有助于表明你已经做了一些功课...... library(sos) findFn("perceptron") RSiteSearch("perceptron") ## after running this, click on some buttons on the web page to expand the search 在http://rseek.org上搜索“perceptron” 也搜索[r] perceptron StackOverflow,虽然这并没有太多; 你也可以尝试[r] neur ... -
R中的SVM分类图(SVM Classification Plot in R)[2022-03-09]
只需将用于训练模型的内核从(可能当前使用的)rbf更改为linear 。 根据所使用的库,这个参数可能以不同的方式传递,但最终这是你所需要的。 Simply change the kernel used to train your model from (probably currently used) rbf to linear. Depending on the library used this parameter might be passed in a different way, but ult ... -
您可以在sapply使用scale函数: scaleddf <- as.data.frame(sapply(train, function(i) if(is.numeric(i)) scale(i) else i)) 如果您的数据包含具有NaN值或0方差的变量,则可以在使用上述函数之前首先处理原始数据集并对其进行子集化。 # get a vector of variables to drop dropVars <- sapply(train, function(i) { if( ...
-
感知器故障(Malfunctioning perceptron)[2022-03-13]
将学习率更改为0.075修复了该问题。 Changing the learning rate to 0.075 fixed the issue. -
我成功地解决了这个问题。 首先,我有不正确的点群中心,因此这些点在2D空间中变得完全不可分割。 中学,我不得不重写训练过程,从集合中挑选随机点。 第三个,我发现将int转换为int并不是最好的想法(数据丢失率非常高)。 链接到最终版本的代码: CLICK I successfully resolved the problem. First of all, I had incorrect centers of groups of points, so this points became completely ...
-
按ID分类(Classification in R by ID)[2023-06-02]
经过大量的研究,我想我已经找到了我需要的东西。 我已经使用reshape包来建模我的data.frame并将一些变量转换为行。 如果有人需要它,这些是我遵循的材料: http://had.co.nz/reshape/introduction.pdf https://www.r-statistics.com/2012/01/aggregation-and-restructuring-data-from-r-in-action/ 在学习了这些材料和一些googleing之后,我想出了以下代码: library( ... -
如果我错了,我相信有人会纠正我,但我不相信在Sklearn中实现了Averaged Perceptron。 如果我没记错的话,sklearn中的Perceptron只是具有某些默认参数的SGD。 话虽如此,你有没有尝试过旧的逻辑回归? 虽然它可能不是最性感的算法,但它通常确实提供了良好的结果,并且可以作为基线来查看是否需要探索更复杂的方法。 I'm sure someone will correct me if I'm wrong but I do not believe Averaged Perceptr ...
-
通过计算学习模型取决于特征f的程度来捕获特征的重要性。 感知器是简单的前馈神经网络,并且对于神经网络(其是实值非线性函数),依赖性对应于输出函数相对于f的偏导数。 特征的相对重要性与其在训练的感知器上的平均绝对权重成比例。 对于神经网络而言,这并非总是如此。 例如,对于多层感知器而言,这不一定适用。 有关更多详细信息(在此处键入确切的公式将是一个符号混乱),请查看本文的第2和第3部分 。 我相信等式(8)(第3节)是你正在寻找的。 在那里,分数是多个学习者的总和。 如果您的是单层感知器,则学习的函数是单个权 ...
-
使用感知器进行分类(Use of perceptron for classification)[2023-06-15]
Perceptron算法的多类别变体中的想法与二元分类中的想法基本相同,只是存在一些细微差别。 在具有K类的多类分类中,我们将维护一组K个加权向量W_{1},...,W_{K} (每个加权向量的大小为D,其中D是特征的数量)。 预测(在训练和测试时间)将变为: \widehat{y}_{n} = arg max_{k}(W_{k}^{T} x_{n} + b) 这意味着预测的类将是权重向量给出最高分的那个类。 更新条件由(假设yn是xn的真实标签)给出: if(\widehat{y}_{n} != y_{ ... -
从帮助页面( ?tree ) 当生成分类树时,左侧(响应)应该是当拟合回归树时的数字向量或者是因子。 From the help page (?tree) The left-hand-side (response) should be either a numerical vector when a regression tree will be fitted or a factor, when a classification tree is produced.