php

PHP Regex Match parentheses

I am trying do a search to make sure that each of our product titles contains its manufacturer code. I am using preg_match but am getting some weird results back. Here is a snippet of code I wrote to go through the array of products... while($row = mysql_fetch_array($result)) { $products[''.$row[0].''][0] = $r...

Calculate average without being thrown by strays

I am trying to calculate an average without being thrown off by a small set of far off numbers (ie, 1,2,1,2,3,4,50) the single 50 will throw off the entire average. If I have a list of numbers like so: 19,20,21,21,22,30,60,60 The average is 31 The median is 30 The mode is 21 & 60 (averaged to 40.5) But anyone can see that the ...

URL rewritten pages force browser to reload page?

We have a server which has ScriptA.php, ScriptB.php and ScriptC.php which all contain text/images that are 80% similar. We're using .htaccess to do url rewriting on ScriptC.php and we're noticing a performance slow down when it loads where it appears that the browser is loading the content afresh every time. When I click on a link to S...

My variable seems to temporarily be losing its value

I am having trouble with the following script: After setting my $pageurl variable it loses its value for the first time I try to call it and then it regains its value the second time I call it. In the beginning IF structure I set the variable $pageurl to the page variable in my querystring. This works fine, but later in the script whe...

PHP, cUrl and ASP

I'm tryng to get data using PHP's cUrl extension. The page runs ASP. I do two cUrl requests, the first one to get Models, and the second one to get the Model Age. I don't know why, but __EVENTVALIDATION is the same in both requests. I'm posting the following data: Array ( [ScriptManager1] => UdtMarca|ddlMarca [ddlAnoValor] => 0 ...

Table Replacing PREG Exp Help

Hello, I have a bunch of tables of data and I need to add a php function to them. The following is what the data normally looks like <TR class="tr7"> <TD class="td70"><FONT class="ft5">Chateauguay</FONT></TD> <TD class="td71">&nbsp;</TD> <TD class="td72">80</TD> <TD class="td73">&nbsp;</TD> <TD class="td74">180</TD> <TD class="td...

refresh html page when a new sql entry has been inputted

So I have an external script that will sometimes input something into a sql database throughout the day (usually about 3 times a day, but could potentially update ever minute) I need to find a way to make the html page (that displays the sql entries) refresh automatically when there is a new entry that's added. Any suggestions for PHP an...

Zend doesn't seem to want to load the form I've created

Hey, I seem to be climbing a pretty horrible learning curve. It's taking me hours to even get to the point where I can structure/write code. I originally wanted to be able to store a form or a model inside its respective module, for example: ./application/module/ModuleName/forms/ClassName.php but when I tried to instantiate a class w...

How can I get all values of a mysql table in JSON from a php script?

This is php script that fetches a table values from mysql (one row). & echoes it as JSON <?php $username = "user"; $password = "********"; $hostname = "localhost"; $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("spec",...

Facebook Authentication, IFrame and Variable Passing Help

I am currently using this recently written tutorial on authorizing an application with facebook using auth 2.0 and it works. the application authorizes correctly and uses the GraphAPI. http://kartiklad.com/oauth-2-0-and-graph-api-for-facebook-canvas-applications/ But the problem is using the IFrame with a multi page website and this me...

php site w Google Form embedded

i have a php site in development wh runs fine. i have included a google spreadsheet form in it via the iframe tags that Google ask you to copy and paste the spreadsheet form is obviously there for users to use. it would be all be so great but I can't see how to get the users id from the parent page into the google form via the iframe...

Accessing template variables from outside PHPBB

Hello everyone ;) I'm developing a website and I want to use PHPBB auth system. I managed to get it working pretty well, following a few suggestions I found on this website, but I've got a problem. Basically all I need to do is accessing template variables such as {U_PROFILE}, {L_PROFILE}, {U_PRIVATEMSGS}, {PRIVATE_MESSAGE_INFO} and othe...

Problem with short date format in php

Hi, I have problem with date function in php. If I supply string in format "d.m.y" for example "01.01.01" it gets rendered as todays date which means that php gets confused. I found: Note: The "Day, month and two digit year, with dots or tabs" format (dd [.\t] mm "." yy) only works for the year values 61 (inclusive) to 99 (...

PHPMailer - Double Opt In - Spam - Confirm script and multiple email addresses

Hi, I have written a script for my clients to generate a newsletter form, embed it on their website, collect email addresses and then email them using a php while and PHPMailer. Currently, the script uses a "double opt in" which sends an email from "[email protected]" to the subscriber to click on a confirm link that then go...

How to display all images from a WordPress post?

I'm trying to get all images from a WP post to create a slideshow from them. Googled around and found this piece of code to retrieve and display images from a post: function getImage($num) { global $more; $more = 1; $link = get_permalink(); $content = get_the_content(); $count = substr_count($content, '<img'); $s...

Error on specific search query.

Hi I have a website ongrounds.com there is a search bar on top when ever I search for word "best" it generates following error Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s) AS relevance FROM hotaru_posts WHERE (post_status = %s OR ...

PHP compress files into zip

Hello there okay so this is the deal i have a folder where my mp3 files are stored for single download, and now i want a feature where you can download all the mp3s at once in a zipped folder. Is it possible to zip all the files from that folder using php ( or anything really but if not PHP then please explain thoroughly) or would i have...

replacing letters (from a phrase) with images

$q = "my phrase with special chars like úção!?"; while ($i < strlen($q)) { echo '<img src="'.$q[$i].'.png" />'; $i++; } i also tried with switch/case but when i have chars like ç Ç ã â i cant get the image replacing to work since its more than one char (i was converting to html entities and then searching in the case ccedil but its ...

What are some good, fast persistant storage options for key->value data?

For a small PHP app I am writing, we need to store a large number of records that have a hash key, and a few simple field values ('host', 'path'). eg: '4420ffb32a' => array( 'host' => '127.0.0.1', 'path' => 'path/to/resource', ); What is the best persistent storage for data like this? Would MySQL be the best choice, or is it overk...

Fatal error - execute() php 5.2.13

Hello there, I have PHP 5.2.3, apache2.x, mysql 5.x on a Linux machine. EVerything was working fine untill yesterday. This morning all of a sudden one of the php files started to throw "Fatal error: Call to a member function execute() on a non-object in". I use PDO (prepare, execute, close cursor etc). Have you ever come across this ...