|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
PHP and MySQL: The Basics -problem
I was reading the PHP and MySQL: The Basics article here at DevArticles located at URL
And I got to the point of inserting data into the database. I get the message back that the data was entered, but it's not in the database. I don't get any errors. Any thoughts what might be going on? Here's the code from the article. Code:
<html>
<body>
<?PHP
if ($submit) {
// process form
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$sql = "INSERT INTO address (name,,address,hnum,wnum) VALUES ('$name','$address','$hnum','$wnum')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
} else{
// display form
?>
<form method="post" action="<?PHP echo $PHP_SELF?>">
Name:<input type="Text" name="name"><br>
Address:<input type="Text" name="address"><br>
Home Number:<input type="Text" name="hnum"><br>
Work Number:<input type="Text" name="wnum"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?PHP
} // end if
?>
</body>
</html>
|
|
#2
|
|||
|
|||
|
Did you leave out your mysql information purposely or is that the problem?
|
|
#3
|
|||
|
|||
|
Quote:
What information is that? The only thing different in my code, is that I specified the password. |
|
#4
|
|||
|
|||
|
well, i'm not sure if this is the problem but...you have two comma's in your query, where there should be one
if it is, then change: PHP Code:
to PHP Code:
Also...to make sure that there were no problems with the entering of data, you can change: PHP Code:
to PHP Code:
__________________
-Alexander |
|
#5
|
|||
|
|||
|
Change this:
PHP Code:
PHP Code:
|
|
#6
|
|||
|
|||
|
Ah, I didn't even notice that. It was cut and pasted from the article here. So if an admin is watching, you might want to change that.
I'll give it a try later tonight to see if that's the problem. Thanks for catching it. Mike |
|
#7
|
|||
|
|||
|
No problem! Glad to help...if you still are recieving errors, post back here and I'll do all i can
![]() |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > PHP and MySQL: The Basics -problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|