Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. It comes back as a JavaScript object. So, obj.somekey, obj.someotherkey. Which is what I have done in the examples with response.msg.
  2. trq

    PHP PDO

    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.
  3. 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); }
  4. This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=356195.0
  5. 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?
  6. This line: dataType: json, should be: dataType: 'json',
  7. 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.
  8. That code does nothing to escape any special chars. Again, see mysql_real_escape_string.
  9. This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=356192.0
  10. 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
  11. 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.
  12. 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.
  13. What does the error say? I didn't test any of the code I posted.
  14. What have you done to debug the issue then? You can trap database error you know? See mysql_error.
  15. You could get rid of the massive add the creeps up the screen. Other than that, nice Wordpress theme.
  16. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=356187.0
  17. Use exec instead and check and give it a $return_var argument.
  18. 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']));
  19. 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/
  20. They are not called cascading styles sheets for nothing. You simply override what you need to closer to the context.
  21. The site doesn't make sense. What the hell are you selling?
  22. You can't just put files in your OS's file system root and have them display, the server has it's own root. No idea where it is in WamServer, but it will be something like C:\PathToWampServer\htdocs
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.