Search the Community
Showing results for tags 'stored'.
-
hi, i have the next files to store an array[] into a mysql database. Now i would like to create a file to see the stored data, as an info file....like a table with the results or something. in phpmyadmin database i see the stored data as: a:2:{i:0;s:10:"sentra b15";i:1;s:10:"sentra b13";} thanks for your time index.php <html> <body> <form action="insert3.php" method="post"> Firstname: <input type="text" name="firstname[]"> <br> Firstname 2: <input type="text" name="firstname[]"> <br> Firstname 3: <input type="text" name="firstname[]"> <br> Firstname 4: <input type="text" name="firstname[]"> <br> <input type="submit"> </form> </body> </html> insert.php <?php $con=mysqli_connect("localhost","inputmultiplicad","inputmultiplicado","inputmultiplicado"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $data= $_POST['firstname']; $values= serialize($data); $sql="INSERT INTO input_field (firstname) VALUES ('$values')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "1 record added"; mysqli_close($con); ?>
- 2 replies
-
- array[]
- serialized
-
(and 3 more)
Tagged with: