I'm trying to loop over a set of results using MySQLi and the bind / fetch.
static function getConnection()
{
if (!isset(self::$db_conn))
{
self::$db_conn = new mysqli(self::$DBSERVER,self::$DBUSER,self::$DBPASS, ModelBase::$DBNAME) or die(mysql_error(0)." Error handling database connection. ");
}
return self::...
Im using this PHP to get a list of Title's from an RSS feed:
<?php require_once('magpie/rss_fetch.inc');
$rss = fetch_rss('http://live.visitmix.com/Sessions/RSS');
foreach ($rss->items as $item) {
$cat = $item['category'];
$title = $item['title'];
echo '<li class="'.$cat.'">'.$title.'</li>';
}
?>
I want to use <cate...
Hello,
I'm working on a Drupal mobile site which is powered by the Mobile module. The non-mobile theme uses panels, and the mobile theme does not. I need to turn off panels for the mobile theme as the panels appear and ruin its layout. How can I do this, or is there a better way to achieve a separate mobile site in general? We're runnin...
We're building a module for generating HTML for email newsletters. We've looked into using a few other modules (SimpleNews, MailChimp, among others), but due to various requirements, it'll be easier and better for us to build a custom solution.
Being a new Drupal developer, I'm a bit worried about handling this in a "non-Drupal" way. Th...
There's a way to get which fields were modified after a update query?
I want to keep track what field XXX user modified... any ways using active records?
...
I'm trying to add an extra class tag if an element / value is the first one found in an array. The problem is, I don't really know what the key will be...
A minified example of the array
Array (
[0] => Array(
id => 1
name = Miller
)
[1] => Array(
id => 4
nam...
Hi I'm trying to pass JS object to a php script through jquery.ajax(), basically:
var bigArray = new Object();
//code
//start loop
bigArray[x] = {name: exname, id: exID, order:e, set: setBox, inc: incBox, example: exampleBox, day: i};
So its pretty much an array of these objects.
var anotherTest = $.toJSON(bigArray);
var ajxFile = "r...
The server at my old employer was rooted this past weekend and apparently the server provider made changes to the server which is affecting the PHP code.
The issue that has arisen is related to serializing objects. The objects being serialized, and other objects not being serialized, are being converted to strings thus breaking the code...
I have RSS like this:
<title>Session 1</pubDate>
<category>Blue</category>
<category>Green</category>
<evnet:starttime>Mon, 15 Mar 2010 12:05:00 GMT</evnet:starttime>
<evnet:endtime>Mon, 15 Mar 2010 12:30:00 GMT</evnet:endtime>
Im using Magpie RSS Parser to get the RSS feed:
<?php require_once('magpie/rss_fetch.inc');
$rss = fetch_r...
I have the following code:
<?php
$code = $_POST['code']; // textbox
$con = mysql_connect("***","****","****");
if (!$con)
{
die('Server overload, please try again' . mysql_error());
}
mysql_select_db("example", $con);
$sql = mysql_query("SELECT code FROM exampletable");
while ($version = mysql_fetch_array($sql))
{
// ...
Problem: some of the post titles on my WordPress site are questions, i.e. the post title ends with a question mark. And I have post queries that generate lists of the most recent posts. So I'm trying to figure out a bit of php that will keep my punctuation correct.
What's a good way to determine if the last character of a title is a que...
Ive been messing with jqgrids alot of the last couple days, and I have nearly everything the way I want it from the display, tabs with different grids, etc.
Im wanting to make use of Modal for adding and editing elements on my grid. My problem that Im running into is this. I have my editurl:"editsu.php" set, if that file is renamed, on ...
I'm trying to create a thumbnail / cutout of a larger image and it works for a large percentage of the time but every now and again I get the following:
Warning: imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error: Corrupt
JPEG data: 626 extraneous bytes before marker 0xd9 in code.php on line 5
This is line 5 of "code.php":...
i am looking for a simple implementation of an PHP-based feed parser. it doesn't have to be extremely robust, flexible, or fast. easy setup and use is more important, it's for a student assignment. the goal is to consume feeds, and to wrap entries and their fields into simple HTML structures. ease of use really is the most important issu...
I want to display some thematic news in my (php) site news column.
Let's say the site theme is "elevators" and I use GoogleNews already filtered rss:
http://news.google.com/news/search?aq=f&pz=1&cf=all&ned=us&hl=en&q=elevators
Now, in the rss preview I can see in a lot of news with thumbnail pictures.
I use simpl...
I'm having a problem with some code that used to work in PHP 4.X and is not working in PHP 5.2.4
First of all, there is a small example of a code similar to the one is causing the problem. Unfortunately, I haven't been able to reproduce the problem with a small example.
<?php
class Example{
public function showExample()
{
$ind...
This can probably apply to other extensible content management systems, but I've been working with Drupal. Specifically I created an image sharing web application whose functionality relied on more original code than Drupal core code. I used the WebForm module and point its forms at Custom Pages with hard coded php to have nodes create...
I want to add a user score like they have on hacker news where the value of the comments on someones news submission and someones comments are added up and a score appears beside their username
so i have 3 tables
users/stories/comments
what would be the best way to do this in php/mysql?
i was thinking... 2 queries one to get all the ...
I'm creating a link shortening service and I'm using base64 encoding/decoding of an incremented ID field to create my urls. A url with the ID "6" would be: http://mysite.com/Ng==
I need to also allow users to create a custom url name, like http://mysite.com/music
Here's my (possibly faulty) approach so far. Help in fixing it would be a...
I have a table 'account' (id, email, pass) in MySQL database.
I have stored procedure:
DELIMITER $$
CREATE PROCEDURE `LoadAccount`(email_p VARCHAR(100))
BEGIN
SELECT pass FROM account WHERE email = email_p;
END$$
DELIMITER ;
And here's the code:
function loadAccount($email, $pass)
{
// connect to DB
// ...
$query = "CA...