SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: Help my codes
-
May 21, 2002, 00:41 #1
- Join Date
- Apr 2002
- Posts
- 523
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Help my codes
I try to run this codes but just only sex is not coming. I input name, japanese , sex,but sex doesn't come to my database. I did so many times. But still it is not coming only sex. Please help again.
Thank you for helping before
<?php
$username = "itohideo";
$password = "1234";
$host = "localhost";
$dbcon = mysql_connect($host, $username, $password);
$database = mysql_select_db("itohideo");
if (isset($_POST["submit"])) {
$name = $_POST["name"];
$japanese = $_POST["japanese"];
$sex = $_POST["sex"];
$query_insert = "insert into japan (name, japanese, sex) values ('$name', '$japanese', '$sex')";
$query_result_insert = mysql_query($query_insert, $dbcon) or die (mysql_error($dbcon));
$query = "select * from japan";
$query_result = mysql_query($query, $dbcon);
$num = mysql_num_rows($query_result);
print "<table border=\"1\">";
while ($row = mysql_fetch_array($query_result)) {
print "<tr>";
print "<td><b>".$row[0]. "</b> </td><td><b>".$row[1]."</b><br></td>";
print "<td><b>".$row[2]. "</b> </td><td><b>".$row[3]."</b><br></td>";
print "<td><b>".$row[4]. "</b> </td><td> <b>".$row[5]."</b><br></td>";
print "</tr>";
}
print "</table>";
print "there are $num result in the table Japan";
exit;
}
?>
<form method="post" action="dc1.php">
<input name="name" type="text">
<input name="japanese" type="text">
<input name="sex" type="text">
<input type="submit" name="submit">
</form>
-
May 21, 2002, 00:50 #2
- Join Date
- Apr 2002
- Posts
- 523
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Forget to say
My php is 4.2 and
my php says here is wrong
$sex = $_POST["sex"]; I don't know why
-
May 21, 2002, 00:53 #3
Can you please post the EXACT error message that PHP is giving you. It would help others understand the problem better. Thanks
-
May 21, 2002, 01:07 #4
- Join Date
- Mar 2001
- Location
- Southern California, USA
- Posts
- 1,181
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What is the error message?
Anyway, you should not placed these codes at top of your scriptPHP Code:$username = "itohideo";
$password = "1234";
$host = "localhost";
$dbcon = mysql_connect($host, $username, $password);
$database = mysql_select_db("itohideo");
Bookmarks