Moved by moderator to Miscellaneous.
i want to write some data into database.i can enter like:
...
$sql="insert into 'test'.'user'('name','age','sex','id')values('example','20','male',NULL)";
$result=mysql_query($sql);
if($result){
echo "done!";
}else{
echo "failed!";
}
...
then browser shows "failed!"
i trid to change it like:
...
$sql="insert into `test`.`user`(`name`,`age`,`sex`,`id`)values('example','20','male',NULL)";
$result=mysql_query($sql);
if($result){
echo "done!";
}else{
echo "failed!";
}
...
then display "done!"
and insert successfully...
i just wanna know...
what's the difference between them..
symbols caused??
the end, thanks for help first...
some questions about php write into mysql
Moderator: General Moderators
Re: some questions about php write into mysql
The only acceptable character to enclose table names or field names is the "back-tick" ( ` ). You cannot substitute the single quote (apostrophe) ( ' ). It is a completely different character. In fact, you don't need to enclose table names or field names at all unless the names are key words or could be confused.
Re: some questions about php write into mysql
thanks a lot for your reply..
i got it...
and i have a query yet..
the database which i created...
also..i inserted contents into this..
then i exported it..when i tried to import it again..error said with:
No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16.
even though.. i downloaded one on internet..and imported it..also showed like above...
i am sure the file size is acceptable...
i got it...
and i have a query yet..
the database which i created...
also..i inserted contents into this..
then i exported it..when i tried to import it again..error said with:
No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16.
even though.. i downloaded one on internet..and imported it..also showed like above...
i am sure the file size is acceptable...
Re: some questions about php write into mysql
I don't know what you mean when you say "exported" and "import". There was nothing in the code you showed that involved importing or exporting or files of any kind. If you explain what you did, maybe I can help you.abel wrote:thanks a lot for your reply..
i got it...
and i have a query yet..
the database which i created...
also..i inserted contents into this..
then i exported it..when i tried to import it again..error said with:
No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16.
even though.. i downloaded one on internet..and imported it..also showed like above...
i am sure the file size is acceptable...
Re: some questions about php write into mysql
oh sorry...
this question is not about php code.
it's about phpmyadmin..
i mean that i can't import sql file through phpmyadmin...
i hope you will understand what i mean...
this question is not about php code.
it's about phpmyadmin..
i mean that i can't import sql file through phpmyadmin...
i hope you will understand what i mean...