I have got a list of menus up on our website with the current week's menu highlighted with a different colour background which is decided by a class of 'current' on that item.
At the moment I change this class manually each week but was wondering if there is something I can set that changes the class automatically based on dates that I g...
Is there a function or class in PHP that I can pass a MySQL recordset and I get a JSON string returned that can be passed back to a JavaScript function in an Ajax request?
something like this:
function recordSetToJson($recordset) {
while($rs1 = mysql_fetch_row($recordset)) {
for($count = 0; $count < count($rs1); $count++) {
// r...
Sorry, I am confused to create a correct title. This is my problem, I have a TXT file:
{{title}}<br />{{content}}
And this is the PHP file:
I load file.txt and replace tags {{variable}} with value from $data['variable']
$data = array ( 'title' => 'Hello', 'content' => 'WORLD!!');
$file = file_get_contents("file.txt");
$key = array_ke...
Hi Guys,
I'm trying to modify http://www.mytinytodo.net/ to integrate it into an app I'm developing. Unfortunately my jQuery/AJAX ability is rubbish at best.
I want to do two things:
1) Tasks to be placed into a parent div depending on due date class. For example, tasks that have already gone past their duedate are placed inside 'e...
Hello, I have a problem with RewriteRules.
I'm currently using this rule:
RewriteRule ^([^/.]+)/?$ index.php?clip=$1
This works fine for links as these, where $_GET['clip'] is the value after the slash:
http://example.com/abcdefg
But not for those with a dot character, like these:
http://example.com/abcdefg.png
How should I chang...
I'd like to create a query in MySQL that has an optional value. When the value is specified the query is filtered by that value, when the value is not all rows are returned. Here's the idea:
public function doQuery($item = 'ANY_VALUE') {
$query = "SELECT * FROM table WHERE item = ?";
db->fetchAll($query,array($item))
...
}
doQuer...
Hello,
How what data should i echo from the server to ajaxically redirect my page? Say, suppose this my jquery :-
$.ajax({
type: "POST",
url : '<?php echo base_url() ?>Admin/AddNotice',
data: {noticeTitle: $('#title').val(),noticeDesc : $('#desc').val() },
success: function(msg){
...
I need to extract the quantity and unit from strings like this
1 tbsp
1tbsp
300ml
300 ml
10grams
10 g
The quantities will always be numbers, then there may or may not be a space then the unit. They may be 15 - 20 different units which can come from a list that we define (perhaps an array)
The solution can be in either javascript or...
I have taken over a medium sized project that was written originally using RoR. The powers that be have decided that they want the web app, 'ported' to Symfony.
After looking at some of the RoR code, I suspect that RoR strongly "influenced" Symfony, as a lot of the idioms are shared - so I think that a 'port' of an app from one to the o...
Hey All
I have the following code (PHP):
$link = array(
"<ul>
<li><a href="index.html" class="active">Home</a></li>
<li><a href="whatwedo.html">What We Do</a></li>
<li><a href="howitworks.html">How It Works</a></li>
<li><a href="support.html">Support</a></li>
<li><a href="lalalala...
Hi. I have a user with his unique username in a mysql table, but I have to test and do many queries to find it. I wonder if its a better way to avoid all does queries to the db.
I have multiple rows in the table with columns like user1, user2, user3, user4 up to 30.
for ($x=0; $x < 30; $x ++){
$user = "user";
$user .= $x; /...
I have a situation explained in this question (with a bounty, yet with no replies), as the initial plan is not going to work, I have reverted to using file_get_contents, sending cookies alongside to authenticate as a logged in user.
Now the example on PHP manual shows how you can use stream contexts to send a cookie. Here is the excerpt...
Hello all,
I am making use of simplehtmldom which has this funciton:
// get html dom form file
function file_get_html() {
$dom = new simple_html_dom;
$args = func_get_args();
$dom->load(call_user_func_array('file_get_contents', $args), true);
return $dom;
}
I use it like so:
$html3 = file_get_html(urlencode(trim("$li...
error : A malicious user can get complete access of an authenticated user’s account using his authenticated Cookie.
How to stop it..?
...
Is it possible to extend PHP PDO statement class to add custom methods to it? This would be different from extending the base PDO class. If so, how would one go about doing it since the statement class is only returned when running queries through the PDO class?
...
Hi Stackoverflow, I have a design problem I cannot find a clean and nice solution to. I am developing in PHP but I believe this could occur in any language. My basic problem is that I have two objects that have circular interdependence at some level of indirection. That means I have a class (call it F) implementing the Facade pattern whi...
I'm finding little info out there on using Flash and remoting services. Currently I'm starting out using AMFPHP which works pretty well for sending back simple sets of data but I'd like to send back complex query types which translate to RecordSets. I have two problems:
1) Is this the way it's currently done? PHP backend with AMFPHP ...
Hello,
I am trying to show server load on a web page. The server load is fetched in PHP by executing the shell command "/proc/loadavg" and displaying the output as it is.
However, I want to display the same output using Javascript (jQuery is fine) and have it updated every 10 seconds.
How do I do so? I was thinking of using Ajax quer...
Here is the documentation for the SugarCRM 5.5 API:
set_relationship
http://developers.sugarcrm.com/docs/PRO/5.5/Developer_Guides/-docs-Developer_Guides-Sugar_Developer_Guide_5.5.1-Chapter%202%20Application%20Framework.html#9000526
This is the gem which is creating methods for me to access it (line 110):
http://github.com/dennijo/Rub...
I want to implement an ORM and validation libraries for it. Please suggest me how start work. Or suggest any developed library from where I got any idea.
...