我对Android世界很新,来自大量服务器端编程的背景.非常小的Java.
我正在开发一个应用程序,其中我需要有两个片段,一个在左边显示导航,一个在右边,显示内容.我的第一个主要挑战是使用acharengine使其中一个导航链接打开一个图表.
我有一个来自achartengine的例子,我一直关注这里:achartengine的例子
我一直在关注谷歌提供的Android开发者应用程序演示:Fragment Basics
我正在使用该示例,只是使用现有代码构建所有内容.到目前为止,我已将实际内容显示范围缩小到ArticleFragment.java中的此代码:
这是onStart上发生的事情:
public void onStart() {
super.onStart();
// During startup, check if there are arguments passed to the fragment.
// onStart is a good place to do this because the layout has already been
// applied to the fragment at this point so we can safely call the method
// below that sets the article text.
Bundle args = getArguments();
if (args != null) {
// Set article based on argument passed in …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个页面,当用户在我的页面上时显示用户的邮政编码.
(如果你们中的任何人熟悉GeoIP数据,那就是我正在使用的.)
我有一个将用户IP地址转换为IP号的转换,转换为:
ipnum = 16777216*w + 65536*x + 256*y + z
其中wxyz是ip部分(000.000.000.000)
我的问题是,使用
$_SERVER['REMOTE_ADDR'];
Run Code Online (Sandbox Code Playgroud)
有没有办法让我划分用户的IP地址,并将IP地址的部分分配给变量?
例如:
usersip = 192.168.123.5
w = 192; x = 168; y = 123; z = 5;
谢谢!
我正在尝试在我的sql表中插入一个值,其中包含html:如下所示
<?
$story ="<div class='post'><p class='date'>$mont<b>$day</b></p><h2 class='title'>lkjljt</h2><p class='meta'><small>Posted $name | $school, $date | Rating</small></p><div class='entry'>$message</div></div>";
$db = mysql_connect("host", "user", "password");
mysql_select_db("db", $db);
if (!$db)
{
die('Could not connect: ' . mysql_error());
}
$sql = "INSERT INTO Post VALUES ('', '$date', '$time', '$story', '$school','$location', '$sex', '$zipcode', '$name');";
$result = mysql_query($sql);
if($result)
{ $success = " Your hookup has been submitted ";}
else{
$error = "something went horribly wrong" . mysql_error();}
?>
Run Code Online (Sandbox Code Playgroud)
当我提交此页面时,我不断收到语法错误,如果我评论$ story,则查询运行正常.我怎样才能解决这个问题?