php

Checking a string to see if a specific grouping exist (PHP)?

situation: A user inputs a user name and password. now the user enters a user name called Game_Admin. Thus tries to imitate being a head power of the site and scam others. At the moment My log in script check for Length Characteristics, and to see if it already exist. My question how do I go about checking to see if a player enters a sp...

PDO Statement does nothing?

$columns = "name, address, city, state, zip"; $values = "'$name', '$address', '$city', '$state', '$zip'"; $query = "insert into customer values ($values)"; $statement = $dbh->prepare($query); $statement->execute(); So I am completely new to this. Kindergarten examples and baby talk will not be offensive! : ) The form executes with no ...

How can I select rows in MySQL starting at a given row number?

Say I have 50 rows in a MySQL table. I want to select the first ten (LIMIT 10), but then I want to be able to select the next 10 on a different page. So how do I start my selection, after row 10? Updated query: mysql_query(" SELECT * FROM `picdb` WHERE `username` = '$username' ORDER BY `picid` DESC LIMIT '$start','$co...

PHP: str_replace that only acts on the first match?

I want a version of strreplace() that only replaces the first match in the target string. Is there an easy solution to this, or do I need a hacky solution? ...

Javascript rating bar don't work with modrewrite urls

In my script, this function parts build links: if ($type == "mod_rewrite") { $prepend = ""; $append = ".html"; } else if ($type == "query_string") { $prepend = 'index.php?params='; $append = "/"; } // // // $gamelink = 'game/id/gamename' (example) /* 'game' is a fixed string. 'id' and 'gamename' are...

How do I know if an ORM save() method generated an update or an insert query?

The problem: PHP Code (no framework) if ($this->uid) { $query = sprintf('UPDATE %sUSER SET USERNAME = "%s", ' . 'PASSWORD = "%s", EMAIL_ADDR = "%s", IS_ACTIVE = %d ' . 'WHERE USER_ID = %d', DB_TBL_PREFIX, mysql_real_escape_string($this->username, $GLOBA...

Howto: Drupal File Upload Form

I'm having difficulty figuring out how to write a module with a form that uploads files, in Drupal 6. Can anyone explain this, or point me to a good example/documentation discussing it? EDIT: Here is entirely what I am trying to do: User uploads a .csv Module reads the first line of the file to get fields User matches csv fields with...

Any way I can share a information within 2 difference domain?

Does any one know there have any way I can share a information (it could be cookie, session, variable...) within 2 difference domains but in the same server? Example: I have 2 domain inside the same server, one is called exmaple.com.au and the other one is friendly.com.au. Does there any way that I can share a variable for both domains...

Need to create messaging system like in facebook - any ideas for database design

Hi guys, I'm building a small messaging system like you have in facebook. Only thing is that I want to know whats the best way to get on about it. The database design to be precise in this case. Like all users would have an inbox and sent items folder. Logically something in one persons sent folder would actually be in someone elses inb...

php - check for valid guid

I have a mssql database in which my primary keys are GUIDs. I am working on a web interface for inserting some data. I need a GUID, generated by php. I am using com_create_guid() function. So, before trying to insert I want to ensure that my parameters are valid. I can not find a way to check if a string(com_create_guid() returns string)...

PHP singleton pattern - question about extends

Just a quick question. I understand that Singleton patterns can be extended and that inheritance is applied. I was just wondering if I called a base class and then a extended class is there additional overhead than if I just called the extended class by itself? ...

Ajax login script header problem

Hi, I have a ajax login script, using prototype, where I ajax the credentials over to a php page that checks if the info is correct. If it is, I try to set a cookie and then return 0 or 1 depending if it is correct. The ajax call returns 0 if it is correct and then makes a js call on the original page to redirect into the site. I keep g...

In MVC, is it alright to have a library connect to a database and perform queries?

From the question itself: class User { public function getByName($username) { //queries here } public function getById($id) { //queries here } } ...

ffmpeg php image creation

hi im using this script link text but im not able to create the image my file is http://sahu.vipin.googlepages.com/thumb.php plz help ...

Controlling partial views re:Contact forms

Ok, so here's where I'm at. I've been studying MVC/OOP, trying to roll my own as an exercise. I think I've finally grepped the purpose of each letter in the MVC acronym - my question here pertains to a design decision. I've set up an FC of sorts - it takes parameters from the $_GET array and loads the appropriate sub-template into a ma...

how to find a variable is a type of array

How to find a variable is of type array in cakephp? thanks ...

orderby statements on multiple joins

Hi, I have three tables, each contain an auto-incrementing PK. I need to select the latest (ie, ORDERBY DESC) entries from the mix of these tables. I'd like to do it in one query, with two joins. My idea was is to somehow select a table, order it by id DESC, then somehow merge the results. Does anyone have a way (or probably a better id...

How to integrate Wordpress template with CodeIgniter

How can CodeIgniter and Wordpress be integrated such that the look and feel/template of the Wordpress blog is carried over to the CodeIgniter-created pages? ...

PHP Session/Cookie problems with Windows XP, Vista, IE and certain users...

Hi guys, I've mentioned it on here before, but still have the problem, so have added some extra info :) We have a local intranet site that everyone on the network uses, maybe 5% (or even less) of the users that use the site have problems where the session isn't stored properly. I've tried defining a path manually and whereas most user...

PHP, MYSQL and hyperlinks - linking from one page to another

I have 2 php pages. One returning the id of the last 10 records of a MYSQL query and another returning all field values for a specific record. Can anyone help me link the two so that when I click on say row 3 (id = 3) of the table in the first page it takes me to the second page using the id 3 in the MYSQL query utilised by the second pa...