php

Entity Framwework-like ORM NOT for .NET

Hi, What I really like about Entity framework is its drag and drop way of making up the whole model layer of your application. You select the tables, it joins them and you're done. If you update the database scheda, right click -> update and you're done again. This seems to me miles ahead the competiting ORMs, like the mess of XML (n)H...

To convert foreach statements to for -loops in PHP

How can you convert foreach -statements to for -loops in PHP? Examples to be used in your answers 1 foreach( $end_array[1]['tags'] as $tag ) and 2 foreach($end_array as $question_id => $row2) ...

move_uploaded_file help

<?php if (count($_POST)) { $userfile = $_FILES['userfile']['name']; $file_size = $_FILES['userfile']['size']; $file_temp = $_FILES['userfile']['tmp_name']; $path = 'uploads/'; $randomizer = rand(0000, 9999); $file_name = $randomizer.$userfile; if($file_size > 25600) { echo 'FILE SIZE TO LARGE<BR />'; exit(); }...

Facebook API: Can it access "notes"?

Before I pursue this, I would first like to know if it's possible. So, does anyone know if I can do this with the facebook Api: Access the "notes" application Retrieve the text in the note Retrieve the comments written on the note Retrieve the details (username and ID) of the person who wrote the note Anyone? ...

Why make Objects when you can just use a MySQL database?

So I am a little confused on the object oriented part of PHP. Right away I will apologize for the fact I know very little about PHP and databases. My question is when your making per say a database to hold users in it, why would you want to make a class/object for that user when you can just pull info from the database. Also if you ...

apache mod_security says - Access Denied error

Background - I have my website code hosted on a linux server. My website allows new registrations for employers (http://www.gymandspajobs.com/Employer/Employer.php). The filled-up forms are verified by JavaScripts in the folder "/javascript" and if the information is found ok, the data is submitted via JavaScript HTTP request object and...

Detecting error-control operator

Please tell me if this is correct. In my error handler, I need to be able to detect when the @ error-control operator was used to suppress errors, because some external libraries (sadly) use it a lot. Execution of the script should continue, just like when you don't use custom error handlers. When the at-sign is used, PHP temporarily se...

What technology (asp, php, joomla, rails, grails...) for a website from scratch ?

Hello, I am starting up a new website that will need to meet the following requirements : Performance and Scalability : I am aiming to have some high traffic with high number of concurrent connections during few minutes. No heavy contents (like Flash or Videos) will be present in the first version Mobile Site : The first version will ...

Viewing large text file in a browser

Hi, I need to write a text file viewer (not the directory tree, but the actual file contents) for use in a browser. It will be used to view large files. I want to give the user the ability to actually ummm, browse the file, ie prev page & next page buttons, while each page will show only a portion of the file. Two question: Is there a...

Unicode characters in MySQL returning different character code values in PHP and ASP

Hi there, I have a MYSQL database which needs to be accessed by both PHP and MySQL scripts, this works fine in most cases, but some "special" characters e.g. double quotes, apostrophes don't display correctly in the ASP scripts. E.g the MySQL database is from a Drupal installation and contains a table with a field containing the text...

retrieving mysql tables in php

i am fairly new to php and mysql and was incidentally bugfixing a project a friend of mine had done. let me get straight to it. this is a php file that cretaes a temp db: <?php include("config.php"); //define the temp table $query = "CREATE TABLE carttemp( carttemp_hidden INT(10) NOT NULL AUTO_INCREMENT, carttemp_sess...

Sorting search results array by number of matches?

I'm building a basic search function for my site. Realising that the most useful search displays the page with the most counts of the terms given, I coded the following: function search() { $this->page = preg_replace('/[^\w \"\']/i', '', trim($this->page)); preg_match_all('/"(.[^"]+)"|([\w]+)/i', $this->page, $terms); $terms...

PHP: Formatting irregular CSV files into HTML tables

My client receives a set of CSV text files periodically, where the elements in each row follow a consistent order and format, but the commas that separate them are inconsistent. Sometimes one comma will separate two elements and other times it will be two or four commas, etc ... The PHP application I am writing attempts to do the follo...

How to know client side OS by PHP & Javascript?

In PHP and Javascript by which function can we know what's end users operating system when an end user uses a site? ...

how to resize bmp,tiff image using gd library ? and also mention about imagemagic which is good to use

i need to know which is better gd or imagemagic to resize an image ...

Replacing charset with preg_replace [php]

Hi, i have different websites content stored in a variabel named $content. Now what i would want to do is to search the content for META-tags like this: <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> And then replace the utf-8 to IS0-8859-1. How do i do that with preg_replace? Note that every occurence is not l...

redirect from localhost to localhost/abc/

I have placed an index.php file in the root of my web site (http://localhost). I want to redirect this page (http://localhost) to http:/localhost/abc - when I visit http://localhost, I want the user to go to http://localhost/abc. What do I need to do to my index.php file? ...

To use Xdebug2's profiling data in debugging PHP by Ubuntu

My question is based on this article. How can you make the profiling data about a PHP code by Xdubug2 and then put it to an app like KCacheGrind? I have used successfully Xdebug in my Ubuntu, since it highlights my error messages in the browser. However, I have not find any terminal tool like xdebug. I would like to have a visual view...

Fetching feeds by date

I want to be fetching feeds from a site on a daily basis. I only want to fetch the present day's feeds alone. Is there a way i can specify the date i intend to fetch as a parameter or i will just need to check the date of each fetched feed and stop fetching when the date is not the present day's date? Thanks in advance. ...

How does a MYSQL Self-Join Work?

I recently asked a question about Self-Joins and I got a great answer. The query is meant to find the ID, Start Date, and Price of Event2, Following Event1 by 1 Day. The code WORKS fine. But I don't understand HOW. Could someone explain as thoroughly as you can- what the different parts of the query are and what they do? SELECT even...