php

Can't select database table even though the code is right

I am trying to display a list of my vbulliten threads on a non-vbulliten portion of my site. However I can't select the vbulliten database: <?php $host = "localhost"; $user = "my username"; $pass = "my password"; $dbname = "tableprefix_forum"; mysql_connect($host, $user, $pass) or die ("Could not connect to database server."); m...

ZipArchive php Class - Is it built-in to PHP?

Ok, just wondering on the versions of PHP that this class is built into. And if they are built into all platforms (OS's). I'm wanting an approach to search through a zip file and place files using file_put_contents in different filepaths within the webroot. In any case, I'm familiar with how to do this with the ZipArchive class, but I...

Eclipse PDT - Javascript Code Assist is not work?

I have try PDT 2.1.2 and 2.2 nighty build , both of them , javascript code assist is not work when editing php file. I have check the JSDT,WTP Plugin is loaded and no error. But when i open a *.js file, it works , is it any configuration i miss? ...

Using md5_file(); doesn't return the md5 sometimes?

<?php include_once('booter/login/includes/db.php'); $query="SELECT * FROM shells"; $result=mysql_query($query); while($row=mysql_fetch_array($result, MYSQL_ASSOC)){ $hash = @md5_file($row['url']); echo $hash . "<br>"; } ?> The above is my code. Usually it works flawlessly on most urls, but every now and then it will just skip the...

SQL select statement with increment

Currently I'm using a for statement in PHP to get all the months for this SQL statement, but would like to know if I can do it all with SQL. Basically I have to get the average listing price, and the average selling price for each month going back 1 year where the sellingdate = the month. simple with PHP, but that creates 12 database ...

How to preserve &amp; in <pre><code>

I am having trouble preserving an ampersand in a code example on my blog, because all HTML entities start with &. Any tips? For example: <pre> <code> <?php $pageTitle = str_replace('&', ' &amp;', $page->attributes()->title); ?> </code> </pre> Renders as: <?php $pageTitle = str_replace('&', '&', $page->attributes()->title); ?> ...

I changed index.html to index.php and now the page doesn't load!

It gives me the following message: The requested URL /cgi-sys/php-cgiwrap/gcadmin/php5.cgi/projects/globalcolleage/index.php was not found on this server. Any suggestions? (I'm using WAMP) I think it has something to do with this hthaccess file: IndexIgnore * DirectoryIndex index.html index.HTML index.shtml index.cgi index.p...

XMLHttpRequest() and outputting csv file

I can successfully generate a csv file by issuing an html form POST to a new window and use PHP to respond with: header('Content-type: text/csv'); header('Content-Disposition: attachment; filename="'.date("Ymdhis").'.csv"'); print get_lines(); However, this leaves the the window open and blank. I want to either close the window autom...

Can't change Joomla Default language

On this site http://www.bostonteaclub.com I want the default language to be Chinese. I set the default language to Chinese in the backend (it's got the star next to it) but when you went to the page you probably noticed that the site is displaying in english. If you check the source code you will see on the very bottom hidden a var_...

Comment Author Link on Wordpress

Hello, At the wordpress form, when you leave comment as guest, there's a website field to fill your web address. If we fill in that box, we can get the link by calling this function <?php echo get_comment_author_link(); ?> But if you are logged in and you don't add the website at your profile, when you leave comment. It doesn't have ...

PHP function similar to this JavaScript function

I need a similar function in PHP for this JavaScript function text = text.replace(/ffc/g, "Hello"); I think preg_replace will do, but i'm not sure how to write the expression.. I want the regular expression similar to "/ffc/g" which is above, What I need exactly is to match the full word and case when performing the replace... Thank...

how to replace the backslash in php to xml?

I'm trying to create a xml file from php.... it is not work properly... when i eentered \notepad\text ,it creates in xml file as otepad ext.... what's the solution for this problem? can i use any function to this? ...

insert Query is not executing, help me in tracking the problem

I tried the below query but it didnt executed giving error as : > #1064 - 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 ')' at line 1 . INSERT INTO `jos_menu` SET params = 'orderby= show_noauth= show_title= link_titles= show_intro= show_...

Scalability of Ruby on Rails versus PHP

Can anyone comment on which is more scalable between RoR and PHP? I have heard that RoR is less scalable than PHP since RoR has a little more overhead with its MVC framework while PHP is more low level and lighter. This is a bit vague - can anyone explain better? ...

Determine week number based on starting date

I need help to create a function to determine the week number based on these 2 parameters: Starting date Specified date For example, if I specify April 7, 2010 as the starting date & passed April 20, 2010 as the date to lookup, I would like the function to return WEEK 2. Another example, if I set March 6, 2010 as starting date and lo...

Separate seeds in PHPUnit

How do I create a separate seed for some test inside one test class? PHPUnit documentation includes this example <?php require_once 'PHPUnit/Extensions/Database/TestCase.php'; class DatabaseTest extends PHPUnit_Extensions_Database_TestCase { protected function getConnection() { $pdo = new PDO('mysql:host=localhost;dbna...

using php Download File From a given URL by passing username and password for http authentication

Hi all, I need to download a text file using php code. The file is having http authentication. What procedure I should use for this. Should I use fsocketopen or curl or Is there any other way to do this? I am using fsocketopen but it does not seem to work. $fp=fsockopen("www.example.com",80,$errno,$errorstr); $out = "GET abcdata/feed...

Magento and configurable product attributes

I have an issue with displaying product custom attributes. I've read every resources through google but still no success. The problem is that I have to show size attribute of configurable product on category grid and list view. Every solution on google suggested something like $_product->getAttributeText('size') but I ended up at just...

PHP generating csv not sending correct new line feeds

I have a script that generates a csv file using the following code: header('Content-type: text/csv'); header('Content-Disposition: attachment; filename="'.date("Ymdhis").'.csv"'); print $content; The $content variable simply contains lines with fields separated by commas and then finalised with ."\n"; to generate a new line. When I o...

IDE for php prado

iam looking for IDE with intellisense support for PHP Prado. please suggest me some ide's. ...