php

Cannot combine 2 tables in CSV export

Here is the code I have came up for this problem. $link = mysql_connect($host, $user, $pass) or die("Can not connect to the host." . mysql_error()); mysql_select_db($db) or die("Can not connect to the particular database."); $result = mysql_query("SHOW COLUMNS FROM ".$table.""); $i = 0; if (mysql_num_rows($result) > 0) { while ($r...

Send parameters to a php file in different language

Hi all, I am querying a php script using js with following func call: $.post("http://localhost/abc/create.php",{ name:data } ,function(data){ alert(data); }); Now this name parameter can be in any language, eg: english, hindi etc.. my code is working fine for english. But it is not working for hindi. When i am...

Getting time in seconds

<?php $target = mktime(0, 0, 0, 10, 25, 2010) ; $today = time () ; $difference =($target-$today) ; echo $output = $difference/60 ; ?> will the above code give time in seconds ...

PhP Mail script - Error generate 'FOR loop script' in the $message variable

How do i add the php for loop script to generate the content on the email (pick up from Database) as highlighted below? $message = " <html> <head> <title>Your's Weekly Newsletter </title> </head> <body> <p>Hi $to,</p> <p>Here are the highlight of the deals this week:</p> <br /> <p> **<?php for ($i=0;$i<=$totalCount;$i++) { ec...

Regex PCRE: validate string that does not contains 3 or more consecutive digits

I've searched the questions but can't find an answer. I need a pattern that, used with php preg_match function, only match strings that does not contains 3 or more consecutive digits, e.g.: rrfefzef => TRUE rrfef12ze1 => TRUE rrfef1zef1 => TRUE rrf12efzef231 => FALSE rrf2341efzef231 => FALSE So far, I have wrote the...

mysql match against query

Hello, I am using mysql match against query in my search query like this way MATCH(film_name) AGAINST ('the vacation' IN BOOLEAN MODE). But previously i use this one film_name like '%the vacation%' So my question is that i am getting the right result now by using match and against but the problem is that when i am using like ther...

Replace unicode character

Hi there. I am trying to replace a certain character in a string with another. They are quite obscure latin characters. I want to replace character (hex) 259 with 4d9, so I tried this: str_replace("\x02\x59","\x04\xd9",$string); This didn't work. How do I go about this? ...

Understanding Session Time-out (php)

I need to delete old user datas in the DB, if user session is timeout. How can I solve this problem with using PHP? ...

PHP SoapClient - Returning attribute values in a response

I'm attempting to get values from a webservice. The responce is formated as.. <campaign Id="200"> <name> test </name> </campaign> PHP Code SoapClient( "WSDL"); $return = $client->GetCampaigns('Username', 'Password' ); Yet when I attempt to access the return, I get just a stdClass with the name attribute.. public 'Campaign' =>...

Uploading Photos from Hard Drive to Facebook using the API

Hi, wondering if anyone can help me. I've been searching for a few days for help on how to publish photos to Facebook using the API. I came across the following script that seems to work for everyone however I am unsure how to connect this to a form where users can select the photo from their hard drive and upload it. Can anyone point me...

How to add an HTML class to a PHP script

Hi, First off, I don't know much (quite nothing) about PHP. I'm more familiar with CSS. I'm making use of Ben Ward script Tumblr2Wordpress (here's the script on GitHub) to export my Tumblr blog in XML (so I can import it in my Wordpress blog). This script reads tumblr's API, queries elements, do a bit of formatting and export the whole...

Google Map not showing up

I need to implement on my php page map. I have container <div id="map"></div> which is inside other div, and I put this code inside <head> tag but it doesn't show at all. Can anybody help me? <script type="text/javascript" src="javascript/jquery-1.4.3.js"></script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?s...

How to automate my cron php script.

I'm using PHP and was wondering how can i run my PHP script to run at midnight and check if a member has been inactive for six months if so delete. ...

What is the right way to create tabs and line breaks in PHP when using single quotes?

Hi, Seems like a simple question, but I haven't been able to find a solid answer anywhere. I'm outputting a ton of HTML and find escaping "s to be error prone and hard to read, but I also want to have my HTML formatted nicely. Want something like this (though I know this won't worK): echo '<div id="test">\n'; echo '\t<div id="test-s...

Why don't PHP attributes allow functions?

I'm pretty new to PHP, but I've been programming in similar languages for years. I was flummoxed by the following: class Foo { public $path = array( realpath(".") ); } It produced a syntax error: Parse error: syntax error, unexpected '(', expecting ')' in test.php on line 5 which is the realpath call. But this works ...

How can I check a date from a mysql database `2010-10-18 07:44:53` against a future date using PHP?

I was wondering how would my PHP code look like when I do this? ...

insert php array into mysql

I have an array $product_array, and when I use print_r($product_array);. The array shows like this Array ( [0] => Array ( [ID] => P00100 [NAME] => Edina [PRICE] => $20.00 ) [1] => Array ( [ID] => P00101 [NAME] => Richfield [PRICE] => $21.00 ) [2] =...

Magento generate order number before save

the default format of the order number in magento is "100000001", but i need to generate my self the number of the order, to a get diferent format and can use it before save the order in some validations of the payment method, so, how can i generate the order number and then save it with the orther in the DB?? thanks ...

using php, how would I convert all rows of a char field such as "11/19/10" to a date field?

In order to import a column of dates into mysql using phpmyadmin, I defined the field as a char field. So now the dates are in a mysql table look like this: ID | Name | DateArriving 1 | bill | 11/19/10 2 | tom | 12/1/10 etc.... I want the DateArriving field to be formated as actual dates so I can do certain queries such as "who ...

Simplest way to read an csv file using php

Hello, What would be the most simple way to read a csv file using php Here is the code, the problem here is, it reads everything in one line $row = 1; if (($handle = fopen("1.csv", "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); echo "<p> $num fields in line $row: <...