douao7937 2016-08-16 06:21
浏览 27
已采纳

当String中有句点(。)时,如何在PHP / MySQL中查询

How do I query from a MySQL database when I have a period (.) in string using PHP.

$variable = "my.email@email.com";
$variable = mysqli_real_escape_string($conn, $variable);
$query = "Select * from table WHERE email = '$variable' ";

Apparently this works when I ran it in PhpMyAdmin SQl tab. But when I run it In my code it does not work. Other strings that don't have a period using the same code are working perfectly. What could be the issue

for those who are asking for my original code here it is

//I get the emails from the url  

    $notit = mysqli_real_escape_string($conn, $_GET['username']);

//I pass my variable in the query

    $sql = "SELECT * ";
    $sql.=" FROM ordrs ";
    $sql.=" WHERE client_email = '$notit' ";
    $query=mysqli_query($conn, $sql) or die("try again");
  • 写回答

3条回答 默认 最新

  • dousi0144 2016-08-17 12:21
    关注

    I figured where the issue was the query was fine the error was coming from json_encode which I din't expect . I hope this question helps others in the future who are facing the problem questioned. Thanks for the help

    thanks for the help. Cheers

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 yolov8边框坐标
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真