嗨我有一个70/80字段表单,我需要插入到表中,所以而不是手动创建一个巨大的插入语句我首先在我的数据库中创建一个表从表单中的输入的名称这里是我的代码用于创建/更改表
function createTable($array, $memberMysqli)
{
foreach ($array as $key => $value)
{
//echo "<p>Key: ".$key." => Value: ".$value . "</p>";
$query = "ALTER TABLE questionnaire ADD ".$key." text";
if($stmt = $memberMysqli->prepare($query))
{
$success = $stmt->execute();
}
}
echo "<h1>Array count: ". count($array) ."</h1>" ;
}
Run Code Online (Sandbox Code Playgroud)
这工作正常,并改变了我想要的表格.现在要插入表单值来执行此操作,我执行基本的一个字段插入存储行的id,然后循环所有更新该行的post变量.这是我的代码:
$stmt = $memberMysqli->prepare("INSERT INTO questionnaire(userid) VALUES (?)");
$stmt->bind_param('s', $_POST['userid']);
$stmt->execute();
$rowid = $stmt->insert_id;
$stmt->close();
$memberMysqli->autocommit(FALSE);
function updateColumn($memberMysqli, $query, $uid, $value)
{
if ($value)
{
$stmt = $memberMysqli->prepare($query);
//Throws bind param error here
$stmt->bind_param("ss", $value, …
Run Code Online (Sandbox Code Playgroud) 我正在搜索一个位置的纬度和经度的数据库.我想检索某个半径内的所有位置.
然后我将返回的结果编码为JSON并使用ajax检索数据,但是我得到一个未定义的错误,意味着没有从数据库返回的数据.
谁能看到我出错的地方?
继承人我的疑问
$sql="SELECT *, ACOS( SIN( RADIANS( `lat` ) ) * SIN( RADIANS( $fLat ) ) + COS( RADIANS( `lat` ) )
* COS( RADIANS( $fLat )) * COS( RADIANS( `lng` ) - RADIANS( $fLon )) ) * 6380 AS `distance`
FROM `markers`
WHERE ACOS( SIN( RADIANS( `lat` ) ) * SIN( RADIANS( $fLat ) ) + COS( RADIANS( `lat` ) )
* COS( RADIANS( $fLat )) * COS( RADIANS( `lng` ) - RADIANS( $fLon )) ) * …
Run Code Online (Sandbox Code Playgroud) 我正在尝试开发一个小型站点,该站点通过设置半径从数据库中检索结果并将它们放置在地图上.我使用Google maps api从那里获得lat和long搜索条件,将这些传递给我的php脚本,该脚本查询数据库并将结果集作为JSON对象返回.
我有一个小问题,使用json将lat和long发送到php.
我的主要问题是我的sql搜索数据库似乎是错误的,因为它只检索我的数据库中的前10个结果.我希望它返回搜索点半径范围内的前10个结果.
这是我的ajax代码
function showCarPark(location)
{
var lat = location.lat();
var lng = location.lng();
//alert("Lat: " +lat.toFixed(6));
//alert("Lng: " +lng.toFixed(6));
document.getElementById('carParkResults').innerHTML = "";
var criterion = document.getElementById("address").value;
var count = 0;
$.ajax({
url: 'process.php',
type: 'GET',
data: "lat=" + lat + "&lng=" + lng,
dataType: 'json',
success: function(data)
{
jQuery.each(data, function()
{
$('<p>').text("Car Park: " + data[count].name).appendTo('#carParkResults');
placeCarParks(data[count].postcode,data[count].name, data[count].street, data[count].type);
count++;
});
},
error: function(e)
{
//called when there is an error
console.log(e.message);
alert("error" + e.message);
} …
Run Code Online (Sandbox Code Playgroud) 我需要编写一个函数,它将在我的HTML页面中搜索特定字符串的所有内容,如果找到它,则更改文本的颜色.
这可能吗?
谢谢
我只需要知道如何从经度和纬度获取邮政编码。
我使用谷歌地图 api 根据诸如“曼彻斯特”之类的搜索来获取经纬度,然后我需要从中获取邮政编码以查询我的数据库。
到目前为止我的代码是
function getLatLng()
{
var localSearch = new google.maps.Geocoder();
var postcode = $("#address").val();
localSearch.geocode({ 'address': postcode },
function(results, status) {
if (results.length == 1) {
var result = results[0];
var location = result.geometry.location;
}
else
{
$("#error").html("Address not found");
}
});
}
Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用kendo ui,我正在运行一个非常基本的例子.
它目前显示为ios但我想一直将它设置为平面ui主题.我无法在演示或文档中看到任何说明如何执行此操作的内容.
有人可以告诉我如何将默认主题更改为平面设计吗?
<!doctype html>
<html>
<head>
<!-- Kendo UI Mobile CSS -->
<link href="styles/kendo.mobile.all.min.css" rel="stylesheet" />
<!-- jQuery JavaScript -->
<script src="js/jquery.min.js"></script>
<!-- Kendo UI Mobile combined JavaScript -->
<script src="js/kendo.mobile.min.js"></script>
<title>Kendo UI Examples</title>
</head>
<body>
<!-- Kendo Mobile View -->
<div data-role="view" data-title="test" id="index">
<!--Kendo Mobile Header -->
<header data-role="header">
<!--Kendo Mobile NavBar widget -->
<div data-role="navbar">
<span data-role="view-title"></span>
</div>
</header>
<!--Kendo Mobile ListView widget -->
<ul data-role="listview">
<li>Item 1</li>
<li>Item 2</li>
</ul>
<!--Kendo Mobile Footer --> …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用javascript和URL请求从JSON对象检索和显示有关当前天气的信息:
http://free.worldweatheronline.com/feed/weather.ashx?q=de39ga&format=json&num_of_days=2&key=ec9c2dc5ba201904120805'
Run Code Online (Sandbox Code Playgroud)
来自URL的数据如下所示:
{
"data": {
"current_condition": [
{
"cloudcover": "75",
"humidity": "88",
"observation_time": "03:30 PM",
"precipMM": "2.7",
"pressure": "1008",
"temp_C": "12",
"temp_F": "54",
"visibility": "8",
"weatherCode": "302",
"weatherDesc": [
{
"value": "Moderate rain"
}
],
"weatherIconUrl": [
{
"value": "http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0018_cloudy_with_heavy_rain.png"
}
],
"winddir16Point": "SE",
"winddirDegree": "140",
"windspeedKmph": "17",
"windspeedMiles": "11"
}
],
"request": [
{
"query": "DE3",
"type": "Postcode"
}
],
"weather": [
{
"date": "2012-05-09",
"precipMM": "11.8",
"tempMaxC": "13",
"tempMaxF": "56",
"tempMinC": "12",
"tempMinF": "53",
"weatherCode": "266",
"weatherDesc": …
Run Code Online (Sandbox Code Playgroud) 我试图在magento 1.9上安装一个主题.已将所有文件复制到正确的位置.
在系统 - >配置 - >设计 - >主题下我已经设置了主题名称的模板,外观,布局和默认值.
我认为我遇到的问题是'当前包名'它最初设置为'rwd',当它设置为this时,它加载默认的1.9 magento主题.但是,当我将其更改为"默认"时,它会加载magento基本主题.如果我将包名称设置为主题名称,它也会加载基本包.
皮肤目录结构
设计目录结构
jquery ×4
ajax ×3
javascript ×3
php ×3
google-maps ×2
json ×2
css ×1
css3 ×1
e-commerce ×1
html ×1
html5 ×1
kendo-mobile ×1
kendo-ui ×1
magento ×1
mysql ×1
mysqli ×1
sql ×1
themes ×1