用php插入带有空格的mysql colum中的数据 [英] Insert data in mysql colum with spaces with php

查看:165
本文介绍了用php插入带有空格的mysql colum中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对脚本有一个小问题,我试图在我的MySQL数据库中输入很多数据,但是我遇到了下一个问题

I've got a little question about my script, I'm trying to enter a lot of data in my MySQL database but I've got the next problem

我无法使用php输入数据,因为其中一个列名中有空格

I can't enter the data with php because there is a space in one of my column names

这是代码

$qw1 = "voornaam, achternaam, straat, postcode, geboortejaar, telefoonnummer, email, ORDER DATE";

$qw2 = "'$vnaam', '$anaam','$straat', $code, $geboorte, $tel, '$email', '$dateandhour'";

mysql_query("INSERT INTO bestellingen ($qw1) VALUES ($qw2)");

我希望有人能帮助我,谢谢前进!

I hope someone could help me, thanks in forward !

推荐答案

为什么不使用sql错误?这样您就可以看到错误所在.

why dont you use the sql error ? so you can see what the msitake is .

尝试

mysql_query("INSERT INTO bestellingen ($qw1) VALUES ($qw2)") or die(mysql_error());

在这周围也使用反引号

    `ORDER DATE`

注意:此`与此'

尝试

   $qw2 = $vnaam .','.$anaam .','.$straat.','. $code.','. $geboorte.','. $tel.', '.$email.', '.$dateandhour ;

这篇关于用php插入带有空格的mysql colum中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