
trq
Staff Alumni-
Posts
30,999 -
Joined
-
Last visited
-
Days Won
26
Everything posted by trq
-
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.
-
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?
-
You should read this: http://www.phpfreaks.com/forums/index.php?topic=323280.0 Seriously, if your not using a framework you have rocks in your head. Your code looks like a mix of jQuery and vanilla JavaScript. If you really are using jQuery, take a look at there Ajax functionality.
-
if ($result =mysql_query("SELECT id, username FROM users WHERE lastvisit > '$tm' and online='ON'")) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_array($result)){ echo "<tr><td><a href=\"profile.php?id={$row['id']}\">$row['username']</td></tr>"; } } } ?> Then on profile.php have a query that uses the value passed in through $_GET['id'] to that gets a users details.
-
Did you notice that most other peoples code here is syntax highlighted and easy to read? tags do that.
-
Yeah we've been using this at work since it came out. Awesome tool!
-
There is some docs in my framework that might help shed some light on the subject: http://proemframework.org/docs/services-component.html, but there are plenty of other resources around as well. Symfony has a good description in there docs too.
-
I personally don't like the overhead, or the idea of having to learn some other syntax. You can achieve the same goals using php alone.
-
Your code makes little sense. $this->filename should be set to your template. Anyway, why re-invent the wheel? If you must use a template engine of some sort (which I would recommend against) there are plenty of solutions already out there.
-
I'm not a code ignitor user, but something like: $this->session->set_userdata('history', array_merge($this->session->get_userdata('history', $history)); should do the trick.
-
This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=356031.0
-
This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=356029.0
-
There is no "better way", if your functions require a database connection, you need to pass it to them.