Tag: mysqli

Android – 让用户登录

我正在尝试使用PHP和MySQLi for Android进行登录。 我不明白的是如何让用户登录? 我看到一个简单的教程,其中有人使用SQLite来获取安全信息,但我不知道这是否真的是安全的。 我应该如何保存用户信息以保持用户登录? 谢谢。

PHP:将分隔的逗号字符串值与多个数组值一起插入MySql

这是我的目标1.我只从服务器发送一个ID,其中包含字符串分隔逗号列表,它的外观如下:ID = 1,名称=蓝色,红色,绿色,黄色2.这是我的尝试:2.1我试试使用此代码将名称更改为数组 $myString = “Red,Blue,Black”; $myArray = explode(‘,’, $myString); 2.2,我试着像这样插入: $sql=”INSERT INTO `cat_interest`(`id`,`categories`) VALUES (1,'”.$myArray[“categories”].”‘”; if (!$result = $mysqli->query($sql)){ $message = array(‘Message’ => ‘insert fail’); echo json_encode($message); }else{ $message = array(‘Message’ => ‘new record inserted’); echo json_encode($tempArray); } 这是我的完整代码视图 query($sql)){ $message= array(‘Message’ => ‘insertion failed’); echo json_encode($message); }else{ $message= array(‘Message’ => ‘new record inserted’); […]

带有where子句的SQL select语句

如何在没有硬编码值的情况下编写此sql语句? resultSet = statement .executeQuery(“select * from myDatabase.myTable where name = ‘john'”); // this works 而是有类似的东西: String name = “john”; resultSet = statement .executeQuery(“select * from myDatabase.myTable where name =” + name); // Unknown column ‘john’ in ‘where clause’ at // sun.reflect.NativeConstructorAccessorImpl.newInstance0…etc… 提前致谢..