I am small white, just started to learn ...
$query = "INSERT into Movie (rating) VALUES (' $num 3 ')";
$result =mysql_query ($query);
The result of a separate printout of $NUM3 is 9.2, but why does it become 0 when it is stored in the database? Field rating is of type float
and $query= "insert into Movie" VALUES (' $m [0][$i +5] '); Separate print out $m[0][$i +5] is ASDFG
But into the database becomes array[1+5] this. The field title is of type char.
Is there a problem with my statement?
Reply to discussion (solution)
PHP code?12$query= "INSERT into Movie (rating) VALUES ('". $num 3. "')"; $query = "INSERT into Movie (') VALUES ('". $m [0][$i +5]. "')";
It's still not working.
$query = "INSERT into Movie (rating) VALUES (' $num 3 ')";
This won't be a problem, you can write.
$query = "INSERT into Movie (rating) values ($num 3)";
Look
$query = "INSERT INTO Movie" VALUES (' $m [0][$i +5] ');
Should write
$query = "INSERT INTO Movie" values (' {$m [0][$i +5]} ');
$query = "INSERT into Movie (rating) VALUES (' $num 3 ')";
This won't be a problem, you can write.
$query = "INSERT into Movie (rating) values ($num 3)";
Look
$query = "INSERT INTO Movie" VALUES (' $m [0][$i +5] ');
......
Endoche, the second one's written wrong.
Only to find out that I made a bigger mistake. My variables are the content of the page crawled through regular expressions, and the characters are printed out, but the real content also contains the tags, so the first one can not be saved in any way ....
$query = "INSERT into Movie (rating) VALUES (' $num 3 ')";
This won't be a problem, you can write.
$query = "INSERT into Movie (rating) values ($num 3)";
Look
$query = "INSERT INTO Movie" VALUES (' $m [0][$i +5] ');
......
But how to get from a string of strings
9.2
Extract the intermediate 9.2 separately and convert it to float type a
$s =<<< txt9.2txt;preg_match_all ('/> ([. \d]+) '!--', $s, $r);p rint_r ($r [ 1]); Array
(
[0] = = 9.2
)
PHP code?12345$s =<<< TXT9. 2txt;preg_match_all ('/> ([. \d]+) '!--', $s, $r);p rint_r ($r [1]); Array
(
[0] = 9.2
)
Ah ah thank you thank you, again weak weak ask me if I extract this?
Redemption (1994)
Extracting redemption How to use regular expressions to not include labels on both sides
$s =<<< Txtredemption (1994) Txt;preg_match_all (' # (? <=a) [^>]+> ([^<]+) Array
(
[0] = = Redemption
don't know how to thank ... It seems that I still have to study hard, good people all the life of peace ...