php

PHP , What is the difference between fopen r+ and r ! does it matter if i used r+ when not intending to write

when I use fopen function , why don't I use r+ always , even when I'm not going to write any thing ... is there a reason for separating writing/reading process from only reading .. like , the file is locked for reading when I use r+ , because i might write new data into it or something ... another question : in php manual a+ : Ope...

PHP, javascript, single quote problems with IE when passing variable from ajax post to javascript function

Hi! I have been trying to get this to work for a while, and I suspect there's an easy solution that I just can't find. My head feels like jelly and I would really appreciate any help. My main page.php makes a .post() to backend.php and fetches a list of cities which it echoes in the form of: <li onclick="script('$data');">$data</li> ...

Getting an error on my foreach loop

Here is the code: <?php //Starting session session_start(); //Includes mass includes containing all the files needed to execute the full script //Also shows homepage elements without customs require_once ('includes/mass.php'); $username = $_SESSION['username']; if (isset($username)) { //Query database for the users networths ...

Importing data and keeping ids and relationships

I am working on cleaning up a mess that another programmer started. The created 2 identical databases for different locations but that obviously caused major issues. They are using cakePHP and there are quite a few relationships. I am pretty sure I will have to write a script to import that data from on DB to the other and keep all th...

WordPress update_post_meta values. Delete when empty or just test for ""?

My function below, will take the values from my custom meta fields (after a post has been edited, and save or publish has been clicked) and update or insert the posted meta values. However, if the user leaves this field blank, I believe I want to delete the meta altogether (so I can test for its presence and display accordingly vs just ...

Converting a string to a mySql DECIMAL type

I am trying to insert data about an item's price from an HTML form into a mySQL database. The input field is defined as follows: <input type="text" name="price" value="0.00"/> The form is POSTed to the next page in which the database stuff is taken care of. Currently I just enter the exact contents of $_POST['price'] into the database...

How to parse rss from a php page, using jQuery/jFeed?

I'm trying to fumble my way through parsing rss sensibly, using jQuery and jFeed. Because of the same origin policy I'm pulling the BBC's health news feed into a local page (http://www.davidrhysthomas.co.uk/play/proxy.php). Originally this was just the same proxy.php script as available in the jFeed download package, but due to my host...

PHP "You have () new comments on your clip", how?

Hello. I want to do a function to my users, so on index.php there is e.g: You have 2 new comments on your clip How should i do this? I mean i want ideas to do this the easiest way. Table for the videos is member_videos, and tables for the comment is member_videocomments, a comment inside the table is connected by their "videoID", whi...

PDO Prepare statement not processing parameters

I've exhausted all efforts at what appears to be a trivial problem, but gotten nowhere. There is a simple Prepare statement: $qry = $core->db->prepare("SELECT * FROM users WHERE email = '?'"); $qry->execute(array('[email protected]')); However, no rows are returned. Running the query with the parameters hardcoded into the query resul...

Looping though a while statement

Hi I have a sequence of mysql query result resources stored in a array. E.G array([0] => resource [1] => resource ...ect); This code retrieves the first resource in the array: $third_count = "0"; while ($user_result = mysql_fetch_array($user[$third_count])) { print_r($user_result); } $third_count = $third_count +1; I'm just stuck t...

php recursion global variable?

I have a recursion function that parses an object/array with a global variable. If I comment out the global variable I get nothing but if I leave it in it keeps adding to the array other values that should be in it own result set. Do I need to change something here? UPDATE #2: How can I get the return I want, I thought I was pushing all...

Using NetBeans for PHP, outputting XML rather than HTML, Netbeans sees errors

I'm using NetBeans to develop a PHP app, and it works just fine for any PHP pages which output HTML. However, some of my PHP scripts output XML and (more specifically) KML. NetBeans doesn't seem to understand this, and I get a load of "invalid content" errors in the IDE, as it expects me to be outputting proper HTML code. Is there som...

php while loop throwing a error over a $var < 10 statement

Okay, so for some reason this is giving me a error as seen here: http://prime.programming-designs.com/test_forum/viewboard.php?board=0 However if I take away the '&& $cur_row < 10' it works fine. Why is the '&& $cur_row < 10' causing me a problem? $sql_result = mysql_query("SELECT post, name, trip, Thread FROM (SELECT MIN(ID) AS min_i...

Best Practices For Secure APIs?

Let's say I have a website that has a lot of information on our products. I'd like some of our customers (including us!) to be able to look up our products for various methods, including: 1) Pulling data from AJAX calls that return data in cool, JavaScripty-ways 2) Creating iPhone applications that use that data; 3) Having other we...

Get information from PayPal after a transaction

I want to create a simple transaction on my Web Site where after the person's transaction completes, I want paypal to redirect the user to go to a place on my site and I want PayPal to provide me with details so I can use PHP to parse it and email them the link to their purchase. I'm not sure what notify_url does? Thanks ...

PHPExcel feature question

I want to know if PHPExcel can: Create Excel spreadsheets with embeded image. The image must be compressed (jpeg, png, gif...). Create Excel spreadsheets for different Excel versions (2000, 2003, 2007...). I'm pretty sure it can do this but I can't find it in the official docs. Anyone familiar with this class can help? Thanks! ...

php background job cause exception on memory_limit

if i have a php background job, may need to run 4-5hours or more will it cause exception on memory_limit ...

Is there a better way to keep track of session variable creation/access throughout different pages?

Here's what I am working on. At my website I have multiple processes with each one containing multiple steps. Now in one of the processes, there is an error checking routine executed before proceeding to the next step of that process. A session var is set indicating the error status and it will either redirect back to the referrer or dis...

Longer Form Fields in Drupal

I have a really silly problem that has cost me a load of time already. I have created a content template with a URL in there. When I look at the HTML code for it, I see a big fat "maxlength=256" in the form tag. I'd like to expand the length of this field, because my customer wishes to enter really long links (over 500 characters). Any...

PHP How to create comma separated list from array?

Hi All, I know how to loop through items of an array using foreach and append a comma, but it's always a pain having to take off the final comma. Is there an easy PHP way of doing it? $fruit = array('apple', 'banana', 'pear', 'grape'); Ultimately I want $result = "apple, banana, pear, grape" ...