如何将从数据库中获取到的checkbox的值再存储到数据库?

1.图片说明如图,大类信息是从数据库中读取出来的,通过 var set = db.ProClasses;
ViewBag.aa = set;读取显示到页面上
2.现在要勾选checkbox,获取选中的复选框的值,传入控制器,再存储到数据库应该如何实现?
3.之前做过类似的,但是有不一样的地方。之前的checkbox的值是固定的 设置ID 通过
var obox = document.getElementById("box1");
var cboList = obox.getElementsByTagName("input");
var oText = document.getElementById("isb");
//点击复选框 获取复选框的值
document.getElementById("xiaoshou1").onclick = function (e) {
var src = e ? e.target : event.srcElement;
if (src.tagName == "INPUT") {
var values = [];
for (var i = 0; i < cboList.length; i++) {
if (cboList[i].checked) {
values.push(cboList[i].value);
}
}
oText.value = values.join(",");
}
};
的方式获取到复选框的值,再通过表单提交。
我的问题是要实现相同的功能应该如何实现?求大神指点一二,小生在此谢过!

3个回答

没有固定的ID啊

从数据库读取,再设置下界面的选择

用document.getbydocumentid啊

c_Jeak123
c_Jeak123 不知道怎么设ID 数据是从数据库中获取的
接近 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
jsp页面提交后如何将信息传到另一个jsp页面并将数据存储到数据库

这是第一个页面,由一个下拉列表和一个复选框组成 ``` <form action="ProcessAis.jsp" method="post" onsubmit="return check(this);"> <table align="center" width="450"> <tr> <td> <h2>船舶检测项</h2> </td> </tr> <tr> <td><b>船舶名称</b></td> </tr> <tr> <td> <select name="dId" id="dId" class="selectpicker bla bla bli" data-live-search="true" size="1"> <% List<detection> list = (List<detection>)request.getAttribute("list"); if(list ==null || list.size() < 1){ out.print("没有数据!"); }else{ for(detection dct :list){ %> <option><%=dct.getFI_FisherName()%></option> <% } } %> </select> <tr> <td><input name="AIS" type="checkbox" id="checkid" onchange="changeval()">AIS</td> <tr> <tr> <td><input type="submit" value="提 交"></td> </tr> ``` 这是接收页面 ``` processAis.jsp <script type="text/javascript"> function changevla(){ var check = document.getElementById("checkid"); if(check.checkid == true){ document.getElementById("checkid").value = "1"; }else{ document.getElementById("checkid").value = "2"; } } </script> <% try{ Class.forName("**************"); String url = "*****************"; String username = "******"; String password = "*********"; Connection conn = DriverManager.getConnection(url,username,password); String sql = "insert into newship(FI_FisherName,AIS) values(?,?)"; PreparedStatement ps = conn.prepareStatement(sql); ps.setString(1,dct.getFI_FisherName()); ps.setString(2,document.getElementById("checkid").value); int row = ps.executeUpdate(); if(row >0){ out.print("数据添加成功"); } ps.close(); conn.close(); }catch(Exception e){ out.print("数据添加失败!"); e.printStackTrace(); } %> ``` 下来列表的值是从数据库里读取出来的,目的是将下拉列表的值和复选框的选定情况(选定返回一个值为“1,未选定返回一个值为“2)一起提交到第二个页面,然后再将返回的值存储到数据库中。现在的问题是感觉第一个页面的数据无法传到第二个页面,第二个页面传到数据库里的是空数据。想请问应该如何修改才能达到目的,最好是有详细代码说明,万分感谢。

在数据库中存储多个复选框值并在以后使用它的最佳方法是什么

<div class="post-text" itemprop="text"> <p>I am working on a website and i want to add a new section to it that will contain an advanced form for storing that data. There will be about 20-30 fields and few of them will be represented by multiple choice checkboxes eq array values on submit from these choices. This fields will have a fixed amount of choices that will never change and never added new ones into it. For example field one will have choice1, choice2, choice3. Field two will have 10 of them and field 3 will have 5.</p> <p>Isnt a creating separate database tables for them and referencing them by its id a bit overkill? Would not it be better to save them as for example comma separated values under varchar field eq implode and eplode them every time i want to acces or store new one?</p> <p>Also i have a bit trouble figuring out how to work with it later on. Since if i save them as as separate table and reference it by its id than my query will output every combiation of these fields. Which would result in for example 150 rows for one record. How can i convert it back to the single array value with nested array for this sub multiple values? for example <code>'id'=&gt;1, 'title' =&gt; 'Lorem Ipsum', 'choices' =&gt; array('choice2','choice2').....</code></p> <hr> <p>update: To better illustrate what i want to do i have created a simplified mockup of the form here -&gt; <strong><em><a href="http://www.anony.ws/i/2013/08/13/SsD5A.gif" rel="nofollow">http://www.anony.ws/i/2013/08/13/SsD5A.gif</a></em></strong> Its not actual form i will be using since i did not build it yet but it is close enough. You can ignore other fields i already know how i will save or work with them later on.</p> <p>What i do need some help with is that checkbox groups. I need to store selected values and later on i will need to work with them. I will need to be able to search through them i will need to be able to display that data. I will also need to be able to create some comment system (i have already done that before so basically i just need to be able to reference data from this form by its database ID. Probably some updating and or other basic stuff.</p> <p>Major thing is saving this choices and searching/displaying its data. Would be really geat if i can get the data from the databse in 1 array/obect with some nested arrays for this multiple choices. Something like i have sketched in the end of this post before the update. </p> </div>

怎样将数据库中的内容插入到复选框中

比如说我在list页面上有添加与查询2个按钮,我在添加页面中设置了一个复选框,然后选了1,3,4,5,6;再打开查询页面,查询页面上的复选框1,3,4,5,6就被选中了,这样代码应该怎么写

checkbox回显,显示在页面上。

