I found this script on about.com which I'm trying to learn from on how to create a rating system but the script for some reason wont count a vote when the link is clicked and will send me to a page that says not found. The page should just reload to itself and count the vote>
I was wondering how can I fix this problem? And what part of ...
I'm receiving this error when trying to run a php script against my wordpress DB:
Fatal error: Cannot redeclare class wpdb
Can anyone help me to resolve this?
Edit
Code:
require_once(dirname(__FILE__) . '/../../wp-config.php');
require_once(dirname(__FILE__) . '/../../wp-includes/wp-db.php');
$wpdb->show_errors();
$dupes = $wpd...
I'm making a Calendar in PHP, and I have a for loop for 31 days (or depending on how many days are in the month), each day is written out with $listDay.
In my MySQL database, I have a field called 'eventDate' with a unix timestamp, and I have a variable $event_day built from the timestamp just for the day. I can't figure out how to wri...
Commonly, a website has a menu bar with links to different pages of the site— Home, Page A, Page B, etc..
Let’s say you have a site with address http://www.example.com. 99% when someone types that URL into their browser, they are directed to the page represented by “Home”. It usually has the optional extension of index[.html|.php] (e.g....
Yes, I KNOW about Google Analytics. We use it for our overall site metrics, and I know we can track individual links. However, we needed a tracking solution for very specific links and we need that tracking data available to our web application in real time, so I wrote my own solution:
jQuery:
$.fn.track = function () {
var sour...
I have an HTML form in a PHP file like the attached snippet:
When I hit the "Save Details" button, I want the page to load a jQuery UI modal dialog. That dialog will execute a controller action (ex:savedetails) through Ajax.
Essentially, the controller action will get all the POST details in "frmEmployees" and saves the changes to a dat...
It took me a while to realize that $_SESSION['user'] was changing because I have a variable set: $user = array();
Is this normal? I haven't had this issue until today, not sure if it is a server/php setting
...
I found this script on about.com which I'm trying to learn from on how to create a rating system but the script for some reason wont count a vote when the link is clicked and just reloads the page.
I was wondering how can I fix this problem? And what part of the code do I need to change and where?
Here is the full script below.
<?php
...
I am trying to use MediaWiki's API to get articles in XML format and include them on my page. I created a simple code which basically gets the XML representation of an article using ?action=parse&page=Page_Name&format=xml requests. The code is following:
if($_GET["page"]=='') die("Page not specified (possibly direct call)");
$pagename...
Not sure if that was the best way to phrase what I'm trying to do. Here goes:
I want users to be able to show results form my DB based on three different tables, one at a time.
I have the queries ready, but only want to show one result on the page at a time, based on what the user clicks. The queries are based on 3 different tables. Th...
In PHP, I'm trying to match the first paragraph tag that is not immediately followed by an <img> tag, and add a class to that paragraph tag.
For example, it would add a class to:
<p>Text</p>
and
<p><strong>Strong text</strong></p>
but not:
<p><img src="" /></p>
Here's what I have so far which successfully adds a class to the fi...
I'm working on some new components in my framework for a gettext implementation. It needs to support the dead php4 and php5+. I'm using Zend_Translate and I will implement a gettext based class for php4.
I'm wondering if it's ok to rely on the phpversion function to branch out on which class to implement. Something like...
$version = ...
I start my script from command line and it outputs things as they happen but a week ago it stopped outputing and now outputs everything when script finishes. I have ob_start() but as I know this does not effect command line output.
...
I feel dirty every time I "break" out of a for-each construct (PHP/Javascript)
So something like this:
// Javascript example
for (object in objectList)
{
if (object.test == true)
{
//do some process on object
break;
}
}
For large objectLists I would go through the hassle building a more elegant solution. But ...
I have some rows in a database which represent line items in a sale. Each line item has five columns:
id : Primary key.
sale_id : The sale that this line-item is a part of (a foreign key to a Sales table).
product_id : The product this item corresponds to (a foreign key to a Products table).
group : The line-items group that this item ...
I successfully built my first html/PHP form that passes variables between multiple pages using the _POST global variable and then emails me the results using the mail() function.
I'm sure this form is incredibly insecure as it is now and vulnerable to all matter of exploits and I want to know how to patch up the holes, however I'm prett...
I want to get last month's date. I wrote this out:
$prevmonth=date('M Y');
Which gives me the current month/year. I can't tell if I should use strtotime, mktime. Something to the timestamp? Do I need to add something afterwards to reset so that the date isn't set to last month throughout everything for all timestamps on my site? I'...
Thanks in advance to anyone who takes time to respond. I truly appreciate this site! I've got a function that loads all images it finds in a given directory (see below). The problem I'm trying to resolve is that the images are loaded in a random order.
I'd like the images to be loaded by alpha order based on their filename (widget-1.jpg...
Hello, I'm trying to do a bbcode parser class that can create personalyzed tags, but I have some problem with urls
I've did all I need without particular problems thanks to regular expressions but I have a problem when I try to create a special tag who point to a specified URL.
In my class I've added a method like this:
<?
private...
I've been making a wordpress theme recently and just now some of the code just stopped working. The post formatting disappeared and now I just have a paragraph with text inside it for each post! Here's the php code for the post:
<?php get_header(); ?>
<div id="content">
<div class="wrap">
<div id="leftcol">
<?php if (have_posts())...