Php database storage problems

Source: Internet
Author: User
I am a little confused about the storage of php databases. I just started learning... $ Query = "insert & nbsp; into & nbsp; movie & nbsp; (rating) & nbsp; values & nbsp; ('$ num3 ')"; $ result = mysql_query ($ query); a separate php database storage problem
I am a little white. I just started learning...
$ Query = "insert into movie (rating) values ('$ num3 ')";
$ Result = mysql_query ($ query );

The result of printing $ num3 is 9.2, but why does it become 0 when it is stored in the database? The field rating is float type
$ Query = "insert into movie (title) values ('$ m [0] [$ I + 5]')"; print $ m [0] [$ I + 5] separately as asdfg
However, the data stored in the database becomes Array [1 + 5. The field title is of the char type.
Is there a problem with my statements? Database php insert query
------ Solution --------------------

$query="insert into movie (rating) values ('".$num3."')";
$query="insert into movie (title) values ('".$m[0][$i+5]."')"; 

------ Solution --------------------
$ Query = "insert into movie (rating) values ('$ num3 ')";
This will not be a problem. you can write
$ Query = "insert into movie (rating) values ($ num3 )";
Look

$ Query = "insert into movie (title) values ('$ m [0] [$ I + 5]')";
Ying writing
$ Query = "insert into movie (title) values ('{$ m [0] [$ I + 5]}')";

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.