-
1. Re: Data not showing in MySql Database
the_shocker Jun 14, 2011 3:00 PM (in response to Fumph)It's impossible to tell if your post values are correctly named in your form because you have failed to provide the code for your form. Additionally, you declare variables for the post values, then attempt to sanitize them, but then you fail to use those variables in your INSERT query.
This is a Dreamweaver forum. With that said, have you tried using Dreamweaver, the forum you're asking for help in, to create your INSERT query using Dreamweaver Server Behaviors? Perhaps if you used the application that you're posting help for you would not need help. Just a thought.
-
2. Re: Data not showing in MySql Database
Fumph Jun 14, 2011 3:39 PM (in response to the_shocker)Yes my post values ARE spelled correctly, and I am using Dreamweaver. I tried to see if entering data with out the sanitizing section would work, and it didnt. Here is my code so far:
-------------------HTML CODE ON 'EnterContact.htm'------------------
<body>
<form method="post" action="SentContact.php">
<p>
<label for="fName">First Name:</label>
<input type="text" name="fNameF"/>
<label for="mName">Middle Name:</label>
<input type="text" name="mNameF"/>
<label for="lName">Last Name:</label>
<input type="text" name="lNameF"/>
</p>
<p>
<label for="hPhone">Home Phone:</label>
<input type="text" name="hPhoneF"/>
<label for="cPhone">Cell Phone:</label>
<input type="text" name="cPhoneF"/>
</p>
<p>
<label for="city">City:</label>
<input type="text" name="cityF"/>
<label for="zipCode">Zip Code:</label>
<input type="text" name="zipCodeF"/>
</p>
<p>
<label for="job">Job:</label>
<input type="text" name="jobF"/>
</p>
<p> </p>
<p>
<input type="submit" name="enterContact" id="enterContact" value="Submit" />
</p>
</form></body>
--------------------------PHP CODE ON 'SendContact.php'----------------------------
<?php>
$con = mysql_connect("HOST","USERNAME","PASS");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("DATABASE", $con);$sql="INSERT INTO contacts (fName, mName, lName, hPhone, cPhone, city, zipCode, job)
VALUES
('$_POST[$fNameF]','$_POST[$mNameF]','$_POST[$lNameF]','$_POST[$hPhoneF]','$_POST[$cPhoneF ]','$_POST[$cityF]','$_POST[$zipCodeF]','$_POST[$jobF]')";if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Contact Added!";
mysql_close($con);
?>I hope you can help me...
-
3. Re: Data not showing in MySql Database
the_shocker Jun 14, 2011 5:50 PM (in response to Fumph)Yes my post values ARE spelled correctly, and I am using Dreamweaver. I tried to see if entering data with out the sanitizing section would work, and it didnt.
Right, I already knew they were named correctly because I'm looking over your shoulder to see the necessary code you originally failed to provide? C'mon.
You're using Dreamweaver and tried to see if entering the data without sanitizing section would work. Apparently it didn't work for you. Too bad. I guess this thread is solved then because now you know that it does work if you use Dreamweaver server behavior and it doesn't work if you don't know what you're doing and you try to edit the code that is generated by Dreamweaver. Lesson learned: use Dreamweaver server behaviors. They work.
-
4. Re: Data not showing in MySql Database
Fumph Jun 14, 2011 8:08 PM (in response to the_shocker)function(){return A.apply(null,[this].concat($A(arguments)))}
Right, I already knew they were named correctly because I'm looking over your shoulder to see the necessary code you originally failed to provide?
Actually, Server Behaviors don't work! At least not on my computer! Could you tell me why they dont work, since you seem to be oh so smart with technology! And since your SOOOOO smart and know absolutly everything to know about Dreamweaver, then I guess I don't need to say whats wrong with server behaviors! I even think you stated you were looking over my shoulder?? So you should have the answer to what you think is a simple question?
Thank you
-
5. Re: Data not showing in MySql Database
David_Powers Jun 16, 2011 3:17 AM (in response to Fumph)Fumph wrote:
Actually, Server Behaviors don't work! At least not on my computer! Could you tell me why they dont work, since you seem to be oh so smart with technology!
Both of you, please keep the conversation polite without personal attacks and sarcasm.
First of all, the Dreamweaver server behaviors do work. If they're not working for you, there's something wrong either with the way you are using them or with the way your site is configured.
As the_shocker pointed out, you attempt to sanitize the variables, but then fail to use the sanitized versions in your INSERT query.
Secondly, you said the names were correct, but they have changed in your second post. Your form uses fNameF, but the first version of your code refers to $_POST['fName']. They're not the same.
Although you have fixed the names in your second post, the opening <form> tag looks like this:
<form method="post" action="SentContact.php">
However, the name of your script is SendContact.php. They're different, which almost certainly explains why your code isn't working. The devil lies in the details.
-
6. Re: Data not showing in MySql Database
Fumph Jun 16, 2011 10:23 AM (in response to David_Powers)I am sorry for being disrespectful and confusing. But, server behavoirs on my Dreamweaver Cs5 do not work. When I set up my connection, it states that it has connected but it will notlet me select a table and comes up with an error saying "An unidentified error has occurred". I double check my spelling on my MySql Server and all that and it still says that. I am just frustrated that I can not seem to do what everyone else finds simple.
-
7. Re: Data not showing in MySql Database
the_shocker Jun 16, 2011 11:10 AM (in response to Fumph)When I set up my connection, it states that it has connected but it will not let me select a table and comes up with an error saying "An unidentified error has occurred".
Proving symptoms without details will not get you much help. It's like saying "my car won't start". Do you expect someone to then go through 20 ?'s asking if you tried putting the key in the ignition, putting gas in the tank, putting oil in the engine, etc. The point that you hopefully grasp form this post is that without relevant details to diagnose your issue one is left to speculate, which can be exhausting for people that don't want to ask you 20 ?'s. You saying I set everything up and I get an unexpected error will most likely not produce a helpful response, only inquiry for you to provide more details to diagnose the problem.
-
8. Re: Data not showing in MySql Database
Fumph Jun 16, 2011 1:11 PM (in response to the_shocker)What should I post that will help the both of us solve this problem. I am obviously new and don't know how these forums work.
-
9. Re: Data not showing in MySql Database
the_shocker Jun 16, 2011 1:51 PM (in response to Fumph)What should I post that will help the both of us solve this problem.
Precise details of the steps you have performed to experience the symptoms you describe.
-
10. Re: Data not showing in MySql Database
Fumph Jun 16, 2011 9:37 PM (in response to the_shocker)I will start all over here. When I start a new site, page, anything, that works fine. For now I will start a new PHP file. I will save it as scratch.php in My Documents(I'm on Win XP). Now I am opening up the Server Behaviors panel, and the first thing it says is that I need to create a new site. So I have created a new site called testing site1. Here is my sites file path C:\Documents and Settings\Alex2\My Documents\testingsite1\. I will re-save my file with the same name into my site's root folder. Okay, I have completed the first step Server Behaviors wants me to. The next step, create a document type, I already did with scratch.php. Step 3, set up a testing server. I will be using a free host for this example. I set up my website at www.testingsite1.vacau.com and copied the ftp details into the form where Dreamweaver wants me to enter my testing server details. I click okay, then Server Behaviors wants me to click the "+" and choose Recordset. I follow the instructions and click "Recordset", up comes another form. I go ahead and type in the Connection name, MySql Server, User Name and Password. Next, I click Select Database and is loads, then bam. An alert message pops up clearly saying "An unidentified error has occurred". I don't know why, and that is my question. Why does this pop up and not let me select a database to finish the process. Although you have the option to test your site connection, it needs me to specify a database. Tell me if I left something out or you need more clear, or just more explanation.
-
11. Re: Data not showing in MySql Database
the_shocker Jun 16, 2011 10:10 PM (in response to Fumph)I understand your frustration and sympathize. Here's what I recommend. First setup your site in Dreamweaver before opening files and trying to add Recordsets. When setting up your testing server in Site settings of Dreamweaver you have the option to test the connection of your testing server. If you are able to connect to your testing server then you know that you're setup correctly up to that point so you can move on to opening your page file in Dreamweaver, adding a recordset to the page, and the beginning the process of setting up your MySQL connection for the first time. If you are unable to achieve a successful connection while testing the connection to your testing server during site setup then you have done something incorrectly when setting up the testing server. It's possible you misspelled the URL for the testing server or some other factor involved with the server connection.
Moving on to MySQL connection window now. If you are successful in connecting to your testing server then you can move on to testing the connection for the database. It's possible you have entered invalid credentials for your database connection. Make sure your MySQL credentials are entered correctly and test. If you were successful in testing the connection of your testing server earlier and when testing connection to MySQL you get the unidentified error then you have most likely entered invalid credentials for your MySQL connection.
-
12. Re: Data not showing in MySql Database
Fumph Jun 17, 2011 12:28 PM (in response to the_shocker)I did as you said, and created a new site. I set up a new PHP file and set up the site connection which worked perfectly. Then I tried to define my database for a recordset, and the unidentified error popped up. I check my host to make sure they had MySQL and PHP and they do. Which makes this more confusing. Although, I have a feeling it has to do with the server. Do you know anymore places on the web where I can set a up a database for this to work? If not I might be able to get access to a local server. What host do you use?
-
13. Re: Data not showing in MySql Database
the_shocker Jun 17, 2011 8:16 PM (in response to Fumph)Fumph wrote:
I might be able to get access to a local server.
Development should be performed on a local testing server anyway.
-
14. Re: Data not showing in MySql Database
Fumph Jun 17, 2011 9:22 PM (in response to the_shocker)Okay, well I don't have access to it right now. When I do I will try it again. Thank you very much for being understanding and cooperative!




