|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
troubles submitting
I have a student database for a boarding school setup and I made a login for all the parents and I put notes so they can communicate with us and it gets displayed when they login. So we can message each other. Kinda like a private message board. However when you click submit it only submites sometimes. I can't figure it out. It's like it only works when it wants. I don't even know where to start with this problem. Anyone had this type of problem?
|
|
#2
|
|||
|
|||
|
RE: troubles submitting
if (isset($_GET['teen']))
$_SESSION['teen'] = $_GET['teen']; if (isset($addnote)) { $addnotequery= "INSERT INTO leads_notes (company_id, lead_id, note, date_time) VALUES ('".$_SESSION['company']."', '".$_SESSION['teen']."', '".str_replace("'","'",$note)."', NOW())"; mysql_query($addnotequery); } That is the code to add a note from a forum. it has some more stuff. but that is the main thing. anyone see a problem? |
|
#3
|
|||
|
|||
|
RE: troubles submitting
I'm not sure where things are going wrong for you, but I can offer a few suggestions.
1. Make sure you use mysql_escape_string on any strings that you are trying to insert into the database. Characters like ' can really screw things up. 2. print out $addnotequery while you are testing and see if a MySQL syntax error is causing your problem. You will at least be able to see which values are causing the query to fail. Good luck. |
|
#4
|
|||
|
|||
|
RE: troubles submitting
where should i put those in?
|
|
#5
|
|||
|
|||
|
RE: troubles submitting
Make sure you put the mysql_escape_string function in before the insert. All that function does is takes care of all of the escape characters to make the string ready to insert into a MySQL database.
For example, I would add a layer before the insert....something like this: Code:
$str_company = mysql_escape_string($_SESSION['company']); Do the same thing for every string being inserted...and instead of inserting $_SESSION['company'] you would use $str_company. Then if you are still having problems you can just print out the SQL statement to the screen. You can do this either before or after the insert to see what the exact query was that you were trying to run. Make sure to remove it or comment it out when you have things figured out though so the end user doesn't get confused. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > troubles submitting |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|