Question : PHP sql statements

I have created a newsletter form,
I receive the data but I can not insert it or select it from database
I'm new to PHP

$sql="INSERT INTO Mytable(Name, Surname, Email, Confirmation, IP, Date, Market)
VALUES
('$name','$surname','$email','$ConfirmationCode','$ipi','$todayis','$market')";

// I think I miss something here..

$result = mysql_query("SELECT * FROM Mytable")
or die(mysql_error());  

echo "<table border='1'>";
echo "<tr> <th>Name</th> <th>Age</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
      // Print out the contents of each row into a table
      echo "<tr><td>";
      echo $row['id'];
      echo "</td><td>";
      echo $row['Name'];
      echo "</td><td>";
      echo $row['Surname'];
      echo "</td><td>";
      echo $row['Email'];
      echo "</td><td>";
      echo $row['Confirmation'];
      echo "</td><td>";
      echo $row['IP'];
      echo "</td><td>";
      echo $row['Date'];
      echo "</td><td>";
      echo $row['Market'];
      echo "</td><td>";
      echo $row['Approve'];
      echo "</td></tr>";  }

echo "</table>";

Answer : PHP sql statements

Do you actually use the $sql variable in a mysql_query() function? If not then that is why nothing is getting inserted.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
$sql="INSERT INTO Mytable(Name, Surname, Email, Confirmation, IP, Date, Market)
VALUES
('$name','$surname','$email','$ConfirmationCode','$ipi','$todayis','$market')";

// you need to run the insert query!!!
mysql_query($sql) or die(mysql_error());

// Now you can get the data back again.

$result = mysql_query("SELECT * FROM Mytable")
or die(mysql_error());  

echo "<table border='1'>";
echo "<tr> <th>Name</th> <th>Age</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
      // Print out the contents of each row into a table
      echo "<tr><td>";
      echo $row['id'];
      echo "</td><td>";
      echo $row['Name'];
      echo "</td><td>";
      echo $row['Surname'];
      echo "</td><td>";
      echo $row['Email'];
      echo "</td><td>";
      echo $row['Confirmation'];
      echo "</td><td>";
      echo $row['IP'];
      echo "</td><td>";
      echo $row['Date'];
      echo "</td><td>";
      echo $row['Market'];
      echo "</td><td>";
      echo $row['Approve'];
      echo "</td></tr>";  }

echo "</table>";
Random Solutions  
 
programming4us programming4us