I need to be able to parse this sort of data in PHP:
Acct: 1
email : [email protected]
status : online
--------------------------------------------------
Acct: 2
email : [email protected]
status : banned
--------------------------------------------------
Acct: 3
signedupname : SomeUsername
...
Hey guys,
I'm a designer (starting to learn PHP/MySQL) and am need in an eCommerce platform (it does not have to be free) that will allow me to create a comprehensive eCommerce site--countdown promotions, related products, user reviews, payment/shipping processing, etc. Basically just populating it with products, and styling the pages.
...
So, I don't come from a huge PHP background—and I was wondering if in well formed code, one should use the 'superglobals' directly, e.g. in the middle of some function say $_SESSION['x'] = 'y'; or if, like I'd normally do with variables, it's better to send them as arguments that can be used from there, e.g:
class Doer {
private $se...
I need to set value in mapped record to some arbitrary sql expression, so on obj.save() it would be used directly, w/out escaping/quoting.
Something like this:
obj.location = "Point($x, $y)";
obj.save();
Which should result in query like UPDATE ... SET location = Point(..., ...) WHERE ...;
However I cannot find anything like this i...
I'm making a site that will be translated into x languages.
All strings must be localized.
There are occasions when I need to display a language name, country name or other information that has been retrieved from a database. The data being dealt with in this way will seldom be changed - as above I'm talking about language names, count...
Hello,
I am trying to upload an image file to piczasso.com from python. My code is as follows:
import urllib,urllib2
url='http://piczasso.com/api_handler.php'
values = { 'data':open('./imagefile.jpg'),
'tags':'',
'size':'None'
}
data = urllib.urlencode(values)
req = urllib2.Request(url,data)
try:
respons...
I've got a couple of affiliate sites and would like to bring together the earnings reports from several Amazon sites into one place, for easier viewing and analysis.
I get the impression that cURL can be used to get external webpage content, which I could then scrape to obtain the necessary info. However, I've hit a wall in trying to lo...
I'm going to build a wee batch search field where someone can enter/paste in a bunch of keywords separated by a linebreak, they might be copied in from excel, word or where-ever.
So I plan to use php to explode() that input and loop through it for an SQL search.
Do I need to do anything special to reliably detect the line breaks - my u...
I've got an Abstract PHP superclass, which contains code that needs to know which subclass its running under.
class Foo {
static function _get_class_name() {
return get_called_class();
//works in PHP 5.3.*, but not in PHP 5.2.*
}
static function other_code() {
//needs to know
echo self::_get_...
Hello,
The PHP code below returns dates in this format:
July 27, 2010 7:36 pm
How could I make it return dates with capital letters? Here's what I want;
JULY 27, 2010 7:36 PM
Thanks in advance,
John
The PHP code:
format('F j, Y &\nb\sp &\nb\sp g:i a')
...
I'm trying to display a link orange when clicked but for some reason I can get it to work when using PHP can some one help me correct this problem?
Here is the PHP code.
function category_tree( $parent = 0, $parent_url = '' ){
$page_url = current_page_url();//grabs url address
echo "<ol>";
$mysqli = mysqli_connect("localho...
Hi,
I want to have the regular expression that makes sure the beginning of the string contains 'http://' and '/' and the end.
This is a longer version I came up with,
if(!preg_match("/(^http:\/\//", $site_http))
{
$error = true;
echo '<error elementid="site_http" message="site_http - Your link appears to be invalid. Please confirm ...
Hey guys. I am somewhat new to jQuery and javascript in general. What I have is a CMS that I am upgrading. In doing so, I have started an option to delete multiple categories at once via checkboxes, which is processed via jquery/ajax.
In deleting the records individually, I could remove the row of the table once deleted, but now with ...
I don't know what is going on, but it just doesn't want to work.
I keep getting this error when I submit my form:
Array ( [0] => Array ( [0] => 22001 [SQLSTATE] => 22001 [1] => 8152 [code] => 8152 [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]String or binary data would be truncated. [message] => [Microsoft][SQL Serve...
I am using google visualization api for my php-based website. I am planning to use tcpdf to give a pdf version of the same images that i am generating using Google Visualization API.
is there any way to save these visualizations on my server so that i use them directly in the tcpdf?
If not then can i automatically take screenshots of t...
How would I make an associative array (or some comparable alternative) in jQuery AND send that array via ajax to a php page so that I can use php to handle it?
Something like this...
// jQuery
if($something == true) {
data[alt] = $(this).attr('alt');
data[src] = $(this).attr('src');
else if ($something == "something else") {
...
Does anyone have any examples or know of any resources that show how to implement set theory operations in pure php?
...
I'm using the following code from PHPBuilder.com to handle user privileges on my site:
/**
* Correct the variables stored in array.
* @param integer $mask Integer of the bit
* @return array
*/
function bitMask($mask = 0) {
if(!is_numeric($mask)) {
return array();
}
$return = array();
while ($mask > 0...
I just can't figure this out, for some reason this:
$string = "#mainparent {
position: relative;
top: 100px;
left: 100px;
width:4994px;
}";
$elementwidth = "88";
$re1='(.*?)'; # Non-greedy match on filler
$re2='(mainparent)'; # Word 1
$re3='(.*)'; # Non-greedy match on filler
$re4='(width:)';
$re5='(.*)'; # Word 2
$re6=...
Hi all,
I can't get nl2br function to work after fetching data from my DB...
$result = mysql_query("SELECT comments..etc.etc..");
while ($row = mysql_fetch_array($result))
{
echo nl2br($row["comments"]);
}
In DB row comments:
\r\nThanks,\r\n
OUTPUT:
Same as in DB:
\r\nThanks,\r\n
If I simply test this out like so it works f...