Apparently both $sql_1 and $sql_2 in the following are valid.
Can someone tell me when is the right time to use the "."?
It seems to me that the dot can be functioned as both "||" and "+" in java.
$id = _POST[id];
$sql_1 = "select * from usertable where id =$id”;
$sql _2 = "select * from usertable where id =".$id;
when is necessary to use the dot?
Moderator: General Moderators
-
jiehuang001
- Forum Commoner
- Posts: 39
- Joined: Mon May 12, 2003 12:53 pm
- AVATAr
- Forum Regular
- Posts: 524
- Joined: Tue Jul 16, 2002 4:19 pm
- Location: Uruguay -- Montevideo
- Contact:
the dot when using with string is "concatenation".
so, all these are valid:
so, all these are valid:
Code: Select all
<?php
$id = $_POST['id']; //Number
$sql_1 = "select * from usertable where id = $id";
$sql _2 = "select * from usertable where id = ".$id;
$sql _3 = 'select * from usertable where id = '.$id;
?>