I have array like this:
$path = array (
[0] => site\projects\terrace_and_balcony\mexico.jpg
[1] => site\projects\terrace_and_balcony\new_york.jpg
[2] => site\projects\terrace_and_balcony\berlin.jpg
[3] => site\projects\terrace_and_balcony\Kentucky.jpg
[4] => site\projects\terrace_and_balcony\Utah.jpg
[5] => site\projects\terrace_and_bal...
For clarification, are you able to use MySQL this way to sort?
ORDER BY CompanyID = XXX DESC
What I am trying to do is use one sql query to sort everything where X = Y, in this case, where CompanyID = XXX. All values where CompanyID is not XXX should come after all the results where CompanyID = XXX.
I don't want to limit my query but...
$date1 = $date2 = new DateTime();
$date2->add(new DateInterval('P3Y'));
Now $date1 and $date2 contain the same date -- three years from now. I'd like to create two separate datetimes, one which is parsed from a string and one with three years added to it. Currently I've hacked it up like this:
$date2 = new DateTime($date1->format(Dat...
A few days ago I upgraded Php Mailer and now some email providers my messages mark as spam. This is what I see in the headers of the marked messages:
X-SpamTest-Info: {TO: header missing}
This is from my php file.
$mail->From = $sender;
$mail->FromName = $sender_name;
$mail->Subject = $subject;
$mail->Body = $body;
...
For this script, it checks to see if the file is a microsoft words doc or ppt.
I am not sure why this isn't running because it works for image MIME and text/plain.
I am using PHP 5.3.1 so it should have all the MIME types installed already right?
I am uploading words and powerpoint 2007.
//Does the file have the right MIME type?
if ($...
Simple question I guess, I want to use PHP to write an update to an existing row in my database, if it doesn't happen I want to log the failure but continue executing the code. While it would be nice to have records of failures to track down issues, that the update failed isn't that important to my user, nor will it affect the running of...
I'm trying to send a file from within a Kohana model to the browser, but as soon as I add a Content-Length header, the file doesn't start downloading right away.
Now the problem seems to be that Kohana is already outputting buffers. An ob_clean at the begin of the script doesn't help this though. Also adding ob_get_length() to the Conte...
I am trying to test if the uploaded file is the image type I want. If it isn't a gif,jpeg, png, it should echo "Problem". But when I execute this code, it always says there's a problem. What's wrong with my if statement?
$uploadfile_type=$_FILES['userfile']['type'];
if ( ($uploadfile_type !='image/gif') || ($uploadfile_type !='imag...
I can find the definition files at http://www.php.net/~helly/php/ext/spl/... but I want to extend DirectoryIterator and SplFileInfo to work over a virtual filesystem stored on a database... not a real filesystem...
Many thanks...
...
I'm currently working on a website in PHP, and I'm wondering what the best practices/methods are to reduce the time requests take. I've build the site in a modular way, so a page would consist of a number of modules, and each of these would need to request information.
For example, I have a cart module, that (if a cart is set) will fetc...
Basically, I am diving ever deeper into complex programming practices. I've almost no friends that are experienced (or more experienced than me) programmers to learn from, so I am looking for the next best thing - learning from the work of strangers.
Can anyone recommend a real world finished and working application written well and OOP...
Dear members of the Stackoverflow community,
We are developing a web application using the Zend Framework, and we are
facing some encoding issues that we hope you might help us solve. The
situation goes something like this: There are certain tables on a MySQL
database that need to be displayed as html. Because the site is designed
using...
Hello
I'm creating a website with structure like this:
class main { }
class mysql extends main { }
class user extends main { }
class etc extends main { }
The idea is for these classes to use functions from each other. This doesn't work. How can I call a function from mysql in user?
EDIT:
All errors are similar to this one:
Fatal...
I'm not php expert and I don't know what's the difference(1) between a and b.
a.)eval('return "'.base64_decode("encoded_text").'";')
b.)base64_decode("encoded_text")
-I THINK, a is php code and b is just string. And my other question is:
What is the difference(2) between c and d?
c.)eval('return "'.base64_decode("encoded_text").'";'...
This is related to my other question:
http://stackoverflow.com/questions/2579249/managing-foreign-keys
I am trying to join the table of matches and non-matches.
So I have a list of interests, a list of users, and a list of user interests.
I want the query to return all interests, whether the user has the interest or not (should be nul...
Hello, I have this snippet
while($row = mysql_fetch_array($result)){
$search = '' . $row['searchquery'];
echo '<a href="http://www.example.com/' . preg_replace( array('/[^\s\w]/','/\s/'),array('','+'),$search) . '+/">' ...
but if someone types in äöü, it doesnt show the letters - with rawurlencode thats possible, but I want to remov...
I have been research tihs topic in web for a while and i want to make a webbased strategy game which can be fast and efective. But my game will not be a graphical game. my game will be like that players will make castles armies, ships etc. Then players going to battle with each other. So ı am stuck with java or php. I dont know php as we...
Folks does anyone knows of a PHP function to remove unmatched HTML tags from a string. for example<div> This is a string <b> with an unmatched bold tag </div>. If there isnt one then help me buld one, maybe I can have a function that counts the number of opening tags and matching closing tags. If they are not even then remove the first o...
Hello. Does anyone know how I can get the value of an input box, without having a form? I want a submit button, but instead of submitting a form, I want it to change data in a MySQL database. Something like this maybe?
$img1="WHAT DO I PUT HERE?"
$idx=1
$sql="INSERT INTO games SET img1='$img1' WHERE id=$idx";
$result=mysql_query($s...
I'm storing an infinitely nested directory structure in mysql by assigning a "parent_album_id" to each "album" (unless it's at the top level, in which case it does not have a parent_album_id).
I first grab an array of all the albums from the database and change each albums key to it's "id" (autoincrement id).
Next, I want to reorganize...