trq
Staff Alumni-
Posts
30,999 -
Joined
-
Last visited
-
Days Won
26
Everything posted by trq
-
Where have you defined imgDiv?
-
It comes back as a JavaScript object. So, obj.somekey, obj.someotherkey. Which is what I have done in the examples with response.msg.
-
It doesn't use prepared statements all by itself. You need to prepare them yourself. Just calling the query() method will not do anything to of the sort.
-
Ha, it's getting late. Didn't even notice that. success(response) { $('#foo').html(response.msg); } Should be: success: function(response) { $('#foo').html(response.msg); }
-
This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=356195.0
-
Post some relevant code.
-
OK, one very good debugging trick is to echo your query. Change your code so you can see whats going on: $sql = "UPDATE BTECL31113 SET FirstName='$ud_FirstName' , LastName='$ud_LastName' , GroupCode='$ud_GroupCode' , Unit1='$ud_P_Unit1' , Unit2='$ud_P_Unit2' , Unit3='$ud_P_Unit3' , Unit6='$ud_P_Unit6' , Unit14='$ud_P_Unit14' , Unit20='$ud_P_Unit20' , Unit27='$ud_P_Unit27' , Unit28='$ud_P_Unit28' , Unit42='$ud_P_Unit42' , Unit10='$ud_P_Unit10' , Unit11='$ud_P_Unit11' , Unit12='$ud_P_Unit12' , Unit13='$ud_P_Unit13' , Unit1454='$ud_P_Unit1454' , Unit15='$ud_P_Unit15' , Unit16= $ud_P_Unit16' , Unit17='$ud_P_Unit17' , Unit18='$ud_P_Unit18' WHERE P_Id='$ud_P_Id'"; if (!mysql_query($sql)) { echo mysql_error() . "<br />" . $sql; }; What do you get now?
-
This line: dataType: json, should be: dataType: 'json',
-
If your going to be working with JavaScript then Firefox's firebug is a must, though if you use Chrome, it has similar (and just as good imo) tools built in.
-
That code does nothing to escape any special chars. Again, see mysql_real_escape_string.
-
This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=356192.0
-
http://symfony.com/doc/current/components/dependency_injection.html Damn it man, I'm trying to point as many people toward my framework as I possibly can without looking like I'm spamming the place
-
Are you escaping any of your data before using it? Take a look at mysql_real_escape_string. Looks like some of your data might have quotes in it.
-
mysql_query returns a bool, so check that. if (!mysql_query("UPDATE BTECL31113 SET FirstName='$ud_FirstName' , LastName='$ud_LastName' , GroupCode='$ud_GroupCode' , Unit1='$ud_P_Unit1' , Unit2='$ud_P_Unit2' , Unit3='$ud_P_Unit3' , Unit6='$ud_P_Unit6' , Unit14='$ud_P_Unit14' , Unit20='$ud_P_Unit20' , Unit27='$ud_P_Unit27' , Unit28='$ud_P_Unit28' , Unit42='$ud_P_Unit42' , Unit10='$ud_P_Unit10' , Unit11='$ud_P_Unit11' , Unit12='$ud_P_Unit12' , Unit13='$ud_P_Unit13' , Unit1454='$ud_P_Unit1454' , Unit15='$ud_P_Unit15' , Unit16= $ud_P_Unit16' , Unit17='$ud_P_Unit17' , Unit18='$ud_P_Unit18' WHERE P_Id='$ud_P_Id'")) { echo mysql_error(); } ps: Your database design is completely floored. Any time you see fields such as foo1, foo2, foo3, foo4 etc etc screams database normalisation is required.
-
What does the error say? I didn't test any of the code I posted.
-
What have you done to debug the issue then? You can trap database error you know? See mysql_error.
-
You could get rid of the massive add the creeps up the screen. Other than that, nice Wordpress theme.
-
What error are you getting?
-
Use exec instead and check and give it a $return_var argument.
-
I should show an example of sending data to php too I guess. index.php <!DOCTYPE html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js"></script> <script> $(document).ready(function() { $("#linky").click(function() { $.ajax({ url: 'foo.php', type: 'POST', dataType: json, data: { msg_from_js: 'Hello from jQuery' }, success(response) { $('#foo').html(response.msg); } }); }); }); </script> </head> <body> <a href="#" id="linky">Click</a> <div id="foo"></div> </body> </html> foo.php // send the message back to js. echo json_encode(array('msg' => $_POST['msg_from_js']));
-
A simple example. foo.php echo json_encode(array('msg' => 'Hello from foo.php')); index.html <!DOCTYPE html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js"></script> <script> $(document).ready(function() { $("#linky").click(function() { $.ajax({ url: 'foo.php', type: 'POST', dataType: json, success(response) { $('#foo').html(response.msg); } }); }); }); </script> </head> <body> <a href="#" id="linky">Click</a> <div id="foo"></div> </body> </html> I generally return JSON form ajax as it allows you to easily pass back more than one value. Plenty more examples in the docs. http://api.jquery.com/jQuery.ajax/
-
They are not called cascading styles sheets for nothing. You simply override what you need to closer to the context.
-
The site doesn't make sense. What the hell are you selling?