php

PHP imagejpeg() problems

I had an image upload script that worked on my little shared hosting, but just as I switched to Virt Ded, it immediately stopped working. After some research I determined the culprit to be the PHP function imagejpeg() - which was the last bit of code in the script. It allows me to specify null as the filepath (in which case it prints it...

paypal ipn trouble: Thank you for your payment and doesn't redirect back to my site.

I am using sandbox mode. I click buy item on my shop, and after i pay with sanndbox account it takes me to "Thank you for your payment - Paypal" but doesn't redirect back to my site! I already have IPN setup! I dont understand, do I need to contact paypal first ? or is there some section on paypal where you can enter your shopping sit...

Should I store country names in mysql for each user?

Below is a PHP array I have, it has Countries list 1 to 228 with name and a number for that country. I used this on an old project where in the mysql DB I saved a user's country as a number and then I could use this array to avoid doing another mysql query on pages. Now I am doing a different site where performace is important. W...

Easy way to check if a page view is unique?

Hey guys, im building a small product catalog for a client. I am currently trying to figure out how to go about allowing the user to sort by "popularity". I figured the easiest/simplest way to do this would be by having a "views" field in each product record. Originally I didn't think this through (duh) and thought I would just add on...

Calling Parent Class Methods

Question edited to better reflect my needs. Take the following example: class Base { public $Text = null; public function __construct() { $this->Text = new Base_Text(); } } class Base_Text extends Base { public $Is = null; public function __construct() { $this->Is = new Base_Text_Is(); ...

why are all mails sent via php's mail() go to spam box but not mails sent directly from the domain's account ?

I have a small email confirmation form. I was testing it and everytime I enter my email and go to verify it, it's in the spam box. I have tested it with multiple accounts and getting complaints about this issue as well. When I login to my domain's mailbox and send emails to my users, they go straight to the inbox.... what is wrong with...

Retrieve the text between A tags

I'm trying to retrieve link text from an HTML file. Each of the link have a specific class applied to them, but the urls are different. I have the following: ... <a class="fetch-me" href="products/1">Find ME!!!</a> ... <a class="fetch-me" href="products/2">Me too!</a> ... I am using the following PHP code, but always getting more th...

PHP SQL Server Database Select

I have three SQL Server databases on one SQL Server instance. Every time I do query to different databases, I have to select the database. Is there a way to do query without database select. Like this: SELECT * FROM database_name.table_name WHERE id = 1 ...

php mail() sends straight to SPAM box

<?php $to = '[email protected]'; $from = '[email protected]'; $message = 'blah blah blah'; $subject = 'yadda yadda yadda'; mail($to, $message, $subject, "From: $from", "-f$from"); I am on a dedicated linux machine. I have a named based virtual host setup on apache2. i have 2 domains running on the same ip. Anyway I can edit options or some...

displaying array in tree format

Its a simple problem but I think i am stuck..I need to get the array's elements to be displayed in a tree format in php.. the array elements will be fetched from the database.. ...

Jquery text field populating from database on clicking select option

I'am having a select option box,if i click on the select option,two other text below it should be loaded with data from database,based on select option id value.How to do this with php and jquery or cakephp and jquery thanks in advance ...

special characters within a variable

Can I store a special character inside a variable? I mean something like: <?php $variable='&nbsp;&nbsp;' Then can i use something like echo $variable? ...

In what circumstances should you serialize data? When should you not?

I'm aware that serializing is used to convert data types into a storable format, for purposes such as caching. What I'm more specifically asking is, what are the circumstances in which you should actually decide to store data ( using serialize() in PHP, pickle module in Python, et cetera )? Let's say we had a high traffic websi...

On-The-Fly Image Generation in PHP

I'm developing a script that will allow people to generate a banner for them to use. It's customizable. During the customization process, I'd like to be able to have the banner reload on the spot. So they could see the changes. Once they create the banner and are completely done with it I would give them a link for them to use. This link...

PHP Omit Variables from Serialization

Is it possible to omit certain variables from serialization? Say I have a temporary variable in a php object that I don't want serialized as it is a waste of space. The only thing I can think of is making them static but this is not ideal as it is not really part of the object which there will be many instances of. This may not even be ...

Split records into two columns

I have a "student" table, having around 5,000 records, in my DB. I want to display those records in two divs. How do I do that without executing the query twice; only using a single query? ...

Is it necessary to load a view in every controller in CodeIgniter?

Because I thought of ajax posting my form to a specific function in my controller and do a sql-insert, but I want to stay on the same page. So is it necessary to load a view in the posted url (=destination)? ...

port pipes all requests to a php file

how can I setup httpd.conf so that I can pipe all requests to that port go to a php file? I am trying to make a socket connection from action script to localhost in flash. ...

Advice on the most efficient way to plan-out a html/php & multi-user Ajax project.

I'm starting a experimental project and I was looking for advice to choose the best option I have. The project will be on the 100 - 1,000 user count. It collects its main data using javascript + json data from the user's flickr page and then uses that to display specific flickr photos. The variables that need to be stored include use...

Pagination: make current page bold

The following pagination works but does not make the current page, bold and unclickable (no href) Whats wrong? $totalcount = mysql_query("SELECT COUNT(*) as 'total' FROM $table"); $row = mysql_fetch_assoc($totalcount); $pages = ceil($row['total'] / $perpage); for ($i = 1; $i <= $pages; $i++) { if ($i != $page) ...