php

How to select specific part of an array when two arrays are returned?

In a while loop I have: $row = mysql_fetch_array($result) Held under $row are two arrays which when shown using print_r display the following: Array ( [4] => Post Content [value] => Post Content ) Array ( [4] => Post Title [value] => Post Title ) How can I choose "Post Content" and "Post Title" from the array without it being repe...

MySql Insert doesn't work when the website deployed on the host!

I'm using XAPP under windows and my website just working well! when I deployed it on the host server, it seems to be working normally, but the insert requests to MySql doesn't have any effect, nothing is changing on the database! Does anyone had this issue before? is there any configuration in MySql to make it accept insert requests? o...

Can anyone recommend a PHP book that follows good development principles?

I am looking for a set of solid, well written architectual PHP books. Are there any good ones? Book that cover PHP developing larger projects in PHP, not it's syntax or grammar. Books that outline concepts for the language, along with its benefits and its drawbacks. What I would like to learn is how best to use PHP for web development. ...

Good Editors for Web Development on OS X?

I'm getting started with web development on OS X need some good development tools, text editors...etc. I have XCode already but it doesn't seem geared towards editing the web technologies I will be using: xhtml, javascript, css, and php. So I am looking for some ideas. I know about TextMate, but am trying to avoid spending any $$$. Th...

Finding dead PHP5 classes/methods

Is there any tools to check for dead code for PHP5? Something like Scan classes with Reflection Follow "normal" code with token_get_all() and find variables with token T_NEW and then scan for method calls. Output something like classname (count of new declarations) methods (count of calls) ...

Using SMS Gateway API in PHP

i couldnt send sms using the following code, but i can sent sms using the same url, while i paste the url($murl) it into browser address bar connection timed out, takes too much time to execute, but no result what is the problem? $amount="500"; $d="23-03-09"; $mNumber="98689988898"; $mName="TEST"; $mMessage ="\"We have debited Rs.$...

String with Double quoted and Single quoted

i have a string with double quote like this $count = 5; $str = "result: $count"; echo $str; //result: 5 variable parsing work well, and my problem is $count var must be define later than $str $str = "result: $count"; $count = 5; echo $str; //result: So i will use single quote and ask a question here to finding a way to parse var w...

How Is PHP Done the Right Way?

I keep hearing about how often php results in lousy code and practices. Given these criticisms and popularity of the language, what are best practices (in general) to insure that these poor habits are avoided? Following frameworks? Does it matter? ...

how to map enum with the string or viceversa in order to save into database??

I have in my database a coloumn say agent which can have enum values ('G','Y','M') where G= google Y= yahoo M= msn how should i map the output coming from my function i.e google as G in my code so that database recognise it and saves it?? ...

Creating a flexible update query

Hello, I'm trying to create an flexible update query. I have now something like this: $lsQuery = "UPDATE `"; $lsQuery .= $psTableName; $lsQuery .= " SET "; foreach($psValues as $lsKey => $lsValue) { $lsQuery .= $lsKey; $lsQuery .= " = '"; $lsQuery .= $lsValue; $lsQuery .= "' AND "; } $lsQuery .= "` "; $l...

Odd Mysql issue on insert.

Hy all, Not sure what's going on here, but if I run this: $query = 'INSERT INTO users (`id`, `first_name`, `second_name`, `register_date`, `lastlogin_date`) VALUES ("'. $user_id . '", "' . $first_name .'", "'. $second_name . '", "' . $date . '", "' . $date . ");'; $result = mysql_query($query); I get no return, but if I change it...

Dynamically Query a Database to check for value.

I need to check if a certain value "SheetNumber" is in my mysql database dynamically. I have seen it done on popular web sites and I am trying to find a good tutorial to outline it for me. I am fairly new to Javascript but i know a lot of PHP. I am anxious to learn how to do this. Chris ...

APC for windows alternative download

I am trying to install APC on windows but the site http://pecl4win.php.net/ is down for a while now with the message: The pecl4win build box is temporarily out of service. We're preparing a new build system. Is there an alternative download for this ? Or can anyone share theirs ? ...

What's your 'no framework' PHP framework?

Even with a ton of PHP frameworks out there to choose from, I know many people prefer a minimal, personal set of libraries. What is your method when it comes to 'rolling your own' framework for PHP applications, and how does it vary depending on the type/scope of a project? What does your script look like for a typical page? What is yo...

Possible JOIN for this query

I have this query: $sql = "SELECT updates.u_id AS u_id, updates.date_submitted AS date_submitted, updates.deadline AS deadline, updates.description AS description, updates.priority AS priority, pages.page_name AS page_name, clients.fname AS fname, clients.lname AS lname, projects.p_...

PHP game update

Hi, Say I have a game in PHP which is a money making game and everyday the prices on items change on the market. How would I make it so the prices in the database are automatically updated each day? Would I install a program on the server that detects when it has gone 24 hours then runs a PHP file which does the updating? Or os there a...

What is the best way to add two strings together?

I read somewehere (I thought on codinghorror) that it is bad practice to add strings together as if they are numbers, since like numbers, strings cannot be changed. Thus, adding them together creates a new string. So, I was wondering, what is the best way to add two strings together, when focusing on performance? Which of these four is ...

Best way to implement conditional in a PHP templating system?

I'm creating a very simple PHP templating system for a custom CMS/news system. Each article has the intro and the full content (if applicable). I want to have a conditional of the form: {continue}click to continue{/continue} So if it's possible to continue, the text "click to continue" will display, otherwise, don't display this whole...

Most efficient way to retrieve the source of a website through PHP? (GET Request)

I know that file_get_contents can be used to retrieve the source of a webpage, but I want to know the most efficient way. I have an old class I made a long time ago that uses something like this: $this->socket = fsockopen($this->host, 80); fputs($this->socket, 'GET ' . $this->target . ' HTTP/1.0' . "\n"); fputs($this->socket, '...

How can you view ASP.NET Session State in a different platform like PHP?

Say I have an ASP.NET webpage and I also have a PHP Blog/BBS/Website. I want all logins to be done via the ASP.NET webpage. The ASP.NET Session State is stored in SQL. Is there any way I can read/decode the Session State from PHP to tell if a user is logged on if I have the Session State cookie? ...