问题1: ![图片说明](https://img-ask.csdn.net/upload/201602/25/1456371700_618157.png) 这是一个多选框,我选择上图多选框的值以后,进行保存,存到数据库。数据库中格式如下图。这些字段中间用逗号隔开了, ![图片说明](https://img-ask.csdn.net/upload/201602/25/1456371726_416120.png) ![图片说明](https://img-ask.csdn.net/upload/201602/25/1456371745_661418.png) 上图最后面有一个修改操作,点击修改,进入下面页面,其他值都能显示,可是多选的显示不了。 ![图片说明](https://img-ask.csdn.net/upload/201602/25/1456371760_959306.png) 修改页面 问题:如何让修改页面上的多选框被选中。

复选框在数据库中怎么保存

现在有爱好四个复选框 读书,唱歌,游泳,绘画,要把这些存到数据库中,数据库中用四个字段保存,每个0或者1,还是拼接成1,2,3,4的形式保存在一个字段中

将pdf文件存储在sql数据库中,并根据用户请求合并它们

<div class="post-text" itemprop="text"> <p>I am currently working with a new website for my company and there is some functionality that I have some issue fixing. We want a page where you will find a list of filenames (like different types of manuals etc.) and basically a checkbox where you decide what files you want to merge together to one new pdf. </p> <p>So, I am a web designer, not great at developing but I can not find any guidelines or help to achieve this.</p> <p>How do I link my pdf's to the database and how do I create a new pdf (like in acrobat) from the ones I already have? If someone have any good edwice, I would be really glad.</p> </div>

Laravel - 在数据库中存储多个复选框表单值

<div class="post-text" itemprop="text"> <p>So I've got this code</p> <p><strong>View:</strong> </p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="checkboxes"&gt; &lt;input type="checkbox" class="checkbox" name="services" value="{{ $service-&gt;id }}" id="{{ $service-&gt;id }}" /&gt; &lt;label class="whatever" for="{{ $service-&gt;id }}"&gt;&lt;p class="serv-text"&gt; {{ $service-&gt;service_name }} + ${{ $service-&gt;price }} &lt;/p&gt;&lt;/label&gt; &lt;/div&gt;</code></pre> </div> </div> <p><strong>Controller:</strong></p> <p></p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code> public function store(Request $request) { orders::create(Request::all()); return 'test'; }</code></pre> </div> </div> <p><strong>Model:</strong></p> <p></p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>class orders extends Model { protected $fillable = [ 'category', 'services', 'total_price', 'user_id', 'status', 'user_id']; }</code></pre> </div> </div> <p>When I try to submit the form, in the database at services there is only one number even if I checked multiple boxes when I submitted the form. I've tried to find on google a solution but nothing.</p> </div>

PHP:如何获取数组复选框值,然后将每个单独的结果插入数据库查询?

<div class="post-text" itemprop="text"> <p>I have a form that has a checkbox list generated dynamically: <code>name="cursoID[]"</code> Each value correspond to cursoID (<code>$curso['cursoID']</code>), which is a value taken from a mySQL <code>SELECT</code> query that shows me a list of items IDs.</p> <p><strong>The user may select N number of items, and I need to take each one of those (ie. <code>$cursoID = $_POST['cursoID'];</code>) in order to save them into an <code>INSERT</code> query.</strong></p> <p>In the form, I generate each item with a while loop:</p> <pre><code>&lt;?php $conectar = mysqli_connect(HOST, USER, PASS, DATABASE); $query = " SELECT cursoID, nombreCurso, cursoFechaInicio, modalidadCurso, estadoCurso FROM cursos WHERE estadoCurso='abierto'"; $buscarCurso = mysqli_query($conectar,$query); echo '&lt;div class="checkbox"&gt;'; while ($curso=mysqli_fetch_assoc($buscarCurso)) { echo '&lt;input type="checkbox" name="cursoID[]" value="'.$curso['cursoID'].'"&gt;'.$curso['nombreCurso']; } echo '&lt;/div&gt;'; ?&gt; </code></pre> <p>My database consultation in order to insert that field is a simple select:</p> <pre><code>INSERT INTO cursosUsuarios (userID, cursoID) VALUES ('$userID', '$cursoID') </code></pre> <p>I have no issues with $userID, as is a single value.</p> <p>How may I use <code>$cursoID = $_POST['cursoID']</code> to add it to the database? I've been reading some other questions (like <a href="https://stackoverflow.com/questions/4631224/getting-multiple-checkboxes-names-ids-with-php">this one</a>, or <a href="https://stackoverflow.com/questions/14424665/how-to-insert-multiple-checkbox-values-into-a-database">this other one</a>), but couldn't manage to apply it to my case, as I don't know how would I insert it into the database.</p> </div>

如何将复选框值存储到mysql字段进行搜索?

<div class="post-text" itemprop="text"> <p>I want to storage checkbox valus to a field.</p> <h3>html like this</h3> <p><code>two value selected</code></p> <pre><code>&lt;input type="checkbox" value="1"&gt;invest_type1 &lt;input type="checkbox" value="2" checked&gt;invest_type2 &lt;input type="checkbox" value="3" checked&gt;invest_type3 &lt;!-- more, but less than 20--&gt; </code></pre> <h3>mysql table dict</h3> <pre><code>id project_name invest_types // how to save? // other fields </code></pre> <h3>Demand</h3> <p><code>multiple select</code></p> <p>exp. User select "invest1" and "invest2",then how to fetch that row?</p> <h3>Plans</h3> <ol> <li><p>use bit method to storage.</p> <p>invest_type2 is 2 , pow(2,2) =&gt; 4</p> <p>invest_type2 is 3 , pow(2,3) =&gt; 8</p> <p>4+8=12,when select use invest_types &amp; (invest_type1's pow + invest_type2's pow)</p></li> <li><p>add table to relate</p> <p>add table to storage invest_types with every project.</p> <p>use join and distinct when use search.</p></li> </ol> <h3>Problem &amp; Help</h3> <ul> <li>Which plan is the best?</li> <li>What about efficiency of plan1?</li> </ul> </div>

将复选框值存储到mysql数据库

<div class="post-text" itemprop="text"> <p>I have problem in storing checkbox values in mysql db (only the last value is stored in the database). How can I fix this code to store all checked values?</p> <pre><code>&lt;label class="q" for="q1"&gt;Which, if any, of these activities did you do on the Internet in the last 30 days? &lt;/label&gt;&lt;br&gt;&lt;br&gt; &lt;input name="q1[]" type="checkbox" value="a1"&gt;Used e-mail&lt;br&gt; &lt;input name="q1[]" type="checkbox" value="a2"&gt;Used instant messenger &amp; chat room&lt;br&gt; &lt;input name="q1[]" type="checkbox" value="a3"&gt;Made a purchase for personal use&lt;br&gt; &lt;input name="q1[]" type="checkbox" value="a4"&gt;Downloaded/Played a video game&lt;br&gt; &lt;input name="q1[]" type="checkbox" value="a5"&gt;Obtained news/information/current events&lt;br&gt; &lt;input name="q1[]" type="checkbox" value="a6"&gt;Looked for employment (Used classified listings)&lt;br&gt; &lt;input name="q1[]" type="checkbox" value="a7"&gt;Looked for recipes&lt;br&gt; &lt;input name="q1[]" type="checkbox" value="a8"&gt;Downloaded a movie&lt;br&gt; &lt;br&gt; &lt;?php include('config.php'); $tbl_name="temp_members_db"; $q1=$_POST['q1']; $sql="INSERT INTO $tbl_name(q1)VALUES('$q1')"; ?&gt; </code></pre> </div>

winform checkbox 状态 加载时候保存上次 的状态

winform checkbox 状态 加载时候保存上次 的状态 吧 checkstata 保存到数据库了 ,是还要 读取 出来为其 赋值? 100个 checkbox?

困惑: struts2 checkboxlist 后台取不到选中的值

百度,谷歌了很久了,问题还是没有解决,代码看起来没有什么问题就是后台接收不了选中的值,望高手解惑!!! ftl页面: <@s.form theme="simple" action="NewMessage"> <@s.bean name="oa.action.messageManage.userTag" id="usersList" /> <tr> <td width="15%" align="right"><div id="reciepant_text">发给:</div></td> <td width="85%" align="left"><div id="reciepant_select"> <@s.checkboxlist name="usersGet" list="#usersList.users" listKey="userId" listValue="userName"/> </div></td> </tr> <tr><td colspan="2"><div id="confirm" align="center"> <center><@s.submit value="确认"/></center> </div></td></tr> </@s.form> 类userTag: public class userTag { private List users; public userTag(){ } public List getUsers(){ List users = null; UserDAO ud = new UserDAO(); Session s = ud.getSession(); Transaction ts = s.beginTransaction(); users = ud.findAll(); ts.commit(); s.close(); User u = new User(1000, "所有人"); users.add(u); this.setUsers(users); return this.users; } public void setUsers(List users){ this.users = users; } } Action类 NewMessage : public class NewMessage extends ActionSupport{ private Integer[] usersGet; private String content; private String newMessageMsg; private static final Log log = LogFactory.getLog(NewMessage.class); ....... //get方法和set方法 。。。。。。。 } 严重: Servlet.service() for servlet default threw exception java.lang.NullPointerException 。。。。。。。 at oa.action.messageManage.NewMessage.sentMessages(NewMessage.java:74)——————在这一行有一个for循环使用了this.usersGet所以报错 usersGet 按理应该可以取得值的啊,可是不知道为什么使用log.debug(.......)来测试发现它的值总是null。何解??? 这个问题如何解决????

jsp 表单提交后存入数据库

1 shigongplan.jsp <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>施工计划</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script type="text/javascript" language="javascript" src="js_file/jquery-3.1.1.js"></script> <script type="text/javascript"> $(document).ready(function () { var i = 1; $("#button").click(function () { //复制一行 var tr = $("#tb tr").eq(1).clone(); tr.find("td").get(0).innerHTML = ++i; tr.appendTo("#tb"); }); $("#button2").click(function () { $("#tb tr:gt(1)").each(function () { if ($(this).find("#CK").get(0).checked == true) { $(this).remove(); } }); i = 1; $("#tb tr:gt(1)").each(function () { $(this).find("td").get(0).innerHTML = ++i; }); $("#CKA").attr("checked", false); }); $("#CKA").click(function () { $("#tb tr:gt(1)").each(function () { $(this).find("#CK").get(0).checked = $("#CKA").get(0).checked; }); }); }) </script> </head> <body> <p>国铁信号工程施工计划统计表</p> <table width="1250" border="1" id="tb"> <tr> <td style="text-align: center"></td> <td><input id="CKA" name="CKA" type="checkbox"/></td> <td><font size="-1">产品</font></td> <td><font size="-1">地点</font></td> <td><font size="-1">编号</font></td> <td><font size="-1">内容</font></td> <td><font size="-1">星期一</font></td> <td><font size="-1">星期二</font></td> <td><font size="-1">星期三</font></td> <td><font size="-1">星期四</font></td> <td><font size="-1">星期五</font></td> <td><font size="-1">星期六</font></td> <td><font size="-1">星期日</font></td> </tr> <tr> <td style="text-align: center">1</td> <td><input id="CK" type="checkbox" name="CK"/></td> <td><input type="text" name="aa" id="textfield2" size="9" /></td> <td><input type="text" name="bb" id="textfield3" size="9" /></td> <td><input type="text" name="cc" id="textfield4" size="9" /></td> <td><input type="text" name="dd" id="textfield5" size="9" /></td> <td><input type="text" name="ee" id="textfield6" size="9" /></td> <td><input type="text" name="ff" id="textfield7" size="9" /></td> <td><input type="text" name="gg" id="textfield8" size="9" /></td> <td><input type="text" name="hh" id="textfield9" size="9" /></td> <td><input type="text" name="ii" id="textfield10" size="9" /></td> <td><input type="text" name="jj" id="textfield11" size="9" /></td> <td><input type="text" name="kk" id="textfield12" size="9" /></td> </tr> </table> <td width="50%" align="center"> <input id="button" type="button" value="添加行" Class="Btn"/>&nbsp; <input id="button2" type="button" value="删除行" Class="Btn"/> <input id="button3" type="button" value="提交" Class="Btn" onclick="window.location.herf='insert_shigong2.jsp' "/> </td> <p>&nbsp;</p> </body> </html> 2 insert_shigong2.jsp <%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="utf-8"%> <%@ page contentType="text/html;charset=utf-8"%> <% request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); response.setContentType("text/html; charset=utf-8"); %> <html> <head> <title>施工计划插入 </TITLE> </head> <body> <% String aa=request.getParameter("aa"); //从表单获得 String bb=request.getParameter("bb"); //从表单获得 String cc=request.getParameter("cc"); //从表单获得 String dd=request.getParameter("dd"); //从表单获得 String ee=request.getParameter("ee"); //从表单获得 String ff=request.getParameter("ff"); //从表单获得 String gg=request.getParameter("gg"); //从表单获得 String hh=request.getParameter("hh"); //从表单获得 String ii=request.getParameter("ii"); //从表单获得 String jj=request.getParameter("jj"); //从表单获得 String kk=request.getParameter("kk"); //从表单获得 java.util.Date date=new java.util.Date(); String datetime=new Timestamp(date.getTime()).toString(); try { /** 连接数据库参数 **/ String driverName = "com.mysql.jdbc.Driver"; //驱动名称 String DBUser = "root"; //mysql用户名 String DBPasswd = "root"; //mysql密码 String DBName = "shigong2"; //数据库名 String connUrl = "jdbc:mysql://localhost:3306/" + DBName + "?user=" + DBUser + "&password=" + DBPasswd; Class.forName(driverName).newInstance(); Connection conn = DriverManager.getConnection(connUrl); Statement stmt = conn.createStatement(); stmt.executeQuery("SET NAMES UTF8"); String insert_sql = "insert into shigong2 values(','" + aa + "','" + bb + "','" + cc + "','" + dd + "','" + ee + "','" + ff + "','" + gg + "','" + hh + "','" + ii + "','" + jj + "','" + kk + "')"; String query_sql = "select * from shigong2"; alert("aa"); try { stmt.execute(insert_sql); }catch(Exception e) { e.printStackTrace(); } try { ResultSet rs = stmt.executeQuery(query_sql); while(rs.next()) { %> 产品:<%=rs.getString("aa")%> 地点:<%=rs.getString("bb")%> 编号:<%=rs.getString("cc")%> 内容:<%=rs.getString("dd")%> 星期一:<%=rs.getString("ee")%> 星期二:<%=rs.getString("ff")%> 星期三:<%=rs.getString("gg")%> 星期四:<%=rs.getString("hh")%> 星期五:<%=rs.getString("ii")%> 星期六:<%=rs.getString("jj")%> 星期日:<%=rs.getString("kk")%> </br> <% } }catch(Exception e) { e.printStackTrace(); } //rs.close(); stmt.close(); conn.close(); }catch (Exception e) { e.printStackTrace(); } %> </body> </html>

使用复选框将数据放入我的数据库

<div class="post-text" itemprop="text"> <p>I am making a project where user can create a schedule and post it, so I am using a check box for the days and a date beside them, I found this code online and I'm having trouble understanding it's process maybe if I know how it works I can create my own..</p> <pre><code>&lt;?php include('../dist/includes/dbcon.php'); $query=mysqli_query($con,"select * from time where days='mwf' order by time_start")or die(mysqli_error()); while($row=mysqli_fetch_array($query)){ $id=$row['time_id']; $start=date("h:i a",strtotime($row['time_start'])); $end=date("h:i a",strtotime($row['time_end'])); ?&gt; &lt;tr &gt; &lt;td&gt;&lt;?php echo $start."-".$end;?&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="checkbox" id="check" name="m[]" value="&lt;?php echo $id;?&gt;" style="width: 20px; height: 20px;"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="checkbox" id="check" name="w[]" value="&lt;?php echo $id;?&gt;" style="width: 20px; height: 20px;"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="checkbox" id="check" name="f[]" value="&lt;?php echo $id;?&gt;" style="width: 20px; height: 20px;"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php }?&gt; &lt;/table&gt; </code></pre> <p>I know how he get's data from the database, the question is how did he input the data into the database. the database called schedule has these fields (time_id, days, subject) so it is understandable that when a user check m then the data would be input in the days but how did he input the time_id? the time database contains these fields (time_id,time_start, time_end) so basically if the user chose 7:00-8:00 that has the time_id of one, then choose W, the schedule database would look like these sched_id =1, time_id = 1, days = w..but how should I write that? thanks in advance</p> </div>

使用php将复选框值存储到mysql数据库

<div class="post-text" itemprop="text"> <p>I have problem in storing checkbox values in mysql db . How can I fix this code to store all checked values?</p> <p>There are seven different columns in type must be stored in the database when you checked for rows</p> <p>This part of the code is responsible for fetching data from the database and put it in a table:</p> <pre><code> while ($row = mysqli_fetch_array($query)) { print "&lt;tr&gt; &lt;td&gt;&lt;input type='checkbox' name='check[]' value=' ".$row['course_id'].", ".$row['course_name'].", ".$row['day'].", ".$row['place'].", ".$row['hour'].", ".$row['type'].", ".$row['instructor_name']."' /&gt;&lt;/td&gt; &lt;td&gt;{$row['course_id']}&lt;/td&gt; &lt;td&gt;{$row['course_name']}&lt;/td&gt; &lt;td&gt;{$row['day']}&lt;/td&gt; &lt;td&gt;{$row['place']}&lt;/td&gt; &lt;td&gt;{$row['hour']}&lt;/td&gt; &lt;td&gt;{$row['type']}&lt;/td&gt; &lt;td&gt;{$row['instructor_name']}&lt;/td&gt; &lt;/tr&gt;"; } print "&lt;/table&gt; &lt;input type='submit' name='Submit' value='Submit'&gt; &lt;/form&gt;"; </code></pre> <p>This part of the code responsible for storing the data in databases</p> <pre><code> if(isset($_POST['check'])){ $returned = $_POST['check']; $office = array('course_id','course_name','day','place','hour','type','instructor_name'); $values = array(); foreach($office as $selection){ $insert1 ="INSERT INTO initial_registration (course_id,course_name,day,place,hour,type,instructor_name) SELECT * FROM offerd_course"; mysqli_query($insert1) or die(mysqli_error()); } } </code></pre> </div>

用于存储布尔值的 MySQL 数据类型

<div class="post-text" itemprop="text"> <p>Since MySQL doesn't seem to have any 'boolean' data type, which data type do you 'abuse' for storing true/false information in MySQL?</p> <p>Especially in the context of writing and reading from/to a PHP script.</p> <p>Over time I have used and seen several approaches:</p> <ul> <li>tinyint, varchar fields containing the values 0/1,</li> <li>varchar fields containing the strings '0'/'1' or 'true'/'false'</li> <li>and finally enum Fields containing the two options 'true'/'false'.</li> </ul> <p>None of the above seems optimal. I tend to prefer the tinyint 0/1 variant, since automatic type conversion in PHP gives me boolean values rather simply.</p> <p>So which data type do you use? Is there a type designed for boolean values which I have overlooked? Do you see any advantages/disadvantages by using one type or another?</p> </div> <p>转载于:https://stackoverflow.com/questions/289727/which-mysql-data-type-to-use-for-storing-boolean-values</p>

用户注册成功,但数据未存储在数据库中而不显示任何错误

<div class="post-text" itemprop="text"> <p>Sorry if what I'm going to ask is a dumb question, but I have read through and even apply some of the solutions to my problem but it's still not working. I've got the solutions from here: 1. <a href="https://stackoverflow.com/questions/35572329/not-getting-response-when-register-is-successful">Not Getting response after registration is successful</a> 2. <a href="https://stackoverflow.com/questions/41778242/php-register-form-not-updating-database">php register form not updating database</a> 3. <a href="https://stackoverflow.com/questions/27212472/inserted-data-was-not-saving-in-phpmyadmin-database">Inserted data was not saved during registration</a></p> <p>I have a system where the user can register himself/herself as a candidate for job interviews. But right now, the system doesn't save their registration. I have go through the queries but find nothing. Perhaps anybody can point out where I have been doing wrong that make my system doesn't want to keep the data.</p> <p>my register-candidates.php</p> <p></p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;section class="content-header"&gt; &lt;div class="container"&gt; &lt;div class="row latest-job margin-top-50 margin-bottom-20 bg-white"&gt; &lt;h1 class="text-center margin-bottom-20"&gt;CREATE YOUR PROFILE&lt;/h1&gt; &lt;form method="post" id="registerCandidates" action="adduser.php" enctype="multipart/form-data"&gt; &lt;div class="col-md-6 latest-job "&gt; &lt;div class="form-group"&gt; &lt;input class="form-control input-lg" type="text" id="fname" name="fname" placeholder="First Name *" required&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input class="form-control input-lg" type="text" id="lname" name="lname" placeholder="Last Name *" required&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input class="form-control input-lg" type="text" id="email" name="email" placeholder="Email *" required&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;textarea class="form-control input-lg" rows="4" id="aboutme" name="aboutme" placeholder="Brief intro about yourself *" required&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label&gt;Date Of Birth&lt;/label&gt; &lt;input class="form-control input-lg" type="date" id="dob" min="1960-01-01" max="1999-01-31" name="dob" placeholder="Date Of Birth"&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input class="form-control input-lg" type="text" id="age" name="age" placeholder="Age" readonly&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label&gt;Passing Year&lt;/label&gt; &lt;input class="form-control input-lg" type="date" id="passingyear" name="passingyear" placeholder="Passing Year"&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input class="form-control input-lg" type="text" id="qualification" name="qualification" placeholder="Highest Qualification"&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input class="form-control input-lg" type="text" id="stream" name="stream" placeholder="Stream"&gt; &lt;/div&gt; &lt;div class="form-group checkbox"&gt; &lt;label&gt;&lt;input type="checkbox"&gt; I accept terms &amp; conditions&lt;/label&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;button class="btn btn-flat btn-success"&gt;Register&lt;/button&gt; &lt;/div&gt; &lt;?php //If User already registered with this email then show error message. if(isset($_SESSION['registerError'])) { ?&gt; &lt;div class="form-group"&gt; &lt;label style="color: red;"&gt;Email Already Exists! Choose A Different Email!&lt;/label&gt; &lt;/div&gt; &lt;?php unset($_SESSION['registerError']); } ?&gt; &lt;?php if(isset($_SESSION['uploadError'])) { ?&gt; &lt;div class="form-group"&gt; &lt;label style="color: red;"&gt;&lt;?php echo $_SESSION['uploadError']; ?&gt;&lt;/label&gt; &lt;/div&gt; &lt;?php unset($_SESSION['uploadError']); } ?&gt; &lt;/div&gt; &lt;div class="col-md-6 latest-job "&gt; &lt;div class="form-group"&gt; &lt;input class="form-control input-lg" type="password" id="password" name="password" placeholder="Password *" required&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input class="form-control input-lg" type="password" id="cpassword" name="cpassword" placeholder="Confirm Password *" required&gt; &lt;/div&gt; &lt;div id="passwordError" class="btn btn-flat btn-danger hide-me" &gt; Password Mismatch!! &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input class="form-control input-lg" type="text" id="contactno" name="contactno" minlength="10" maxlength="10" onkeypress="return validatePhone(event);" placeholder="Phone Number"&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;textarea class="form-control input-lg" rows="4" id="address" name="address" placeholder="Address"&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input class="form-control input-lg" type="text" id="city" name="city" placeholder="City"&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input class="form-control input-lg" type="text" id="state" name="state" placeholder="State"&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;textarea class="form-control input-lg" rows="4" id="skills" name="skills" placeholder="Enter Skills"&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input class="form-control input-lg" type="text" id="designation" name="designation" placeholder="Designation"&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label style="color: red;"&gt;File Format PDF Only!&lt;/label&gt; &lt;input type="file" name="resume" class="btn btn-flat btn-danger" required&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/section&gt;</code></pre> </div> </div> <p>adduser.php</p> <p></p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php //To Handle Session Variables on This Page session_start(); //Including Database Connection From db.php file to avoid rewriting in all files require_once("db.php"); //If user clicked register button if(isset($_POST)) { //Escape Special Characters In String First $firstname = mysqli_real_escape_string($conn, $_POST['fname']); $lastname = mysqli_real_escape_string($conn, $_POST['lname']); $address = mysqli_real_escape_string($conn, $_POST['address']); $city = mysqli_real_escape_string($conn, $_POST ['city']); $state = mysqli_real_escape_string($conn, $_POST ['state']); $contactno = mysqli_real_escape_string($conn, $_POST ['contactno']); $qualification = mysqli_real_escape_string($conn, $_POST ['qualification']); $stream = mysqli_real_escape_string ($conn, $_POST['stream']); $passingyear = mysqli_real_escape_string($conn, $_POST['passingyear']); $dob = mysqli_real_escape_string($conn, $_POST['dob']); $age = mysqli_real_escape_string($conn, $_POST['age']); $designation = mysqli_real_escape_string($conn, $_POST['designation']); $aboutme = mysqli_real_escape_string($conn, $_POST['aboutme']); $skills = mysqli_real_escape_string($conn, $_POST['skills']); $email = mysqli_real_escape_string($conn, $_POST['email']); $password = mysqli_real_escape_string($conn, $_POST['password']); //Encrypt Password $password = base64_encode(strrev(md5($password))); //sql query to check if email already exists or not $sql = "SELECT email FROM users WHERE email='$email'"; $result = $conn-&gt;query($sql); //if email not found then we can insert new data if($result-&gt;num_rows == 0) { //This variable is used to catch errors doing upload process. False means there is some error and we need to notify that user. $uploadOk = true; //Folder where you want to save your image. THIS FOLDER MUST BE CREATED BEFORE TRYING $folder_dir = "uploads/resume/"; //Getting Basename of file. So if your file location is Documents/New Folder/myResume.pdf then base name will return myResume.pdf $base = basename($_FILES['resume']['name']); //This will get us extension of your file. So myimage.pdf will return pdf. If it was image.doc then this will return doc. $imageFileType = pathinfo($base, PATHINFO_EXTENSION); //Setting a random non repeatable file name. Uniqid will create a unique name based on current timestamp. We are using this because no two files can be of same name as it will overwrite. $file = uniqid() . "." . $resumeFileType; //This is where your files will be saved so in this case it will be uploads/image/newfilename $filename = $folder_dir .$file; //We check if file is saved to our temp location or not. if(file_exists($_FILES['resume']['tmp_name'])) { //Next we need to check if file type is of our allowed extention or not. I have only allowed pdf. You can allow doc, jpg etc. if($resumeFileType == "pdf") { //Next we need to check file size with our limit size. I have set the limit size to 5MB. Note if you set higher than 2MB then you must change your php.ini configuration and change upload_max_filesize and restart your server if($_FILES['resume']['size'] &lt; 500000) { // File size is less than 5MB //If all above condition are met then copy file from server temp location to uploads folder. move_uploaded_file($_FILES["resume"]["tmp_name"], $filename); } else { //Size Error $_SESSION['uploadError'] = "Wrong Size. Max Size Allowed : 5MB"; $uploadOk = false; } } else { //Format Error $_SESSION['uploadError'] = "Wrong Size. Max Size Allowed : 5MB "; $uploadOk = false; } } else { //File not copied to temp location error. $_SESSION['uploadError'] = "Something Went Wrong. File Not Uploaded. Try Again."; $uploadOk = false; } //If there is any error then redirect back. if($uploadOk == false) { header("Location: register-candidates.php"); exit(); } //sql new registration insert query $sql = "INSERT INTO users(firstname, lastname, email, password, address, city, state, contactno, qualification, stream, passingyear, dob, age, designation, resume, hash, aboutme, skills) VALUES ('$firstname', '$lastname', '$email', '$password', '$address', '$city', '$state', '$contactno', '$qualification', '$stream', '$passingyear', '$dob', '$age', '$designation', '$file', '$hash', '$aboutme', '$skills')"; if($conn-&gt;query($sql)===TRUE) { //If data inserted successfully then Set some session variables for easy reference and redirect to company login $_SESSION['registerCompleted'] = true; header("Location: login-candidates.php"); exit(); } else { //If data failed to insert then show that error. Note: This condition should not come unless we as a developer make mistake or someone tries to hack their way in and mess up :D echo "Error " . $sql . "&lt;br&gt;" . $conn-&gt;error; } } else { //if email found in database then show email already exists error. $_SESSION['registerError'] = true; header("Location: register-candidates.php"); exit(); } //Close database connection. Not compulsory but good practice. $conn-&gt;close(); } else { //redirect them back to register page if they didn't click register button header("Location: register-candidates.php"); exit(); }</code></pre> </div> </div> <p>thank you for the help and your time.</p> </div>

Android ListView通过Cursor获取数据问题

一个便签应用,实现了基本的功能,现在就是Cursor获取数据看不懂,先简单说说几个相关的文件。 NoteListActivity在onCreate中绑定了一个NoteListAdapter,此Adapter的bindView代码如下: ``` @Override public void bindView(View view, Context context, Cursor cursor) { if (view instanceof NotesListItem) { NoteItemData itemData = new NoteItemData(context, cursor); ((NotesListItem) view).bind(context, itemData, mChoiceMode, isSelectedItem(cursor.getPosition())); } } ``` NoteItemData类的构造函数中有一句是(其中静态常量TYPE_COLUMN=9): ``` mType = cursor.getInt(TYPE_COLUMN); ``` NotesListItem类继承自LinearLayout,其中bind方法部分代码如下: 这部分功能是,长按Item时,右边会出现CheckBox选择后可以进行删除操作,不知道if语句里面**为什么长按时data.getType() = Notes.TYPE_NOTE(Notes.TYPE_NOTE是常量0)?** ``` public void bind(Context context, NoteItemData data, boolean choiceMode, boolean checked) { if (choiceMode && data.getType() == Notes.TYPE_NOTE) { mCheckBox.setVisibility(View.VISIBLE); mCheckBox.setChecked(checked); } else { mCheckBox.setVisibility(View.GONE); } ``` NoteItemData的getType()方法如下: ``` public int getType() { return mType; } ``` NoteItemData还有一个方法是getNoteType: ``` public static int getNoteType(Cursor cursor) { return cursor.getInt(TYPE_COLUMN); } ``` **这两个方法的内容是一样的,为什么getNoteType=1,getType在长按时=0,否则=1?** 在线等高手回答,研究了好几天了

值在数据库中存储两次

<div class="post-text" itemprop="text"> <p>I am not considering SQL injections as of now will do it once i am done with this problem</p> <p>The problem i have is when i am trying to insert data on the server through AsyncTask the values are inserted twice. I tried using counter to check whether the AsyncTask is called twice or not but the value is " 1 ". </p> <p>// This is My Class file</p> <pre><code>public class Add extends Activity implements OnItemSelectedListener { String picturePath; final String fontPath1 = "fonts/COPRGTB.TTF"; int cnt=0; // -------------------------------------------- private static int RESULT_LOAD_IMAGE = 1; private static final int PICK_FROM_GALLERY = 2; int CAMERA_PIC_REQUEST = 1337; String SD_CARD_IMAGE_PATH = null; Bitmap thumbnail = null; private static final int OG = 4; Cursor cursor; private static final int CAMERA_IMAGE_CAPTURE = 0; Uri u; // int z=0; String z = null; byte b[]; String largeImagePath = ""; Uri uriLargeImage; Uri uriThumbnailImage; Cursor myCursor, cursor1; int flagg = 0; // -------------------------------------------- String FILENAME = "http://animsinc.com/test.php"; // NAME = "http://animsinc.com/upload_image.php"; private CarHelper dbcarhelper = null; private Cursor ourCursor, cur; String fuel[] = new String[] { "Select Any", "Petrol", "Diesel", "CNG" }; String owner[] = new String[] { "Select Any", "1 Owner", "2 Owners", "3 Owners", "4 Owners" }; String curloc[] = new String[] { "Select Any", "Mumbai", "Pune", "Thane", "Delhi" }; Button img, bt, af; ImageView imgview; PopupWindow popUp; EditText et1, et2, et4, et5, et6; String str1, str2, str4, str5, str6, s1, s2, s3, s4, s5, s6, s7, c1, s, i; Spinner sp1, sp2, sp3, sp4, sp5, sp6, sp7; CheckBox cb; private EditText mDateDisplay; public static String id = null; private EditText mDateDisplayone; private EditText mDateDisplaytwo; private int mYear; private int mMonth; private int mDay; static final int DATE_DIALOG_ID = 1; static final int DATE_DIALOG_ID_ONE = 2; static final int DATE_DIALOG_ID_TWO = 3; String mm = ""; int flag = 0; String bal; public void setvalues(String xID) { // TODO Auto-generated method stub id = xID; } @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.add_car); Typeface tf1 = Typeface.createFromAsset(getAssets(), fontPath1); TextView t1 = (TextView) findViewById(R.id.textView1); TextView t2 = (TextView) findViewById(R.id.textView2); TextView t3 = (TextView) findViewById(R.id.textView3); TextView t4 = (TextView) findViewById(R.id.textView4); TextView t5 = (TextView) findViewById(R.id.textView5); TextView t6 = (TextView) findViewById(R.id.textView6); TextView t7 = (TextView) findViewById(R.id.textView7); TextView t8 = (TextView) findViewById(R.id.textView8); TextView t9 = (TextView) findViewById(R.id.textView9); TextView t10 = (TextView) findViewById(R.id.textView10); TextView t11 = (TextView) findViewById(R.id.textView11); TextView t12 = (TextView) findViewById(R.id.textView12); t1.setTypeface(tf1); t2.setTypeface(tf1); t3.setTypeface(tf1); t4.setTypeface(tf1); t5.setTypeface(tf1); t6.setTypeface(tf1); t7.setTypeface(tf1); t8.setTypeface(tf1); t9.setTypeface(tf1); t10.setTypeface(tf1); t11.setTypeface(tf1); t12.setTypeface(tf1); img = (Button) findViewById(R.id.button3); // -------------------------------- if (savedInstanceState != null) { Bitmap carpic; String B1 = savedInstanceState.getString("message"); // Toast.makeText(this, "SavedYeah"+B1, Toast.LENGTH_LONG).show(); BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inSampleSize = OG; carpic = BitmapFactory.decodeFile((B1), opts); System.gc(); if (carpic != null) { imageCam(carpic); } } // -------------------------------- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); imgview = (ImageView) this.findViewById(R.id.imageView1); img.setOnClickListener(click_img); Toast.makeText(getApplicationContext(), "bal=" + bal, Toast.LENGTH_LONG) .show(); et1 = (EditText) findViewById(R.id.editText1); et2 = (EditText) findViewById(R.id.editText2); et4 = (EditText) findViewById(R.id.editText4); et5 = (EditText) findViewById(R.id.editText5); et6 = (EditText) findViewById(R.id.editText6); sp1 = (Spinner) findViewById(R.id.spinner1); sp1.setOnItemSelectedListener(this); sp2 = (Spinner) findViewById(R.id.spinner2); sp2.setOnItemSelectedListener(this); sp3 = (Spinner) findViewById(R.id.spinner3); // sp3.setOnItemSelectedListener(this); sp4 = (Spinner) findViewById(R.id.spinner4); @SuppressWarnings("unchecked") ArrayAdapter spnfuel = new ArrayAdapter(this, R.layout.spin_adptr, fuel); spnfuel.setDropDownViewResource(R.layout.spin_drop); sp4.setAdapter(spnfuel); // sp4.setOnItemSelectedListener(this); sp5 = (Spinner) findViewById(R.id.spinner5); @SuppressWarnings("unchecked") ArrayAdapter spncurloc = new ArrayAdapter(this, R.layout.spin_adptr, curloc); spncurloc.setDropDownViewResource(R.layout.spin_drop); sp5.setAdapter(spncurloc); // sp5.setOnItemSelectedListener(this); sp6 = (Spinner) findViewById(R.id.spinner6); @SuppressWarnings("unchecked") ArrayAdapter spnowner = new ArrayAdapter(this, R.layout.spin_adptr, owner); spnowner.setDropDownViewResource(R.layout.spin_drop); sp6.setAdapter(spnowner); // sp6.setOnItemSelectedListener(this); sp7 = (Spinner) findViewById(R.id.spinner7); @SuppressWarnings("unchecked") ArrayAdapter spnreg = new ArrayAdapter(this, R.layout.spin_adptr, curloc); spnreg.setDropDownViewResource(R.layout.spin_drop); sp7.setAdapter(spnreg); af = (Button) findViewById(R.id.img); //af.setTypeface(tf1); af.setOnClickListener(new OnClickListener() { public void onClick(View v) { flag = 1; if ((et1.getText().length() == 0) || (et2.getText().length() == 0) || (et4.getText().length() == 0) || (et5.getText().length() == 0) || (et6.getText().length() == 0)) { } else { if (cb.isChecked()) { c1 = cb.getText().toString(); // Toast.makeText(getApplicationContext(), "c=" + // c,Toast.LENGTH_LONG).show(); } else { c1 = "Not Negotiable"; } // spinner values s1 = sp1.getSelectedItem().toString(); s2 = sp2.getSelectedItem().toString(); s3 = sp3.getSelectedItem().toString(); s4 = sp4.getSelectedItem().toString(); s5 = sp5.getSelectedItem().toString(); s6 = sp6.getSelectedItem().toString(); s7 = sp7.getSelectedItem().toString(); // edittext values str1 = et1.getText().toString(); str2 = et2.getText().toString(); str4 = et4.getText().toString(); str5 = et5.getText().toString(); str6 = et6.getText().toString(); Toast.makeText( getApplicationContext(), s1 + s2 + s3 + s4 + s5 + s6 + s7 + str1 + str2 + str4 + str5 + str6 + c1, Toast.LENGTH_LONG).show(); } } }); dbcarhelper = new CarHelper(this); dbcarhelper.createDatabase(); dbcarhelper.openDataBase(); if (s != null) { startManagingCursor(ourCursor); } // Toast.makeText(getApplicationContext(), s , // Toast.LENGTH_LONG).show(); dbcarhelper.disp(); CarHelper h = new CarHelper(getApplicationContext()); List&lt;String&gt; lab = h.getAllLab(); ArrayAdapter&lt;String&gt; dataAdap = new ArrayAdapter&lt;String&gt;(this, R.layout.spin_adptr, lab); dataAdap.setDropDownViewResource(R.layout.spin_drop); sp1.setAdapter(dataAdap); sp1.setOnItemSelectedListener(this); if (i != null) { startManagingCursor(cur); } // Toast.makeText(getApplicationContext(), i , // Toast.LENGTH_LONG).show(); sp2.setOnItemSelectedListener(this); cb = (CheckBox) findViewById(R.id.checkBox1); //cb.setTypeface(tf1); Button pickDate = (Button) findViewById(R.id.button4); //pickDate.setTypeface(tf1); pickDate.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); final Calendar c = Calendar.getInstance(); mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH); mDay = c.get(Calendar.DAY_OF_MONTH); updateDisplay(); bt = (Button) findViewById(R.id.button2); //bt.setTypeface(tf1); bt.setOnClickListener(new OnClickListener() { public void onClick(View v) { if ((et1.getText().length() == 0) || (et2.getText().length() == 0) || (et4.getText().length() == 0) || (et5.getText().length() == 0) || (et6.getText().length() == 0)) { Toast.makeText(getApplicationContext(), "Please enter all the details", Toast.LENGTH_LONG) .show(); } else { if (cb.isChecked()) { c1 = cb.getText().toString(); // Toast.makeText(getApplicationContext(), "c=" + // c,Toast.LENGTH_LONG).show(); } else { c1 = "Not Negotiable"; } // spinner values s1 = sp1.getSelectedItem().toString(); s2 = sp2.getSelectedItem().toString(); s3 = sp3.getSelectedItem().toString(); s4 = sp4.getSelectedItem().toString(); s5 = sp5.getSelectedItem().toString(); s6 = sp6.getSelectedItem().toString(); s7 = sp7.getSelectedItem().toString(); // edittext values str1 = et1.getText().toString(); // Toast.makeText(getApplicationContext(), "km=" + // str1,Toast.LENGTH_LONG).show(); str2 = et2.getText().toString(); str4 = et4.getText().toString(); str5 = et5.getText().toString(); str6 = et6.getText().toString(); startDownload(); et1.setText(""); et2.setText(""); et4.setText(""); et5.setText(""); et6.setText(""); sp1.setSelection(0); sp2.setSelection(0); sp3.setSelection(0); sp4.setSelection(0); sp5.setSelection(0); sp6.setSelection(0); sp7.setSelection(0); } } }); } public void imageCam(Bitmap thumbnail) { flag = 1; Bitmap photo = thumbnail; ByteArrayOutputStream bos = new ByteArrayOutputStream(); photo.compress(Bitmap.CompressFormat.JPEG, 70, bos); b = bos.toByteArray(); bal = Base64.encodeBytes(b); ImageView imageview = (ImageView) findViewById(R.id.imageView1); String BX1 = android.os.Build.MANUFACTURER; if (BX1.equalsIgnoreCase("samsung") &amp;&amp; flagg == 0) { // Toast.makeText(getApplicationContext(), "Device man"+BX1, // Toast.LENGTH_LONG).show(); Matrix matrix = new Matrix(); matrix.postRotate(90); photo = Bitmap.createBitmap(photo, 0, 0, photo.getWidth(), photo.getHeight(), matrix, true); } // Bitmap bt=Bitmap.createScaledBitmap(photo, 200, 400, false); imageview.setImageBitmap(photo); } private void startDownload() { new AddTask().execute(FILENAME); } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); } @Override public void onBackPressed() { // TODO Auto-generated method stub super.onBackPressed(); } private View.OnClickListener click_img = new View.OnClickListener() { @Override public void onClick(View v) { openNewGameDialog(); } }; String[] B = { "Camera", "Gallery" }; private void openNewGameDialog() { new AlertDialog.Builder(this).setItems(B, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialoginterface, int i) { if (i == 0) { String BX1 = android.os.Build.MANUFACTURER; if (BX1.equalsIgnoreCase("samsung")) { // Toast.makeText(getApplicationContext(), // "Device man"+BX1, Toast.LENGTH_LONG).show(); Intent intent = new Intent( MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, CAMERA_IMAGE_CAPTURE); } else { Intent cameraIntent = new Intent( android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); } } else if (i == 1) { // Intent in = new // Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); // startActivityForResult(in, RESULT_LOAD_IMAGE); Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, RESULT_LOAD_IMAGE); } } }).show(); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == CAMERA_IMAGE_CAPTURE &amp;&amp; resultCode == Activity.RESULT_OK) { flagg = 0; // Describe the columns you'd like to have returned. Selecting from // the Thumbnails location gives you both the Thumbnail Image ID, as // well as the original image ID String[] projection = { MediaStore.Images.Thumbnails._ID, // The columns we want MediaStore.Images.Thumbnails.IMAGE_ID, MediaStore.Images.Thumbnails.KIND, MediaStore.Images.Thumbnails.DATA }; String selection = MediaStore.Images.Thumbnails.KIND + "=" + // Select // only // mini's MediaStore.Images.Thumbnails.MINI_KIND; String sort = MediaStore.Images.Thumbnails._ID + " DESC"; // At the moment, this is a bit of a hack, as I'm returning ALL // images, and just taking the latest one. There is a better way to // narrow this down I think with a WHERE clause which is currently // the selection variable myCursor = this.managedQuery( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, projection, selection, null, sort); long imageId = 0l; long thumbnailImageId = 0l; String thumbnailPath = ""; try { myCursor.moveToFirst(); imageId = myCursor .getLong(myCursor .getColumnIndexOrThrow(MediaStore.Images.Thumbnails.IMAGE_ID)); thumbnailImageId = myCursor .getLong(myCursor .getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID)); thumbnailPath = myCursor .getString(myCursor .getColumnIndexOrThrow(MediaStore.Images.Thumbnails.DATA)); } finally { // myCursor.close(); } // Create new Cursor to obtain the file Path for the large image String[] largeFileProjection = { MediaStore.Images.ImageColumns._ID, MediaStore.Images.ImageColumns.DATA }; String largeFileSort = MediaStore.Images.ImageColumns._ID + " DESC"; myCursor = this.managedQuery( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, largeFileProjection, null, null, largeFileSort); largeImagePath = ""; try { myCursor.moveToFirst(); // This will actually give yo uthe file path location of the // image. largeImagePath = myCursor .getString(myCursor .getColumnIndexOrThrow(MediaStore.Images.ImageColumns.DATA)); } finally { // myCursor.close(); } // These are the two URI's you'll be interested in. They give you a // handle to the actual images uriLargeImage = Uri.withAppendedPath( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, String.valueOf(imageId)); uriThumbnailImage = Uri.withAppendedPath( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, String.valueOf(thumbnailImageId)); // I've left out the remaining code, as all I do is assign the URI's // to my own objects anyways... // Toast.makeText(this, ""+largeImagePath, // Toast.LENGTH_LONG).show(); // Toast.makeText(this, ""+uriLargeImage, Toast.LENGTH_LONG).show(); // Toast.makeText(this, ""+uriThumbnailImage, // Toast.LENGTH_LONG).show(); if (largeImagePath != null) { // Toast.makeText(this, "LARGE YES"+largeImagePath, // Toast.LENGTH_LONG).show(); BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inSampleSize = OG; // thumbnail = (BitmapFactory.decodeFile(picturePath)); thumbnail = BitmapFactory.decodeFile((largeImagePath), opts); System.gc(); if (thumbnail != null) { // Toast.makeText(this, "Try Without Saved Instance", // Toast.LENGTH_LONG).show(); imageCam(thumbnail); } } if (uriLargeImage != null) { // Toast.makeText(this, ""+uriLargeImage, // Toast.LENGTH_LONG).show(); } if (uriThumbnailImage != null) { // Toast.makeText(this, ""+uriThumbnailImage, // Toast.LENGTH_LONG).show(); } } if (requestCode == 1337 &amp;&amp; resultCode == RESULT_OK) { flagg = 0; Bundle extras = data.getExtras(); // if (extras!=null){ if (extras.keySet().contains("data")) { BitmapFactory.Options options = new BitmapFactory.Options(); // options.inSampleSize = 1; // options.inPurgeable = true; // options.inInputShareable = true; thumbnail = (Bitmap) extras.get("data"); // image(thumbnail); if (thumbnail != null) { // Toast.makeText(this, "YES Thumbnail", // Toast.LENGTH_LONG).show(); BitmapFactory.Options opt = new BitmapFactory.Options(); // options.inSampleSize = 1; // options.inPurgeable = true; // options.inInputShareable = true; thumbnail = (Bitmap) extras.get("data"); imageCam(thumbnail); } } else { Uri imageURI = getIntent().getData(); ImageView imageview = (ImageView) findViewById(R.id.imageView1); imageview.setImageURI(imageURI); if (imageURI != null) { // Toast.makeText(this, "YES Image Uri", // Toast.LENGTH_LONG).show(); } // Toast.makeText(CreateProfile.this, "Picture NOt taken", // Toast.LENGTH_LONG).show(); } } if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) { Uri selectedImage = data.getData(); flagg = 1; String[] filePathColumn = { MediaStore.Images.Media.DATA }; cursor1 = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor1.moveToFirst(); int columnIndex = cursor1.getColumnIndex(filePathColumn[0]); String picturePath = cursor1.getString(columnIndex); // cursor.close(); BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inSampleSize = OG; // thumbnail = (BitmapFactory.decodeFile(picturePath)); thumbnail = BitmapFactory.decodeFile((picturePath), opts); System.gc(); if (thumbnail != null) { imageCam(thumbnail); } else { Toast.makeText(this, "Please select a different picture", Toast.LENGTH_LONG).show(); } } else { // imgview.setBackgroundResource(R.drawable.bbtb); } } @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View position, int arg2, long arg3) { int id = parent.getId(); switch (id) { case R.id.spinner1: String b = sp1.getSelectedItem().toString(); if (b != null) { dbcarhelper.m_pop(b); } CarHelper ch = new CarHelper(getApplicationContext()); List&lt;String&gt; lables = ch.getAllLabels(); ArrayAdapter&lt;String&gt; dataAdapter = new ArrayAdapter&lt;String&gt;(this, R.layout.spin_adptr, lables); dataAdapter.setDropDownViewResource(R.layout.spin_drop); sp2.setAdapter(dataAdapter); break; case R.id.spinner2: String a = sp2.getSelectedItem().toString(); if (a != null) { dbcarhelper.v_pop(a); } CarHelper c = new CarHelper(getApplicationContext()); List&lt;String&gt; lable = c.getAllLabel(); ArrayAdapter&lt;String&gt; dAdapter = new ArrayAdapter&lt;String&gt;(this, R.layout.spin_adptr, lable); dAdapter.setDropDownViewResource(R.layout.spin_drop); sp3.setAdapter(dAdapter); break; } } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { // TODO Auto-generated method stub } protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: return new DatePickerDialog(this, mDateSetListener, mYear, mMonth, mDay); case DATE_DIALOG_ID_ONE: return new DatePickerDialog(this, mDateSetListenerone, mYear, mMonth, mDay); case DATE_DIALOG_ID_TWO: return new DatePickerDialog(this, mDateSetListenertwo, mYear, mMonth, mDay); } return null; } private DatePickerDialog.OnDateSetListener mDateSetListenertwo = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { mYear = year; mMonth = monthOfYear; mDay = dayOfMonth; updateDisplaytwo(); } }; protected void onPrepareDialog(int id, Dialog dialog) { switch (id) { case DATE_DIALOG_ID: ((DatePickerDialog) dialog).updateDate(mYear, mMonth, mDay); break; case DATE_DIALOG_ID_ONE: ((DatePickerDialog) dialog).updateDate(mYear, mMonth, mDay); break; case DATE_DIALOG_ID_TWO: ((DatePickerDialog) dialog).updateDate(mYear, mMonth, mDay); break; } } private void updateDisplaytwo() { int month = mMonth + 1; if (month == 1) { mm = "Jan"; } else if (month == 2) { mm = "Feb"; } else if (month == 3) { mm = "Mar"; } else if (month == 4) { mm = "Apr"; } else if (month == 5) { mm = "May"; } else if (month == 6) { mm = "Jun"; } else if (month == 7) { mm = "Jul"; } else if (month == 8) { mm = "Aug"; } else if (month == 9) { mm = "Sep"; } else if (month == 10) { mm = "Oct"; } else if (month == 11) { mm = "Nov"; } else if (month == 12) { mm = "Dec"; } mDateDisplaytwo.setText(new StringBuilder() // Month is 0 based so add 1 .append(mDay).append("-") // .append(mMonth + 1).append("-") .append(mm).append("-") .append(mYear).append("")); } private void updateDisplay() { int month = mMonth + 1; if (month == 1) { mm = "Jan"; } else if (month == 2) { mm = "Feb"; } else if (month == 3) { mm = "Mar"; } else if (month == 4) { mm = "Apr"; } else if (month == 5) { mm = "May"; } else if (month == 6) { mm = "Jun"; } else if (month == 7) { mm = "Jul"; } else if (month == 8) { mm = "Aug"; } else if (month == 9) { mm = "Sep"; } else if (month == 10) { mm = "Oct"; } else if (month == 11) { mm = "Nov"; } else if (month == 12) { mm = "Dec"; } et5.setText(new StringBuilder() // Month is 0 based so add 1 .append(mDay).append("-") // .append(mMonth + 1).append("-") .append(mm).append("-") .append(mYear).append("")); } private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { mYear = year; mMonth = monthOfYear; mDay = dayOfMonth; updateDisplay(); } }; private DatePickerDialog.OnDateSetListener mDateSetListenerone = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { mYear = year; mMonth = monthOfYear; mDay = dayOfMonth; updateDisplayone(); } }; private void updateDisplayone() { int month = mMonth + 1; if (month == 1) { mm = "Jan"; } else if (month == 2) { mm = "Feb"; } else if (month == 3) { mm = "Mar"; } else if (month == 4) { mm = "Apr"; } else if (month == 5) { mm = "May"; } else if (month == 6) { mm = "Jun"; } else if (month == 7) { mm = "Jul"; } else if (month == 8) { mm = "Aug"; } else if (month == 9) { mm = "Sep"; } else if (month == 10) { mm = "Oct"; } else if (month == 11) { mm = "Nov"; } else if (month == 12) { mm = "Dec"; } mDateDisplayone.setText(new StringBuilder() // Month is 0 based so add 1 .append(mDay).append("-") // .append(mMonth + 1).append("-") .append(mm).append("-") .append(mYear).append("")); } public class AddTask extends AsyncTask&lt;String, Integer, String&gt; { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected void onPostExecute(String result) { super.onPostExecute(result); Toast.makeText(Add.this, "Result=" + result + "cnt= " + cnt, 1000).show(); } @Override protected void onProgressUpdate(Integer... values) { // TODO Auto-generated method stub super.onProgressUpdate(values); } @Override protected String doInBackground(String... params) { String is = null; String trans = "No", ac = "No", lockk = "No", roof = "No", win = "No", seat = "No", stearing = "No", player = "No", wheel = "No", sys = "No", dr = "No"; HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://animsinc.com/test.php"); try { List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;( 30); nameValuePairs.add(new BasicNameValuePair("Make", s1)); nameValuePairs.add(new BasicNameValuePair("Model", s2)); nameValuePairs.add(new BasicNameValuePair("Version", s3)); nameValuePairs.add(new BasicNameValuePair("FuelType", s4)); nameValuePairs.add(new BasicNameValuePair("Kilo", str1)); nameValuePairs.add(new BasicNameValuePair("Price", str2)); nameValuePairs.add(new BasicNameValuePair("Reg", s7)); nameValuePairs.add(new BasicNameValuePair("Color", str4)); nameValuePairs.add(new BasicNameValuePair("Mdate", str5)); nameValuePairs.add(new BasicNameValuePair("Desc", str6)); nameValuePairs.add(new BasicNameValuePair("Loc", s5)); nameValuePairs.add(new BasicNameValuePair("Owners", s6)); nameValuePairs.add(new BasicNameValuePair("Negot", c1)); nameValuePairs.add(new BasicNameValuePair("Trans", trans)); nameValuePairs.add(new BasicNameValuePair("Drive", dr)); nameValuePairs.add(new BasicNameValuePair("Lockk", lockk)); nameValuePairs.add(new BasicNameValuePair("AC", ac)); nameValuePairs.add(new BasicNameValuePair("Window", win)); nameValuePairs .add(new BasicNameValuePair("Stearing", stearing)); nameValuePairs.add(new BasicNameValuePair("Seats", seat)); nameValuePairs.add(new BasicNameValuePair("Player", player)); nameValuePairs.add(new BasicNameValuePair("Sunroof", roof)); nameValuePairs.add(new BasicNameValuePair("Sound", sys)); nameValuePairs.add(new BasicNameValuePair("Wheel", wheel)); nameValuePairs.add(new BasicNameValuePair("Seller_ID", id)); nameValuePairs.add(new BasicNameValuePair("Image", bal)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); httpclient.execute(httppost); cnt++; HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = EntityUtils.toString(entity); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block } return Integer.toString(cnt); } } } </code></pre> <p>//This is My PHP code test.php</p> <pre><code>&lt;?php require 'DbConnect.php'; $Make = $_POST["Make"]; $Model = $_POST["Model"]; $Version= $_POST["Version"]; $FuelType= $_POST["FuelType"]; $Kilo = $_POST["Kilo"]; $Price= $_POST["Price"]; $Reg= $_POST["Reg"]; $Color= $_POST["Color"]; $Mdate= $_POST["Mdate"]; $Desc= $_POST["Desc"]; $Loc= $_POST["Loc"]; $Owners = $_POST["Owners"]; $Negot= $_POST["Negot"]; $Trans= $_POST["Trans"]; $AC= $_POST["AC"]; $car_lockk= $_POST["Lockk"]; $Sunroof= $_POST["Sunroof"]; $Window= $_POST["Window"]; $Seat= $_POST["Seats"]; $Stearing= $_POST["Stearing"]; $Music= $_POST["Player"]; $Wheels= $_POST["Wheel"]; $Sound= $_POST["Sound"]; $Drive= $_POST["Drive"]; $IMG= $_POST["Image"]; $ID = $_POST["Seller_ID"]; $query2 = "INSERT INTO used_cars (make, model, version, color, manufacturing_date, km_driven, fuel_type, expected_price, negotiable, registration_place, no_of_owners, description, current_location, transmission, ac, sunroof, window, seats, stearing, player, wheels, sound_system, drive, car_lockk, seller_id, img) VALUES ('$Make', '$Model', '$Version', '$Color', '$Mdate', '$Kilo', '$FuelType', '$Price', '$Negot', '$Reg', '$Owners', '$Desc', '$Loc', '$Trans', '$AC', '$Sunroof', '$Window', '$Seat', '$Stearing', '$Music', '$Wheels', '$Sound', '$Drive', '$car_lockk', '$ID', '$IMG')"; if((mysql_query($query2))) { echo 'Success'; }else { echo 'Fail'; } ?&gt; </code></pre> <p>// This is my DBConnect.php</p> <pre><code>&lt;?php $mysql_host='localhost'; $mysql_user='abc'; $mysql_pass ='abc'; if(!(@mysql_connect ($mysql_host, $mysql_user, $mysql_pass)) ||!(@mysql_select_db('animsinc_CarList')) ){ die('Not Connected'); }else{ //echo 'Connected.'; } ?&gt; </code></pre> <p><img src="https://i.stack.imgur.com/A69HK.jpg" alt="enter image description here"></p> </div>

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

删库了,我们一定要跑路吗?

在工作中,我们误删数据或者数据库,我们一定需要跑路吗?我看未必,程序员一定要学会自救,神不知鬼不觉的将数据找回。 在 mysql 数据库中,我们知道 binlog 日志记录了我们对数据库的所有操作,所以 binlog 日志就是我们自救的利器。 接下来就来开启程序员自救之路。 想要自救成功,binlog 这把利器一定要好,在自己之前,我们一定要确定我们有 binlog 这把利器,以下就是确保有 bi...

再不跳槽,应届毕业生拿的都比我多了!

跳槽几乎是每个人职业生涯的一部分,很多HR说“三年两跳”已经是一个跳槽频繁与否的阈值了,可为什么市面上有很多程序员不到一年就跳槽呢?他们不担心影响履历吗? PayScale之前发布的**《员工最短任期公司排行榜》中,两家码农大厂Amazon和Google**,以1年和1.1年的员工任期中位数分列第二、第四名。 PayScale:员工最短任期公司排行榜 意外的是,任期中位数极小的这两家公司,薪资...

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

华为初面+综合面试(Java技术面)附上面试题

华为面试整体流程大致分为笔试,性格测试,面试,综合面试,回学校等结果。笔试来说,华为的难度较中等,选择题难度和网易腾讯差不多。最后的代码题,相比下来就简单很多,一共3道题目,前2题很容易就AC,题目已经记不太清楚,不过难度确实不大。最后一题最后提交的代码过了75%的样例,一直没有发现剩下的25%可能存在什么坑。 笔试部分太久远,我就不怎么回忆了。直接将面试。 面试 如果说腾讯的面试是挥金如土...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

外包程序员的幸福生活

今天给你们讲述一个外包程序员的幸福生活。男主是Z哥,不是在外包公司上班的那种,是一名自由职业者,接外包项目自己干。接下来讲的都是真人真事。 先给大家介绍一下男主,Z哥,老程序员,是我十多年前的老同事,技术大牛,当过CTO,也创过业。因为我俩都爱好喝酒、踢球,再加上住的距离不算远,所以一直也断断续续的联系着,我对Z哥的状况也有大概了解。 Z哥几年前创业失败,后来他开始干起了外包,利用自己的技术能...

现代的 “Hello, World”,可不仅仅是几行代码而已

作者 |Charles R. Martin译者 | 弯月,责编 | 夕颜头图 |付费下载自视觉中国出品 | CSDN(ID:CSDNnews)新手...

!大部分程序员只会写3年代码

如果世界上都是这种不思进取的软件公司,那别说大部分程序员只会写 3 年代码,恐怕就没有程序员这种职业。

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

HTTP与HTTPS的区别

面试官问HTTP与HTTPS的区别,我这样回答让他竖起大拇指!

程序员毕业去大公司好还是小公司好?

虽然大公司并不是人人都能进,但我仍建议还未毕业的同学,尽力地通过校招向大公司挤,但凡挤进去,你这一生会容易很多。 大公司哪里好?没能进大公司怎么办?答案都在这里了,记得帮我点赞哦。 目录: 技术氛围 内部晋升与跳槽 啥也没学会,公司倒闭了? 不同的人脉圈,注定会有不同的结果 没能去大厂怎么办? 一、技术氛围 纵观整个程序员技术领域,哪个在行业有所名气的大牛,不是在大厂? 而且众所...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

立即提问
相关内容推荐