[ Status: Learner ]
I always use mysql, but this time i wanted to learn something new(prepared statements). I found this code in an other question, but I saw similar codes to this, and I found, that I can't imagine what is the "sss" in the 3rd row means.
$query = "INSERT INTO myCity (Name, CountryCode, District) VALUES (?,?,?)";
$stmt = $mysqli->prepare($query);
$stmt->bind_param("sss", $val1, $val2, $val3);
$val1 = 'Stuttgart';
$val2 = 'DEU';
$val3 = 'Baden-Wuerttemberg';
/* Execute the statement */
$stmt->execute();
Here's another code with the same problem in the 2nd row: 'dd'
$stmt = $conn->prepare ( 'SELECT author, title FROM books where price < ? and weight > ?' );
$stmt->bind_param('dd',$price,$weight);
$price=15.; //RON
$weight=300.; //g
if (!$stmt->execute()) die ("Unsuccessfull query.");
$stmt->bind_result($author, $title);
echo "Big weight (>$weight g) and cheap books (< $price RON) <br>";
Could you explain it please for me please?