php

How do I find the duplicate ID in a table when doing INSERT IGNORE?

I know that when doing a INSERT IGNORE duplicate entries are ignored and errors become warning but here is what I need. Scenario: We have a table with 2 columns (id, name) where BOTH are UNIQUE and id is PRIMARY KEY. When you do an INSERT IGNORE on column name it creates the next AUTO_INCREMENT for id (even though it later doesnt exist...

IS this a valid reason for using php frameworks ?

I have created several php projects from scratch before, but I realize that it now becomes totally impossible to maiintain all of them as they are all written differently. Especially when they are written several months ago. I need to create new php projects regularly so would using Frameworks help me with the problem ? IS this a valid ...

PHP - How to check that a string is an int, but not a double, etc.?

PHP has an intval() function that will convert a string to an integer. However I want to check that the string is an integer beforehand, so that I can give a helpful error message to the user if it's wrong. PHP has is_int(), but that returns false for string like "2". PHP has the is_numeric() function, but that will return true if the n...

How to read a text file contents word by word in an array in php

I have a text file with 8-10 words in each line with sequence no.and spaces. e.g 1)word 2)word 3)word 4)word ......... and i want to read it in an one dimensional array only words not sequence no. ...

Does a seperate MySQL server makes sense when using nginx instead of Apache

Consider a web app in which a call to the app consists of php script running several MySQL queries, some of them memcached. The PHP does not do very complex job. it is mainly serving the mysql data with some formatting. In the past it used to be recommended to put mysql and the app engine (PHP/Apache) on seperate boxes. However, whe...

strange characters in URL while displaying in PHP

Hi, I am using PHP to display a fileserver path. What I am getting now: file:%22////filsrv//logs//Test//D_log1.1.1%22 I am using this method to strip $rs1 = preg_replace("/%u([0-9a-f]{3,4})/i","",urldecode($row['ResultDirectory'])); but I am not sure If I am using the right one, The actual Path stored in the DB is : \\filsrv\l...

PHP and CHMOD question

Hi, I want my PHP software to be able to auto update. For this to work, I need PHP to be able to write into files both existing and non-existing (create). Will it always work if I just CHMOD the target files to be 0777 and then write into it? Or does the PHP/Apache/wtvr process need to be the owner of the file? Sometimes when people up...

Storing files in a mysql database using PHP

How do I store an uploaded swf file in a mysql database using php? basic coding plz ...

Things to avoid when coding PHP programs that work on OpCode Cachers

Hi, What kinds of things should I avoid if I want to support PHP OpCode Caches? Are static calls evil? What about __autoload? ...

How to send e-mails for all members of website with the class?

I need to create a PHP class that would send e-mails to all members of the website. Simple mysql_fetch_array and loop doesn't fit because my client wants a class and I actually don't know much about classes and what he exactly wants. Can you explain or give me any hints? ...

PHP & mySQL: Year 2038 Bug: What is it? How to solve it?

Hi all, I was thinking of using TIMESTAMP to store the date+time, but I read that there is a limitation of year 2038 on it. Instead of asking my question in bulk, I preferred to break it up into small parts so that it is easy for novice users to understand as well. So my question(s): What exactly is the Year 2038 problem? Why does it o...

php, mysql, coding

i want to display my images which are located in a mysql database in a browser using php , myadmin // exactly i am talking about wampserver/ now ho do i retrieve images from database in a browser using php ...

Facebook charset detection mechanism?

Today, I have looked into HTML code of facebook.com, and found something like this: <input type="hidden" value="€,´,€,´,水,Д,Є" name="charset_test"/> It's repeated two times inside the <form>...</form>. Any idea what this code might be useful for - some kind of server-side client charset detection? As far as I know, browser charset is...

PHP Server Side Printing

i've been googling for the last few hours now and can't seem to find an answer. but i did come close with http://stackoverflow.com/questions/1648399/starting-serverside-print-job-via-php Whole idea is I've got an intranet site on my windows server running xampp / wamp, I don't really want to give printing access rights to everyone a...

Regex: matching up to the first occurrence of a character

Hey, I am looking for a pattern that matches everything until the first occurrence of a specific character, say a ";" - a semicolon. I wrote this: /^(.*);/ But it actually matches everything (including the semicolon) until the last occurrence of the semicolon. ...

How two different domains to be viewed in the single browser ?

I have two different application having different domains, want to make a site where its show both sites in a single page.[Without using Iframe]. ...

using curl to get from one webpage to another involving javascript

Hi, I have webpage1.html which has a hyperlink whose href="some/javascript/function/outputLink()" Now, using curl (or any other method in php) how do I deduce the hyperlink (of http:// format) from the javascript function() so that I can go to next page. Thanks ...

PHP dropdown sticky

I have a database populated drop down list. $options4=""; while ($row = mysql_fetch_array($result)) { $id=$row["Client_Code"]; $thing=$row["Client_Full_Name"]; $options4.="<OPTION VALUE=\"$id, $thing\">".$thing; } ?> <FORM name="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method...

PHP Class variable access question.

I'm having trouble accessing a class' variable. I have the functions below in the class. class Profile { var $Heading; // ... function setPageTitle($title) { $this->Heading = $title; echo 'S: ' . $this->Heading; } function getPageTitle2() { echo 'G: ' . $this->Heading; ...

php jquery error in Firefox

Hello, I'm having trouble with some Javascript, and hopefully someone may be able to help! First, here is the code: function Client_Selected() { var temp = $("input:radio[name='selected_client']:checked").val(); var f_input_name = "fname_" + temp; var l_input_name = "lname_" + temp; var first = $("input[name='"+f_inp...