Can I add values to a MySQL table via a form based on a match between values in a textbox and values in a column in the table?

This should get you started. //Get the value from the textbox $name = mysql_real_escape_string($_POST'name'); //Select all rows with the name $query = "SELECT other_info FROM table1 WHERE name = '$name' "; $result = mysql_query($query); if ($result) { $rowcount = mysql_num_rows($result); //No rows found if ($rowcount == 0) {echo "no bookings found"; } else { //process the data. $row = mysql_fetch_row($result); $other_info = $row'other_info'; echo "other_info = ".

Hmtlentities($other_info); See here: php.net/manual/en/book.mysql.php Comments on the code $row_count = count($_POST'name'); if ($row_count > 0) { mysql_select_db($database, $connection); //$values = array(); $name = array(); $workshop = array() $replace = array() for($i = 0; $i ". "no bookings found". ""; //OPTION 1 } else { for($i = 0; $i.

Thanks, that certainly helped to get me on my way. I have added the code that I currently have in place, which seems to process the form OK, and add the information from the 'workshop' item to the correct rows in my database. Would you be able to take a look at it and let me know if you see any glaring errors!

Also, I am wondering how to turn the echo "no bookings found" into an error message that shows on the form itself, instead of an echo on a blank page, so if you have any suggestions about that I'd be glad to hear them. Nick – Nick Oct 24 at 22:47 Thanks again Johan. I don't need to replace the names in my table, just add the workshop values where a match with the values in the name column is made.So I took out option 2 and tried to get it working with option 1, which I haven't been able to do.

I am wondering about the $names = "'". Implode("','",$name)."'"; line as $names isn't referred to again. I am also wondering about the $query = "SELECT 1 FROM conference WHERE Name IN $name "; line.

What does the 1 refer to? – Nick Oct 25 at 11:01 @nick Made a typo see the updated code – Johan Oct 25 at 11:27 @nick the 1 returns 1 if something is found and nothing if not that way the db does not actually have fetch any data from the db, saving time – Johan Oct 25 at 11:29 There were brackets missing from the implode line, which prevented your script from working. Now it looks like this: $names = "('".

Implode("','",$name)."')"; For some reason, with $namei only the last name on the form is getting added to $names. When I use $name the correct string is added to $names, but then no data is added to the workshop column. Could you help with this?

Thanks, Nick – Nick Oct 25 at 16:39.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions