php

What are some tips for a beginner PHP developer?

Hey all, what are some tips or tricks that new PHP developer's should follow. Good tutorials, best practices etc? Sam ...

"PHP has encountered an Access Violation at 16B357F9"

hi, I'm getting the following error when I visit a specific page of my website. It stopped to work suddenly, without changing any code. THe php code is the original Drupal installation code. PHP has encountered an Access Violation at 16B357F9 I'm using Drupal on IIS Server 6. All the rest of the website works. It might be a serv...

execute javascript before return in php

I do have a custom php script that validates captcha code and sends an email. If php script is sending a mail successfully then it returns "true". This is done by: if(!$Error){ echo "true"; exit; } Before returning true, I would like to execute a jQuery command that should refresh the captcha image. I shouldn't be doin...

PHP e-commerce site talking to internal database for stock / ordering?

Hi. I'm working on an e-commerce site (either bespoke with PHP, or using Drupal/Ubercart), and I'd like to investigate the site interacting with an internal (filemaker) database we use to manage stock and orders. Currently we manually transfer orders from the web site to our own database, and the site does not check or record changes in ...

How can I display the users profile pic using the facebook graph api?

Hi, I would like to display the users profile picture inside of my applications canvas page, is there a way to do that using the graph api? I know I can do it using FBML but I would also like to pass the profile pic to a flash game I am making, so I would have to get the profile pic from the api and send it as a variable, here is the co...

I want to do a sql update loop statement, by using the do--while in php

Hello, I want to loop the update statement, but it only loops once. Here is the code I am using: do { mysql_select_db($database_ll, $ll); $query_query= "update table set ex='$71[1]' where field='val'"; $query = mysql_query($query_query, $ll) or die(mysql_error()); $row_domain_all = mysql_fetch_assoc($query); } while (...

Simplest way do get started debugging PHP (Drupal)

What is the simplest way to get started with debugging and hit a specific line in a Drupal install? Generally? With Eclipse? (how difficult?) On Windows, knowing and having access to Visual Studio (How Difficult with Visual Studio?) (No Pay: Free or trial) Locally on Windows I am using the Acquia Drupal WAMP-stack. On the server Ub...

Kohanav3 ORM: calling where->find_all twice

When I do something like the following: $site = ORM::factory('site')->where('name', '=', 'Test Site')->find(); $users = $site->users; $deletedusers = $users->where('deleted', '=', '1')->find_all(); $nondeletedusers = $users->where('deleted', '=', '0')->find_all(); The contents of $deletedusers is correct, but the $nondeletedusers cont...

Regex to replace a string in HTML but not within a link or heading

I am looking for a regex to replace a given string in a html page but only if the string is not a part of the tag itself or appearing as text inside a link or a heading. Examples: Looking for 'replace_me' <p>You can replace_me just fine</p> OK <a href='replace_me'>replace_me</a> no match <h3>replace_me</h3> no match <a href='/test...

Publishing a post on users' wall by facebook app

Hello, I need to generate a picture from facebook user profile picture and post it to some users' walls. For instance, $attch = array( 'media' => array((array('type' => 'image', 'src' => 'https://graph.facebook.com/'.$uid.'/picture', 'href' => 'https://graph.facebook.com/'.$uid.'/picture/'))); 'src' => 'h...

fckeditor doesn't show in safari

I have a problem with fckeditor, it shows in all the browsers but doesn't show in safari. Does anybody have a solution? ...

Splitting html string after so many words

Hi all, I have a string that if it is longer than lets say 10 words, I want to split it into two parts. The second part will be included else-where after a 'more' link. The string will hold html tags too though. For an example the string could be: <p>This is just a test string with more words than the <strong>amount allow</strong> be...

Two RC4 implementations generated different encryption results

Why is encryption algorithm may give different results in AS3 and PHP? In AS3 I use library from http://labs.boulevart.be/index.php/2007/05/23/encryption-in-as2-and-as3/. And in PHP I use RC4 Cipher. Could some tell me what is the problem? Thanks. ...

Why is php_imagic extension removed from WampServer Version 2.0?

Is there any reason for this? ...

encoding changes when retrieving data with php from mysql table

Hi all! I have a very strange problem when retrieving data with php from a mysql table. Basically, two php files with the EXACT same content are given data with different encodings and i dunno why. Here's the code: $dbhost = 'localhost'; $dbuser = 'myuser'; $dbpass = 'mypass'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Er...

How do i show the rank on the table

Below is my code and i am wondering how to show the rank on the table.I have all the ranks but i cannot seem to get the rank to display from the highest to the lowest according to the totals. <?php require_once 'DB.php'; $dsn = array( 'phptype' => 'mysql', 'username' => 'root', 'password' => '', 'hostspec' => 'localhos...

PHP pathinfo gets fooled by url in quert string. Any workaround?

I am working on a small function to take in a url and return a relative path based on where it resides itself. If the url contains a path in the query string, pathinfo returns incorrect results. This is demonstrated by the code below: $p = 'http://localhost/demos/image_editor/dir_adjuster.php?u=http://localhost/demos/some/dir/afile.txt...

Installable ISAM not found

I have a requirement in which, i upload excel sheets to sql server database. The business logic is executed and display as reports in php. It is working fine till yesterday. Today i tried to upload excel files. It is throwing an error message stating:- The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" could not f...

Php random row help...

I've created some code that will return a random row, (well, all the rows in a random order) But i'm assuming its VERY uneffiecent and is gonna be a problem in a big database... Anyone know of a better way? Here is my current code: $count3 = 1; $count4 = 1; //Civilian stuff... $query = ("SELECT * FROM `*Table Name*` ORDER BY `Id` ASC"...

How to get the first n words from text stored in my DB in PHP?

Hi I need to know how to get the first n words from text stored in my DB in PHP? for example if there is some text in my DB like this one : "word1 word2 word3 word4 text one test four five" How I can get the first 4 or five words from this text? Thnks in Advance. ...