Hi,
I have 5 textfields for user input in a form namely:
username1, username2, username3, username4 and username5
I would like to know how should I write my php code such that I will be able to check if there is any duplicates between the 5 textfields during POST?
I can only think of comparing (username1 !== username2) and so on, but I think there should be simpler way to do it right? How should I be able to do it?
Thank you very much.
In some languages (ColdFusion comes to mind), you can run a query on the result set from a previous query. Is it possible to do something like that in php (with MySQL as the database)?
I sort of want to do:
$rs1 = do_query( "SELECT * FROM animals WHERE type = 'fish'" );
$rs2 = do_query( "SELECT * FROM rs1 WHERE name = 'trout'" );
I have a directory that will be getting updated frequently, I want to display the last four images files uploaded, which match a certain pattern, on my php page.
Is this possible without having to perform a sort on every single image within the directory?
Many thanks!
Dear all,
I want to create multiple thumbnails using GD library in php, and I already have a script to do this, the question is what is better for me .. is it better to create thumbnail on the fly? or create a physical file on my server each time I want a thumb?? and Why?
Please, consider time consuming and storage capacity and other disadvantages for both
I am thinking about setting the
php.ini, my.cnf and httpd.conf default charsets=UTF-8
The website is in swedish lang only.
I have some folders with special chars in them, also some files.
Is there any harm by doing this?
Is it cross-browser safe?
Thanks
What is the best way to build a mySQL & PHP search?
I am currently using things like
%term%
I want it to be able to find the result even if they spell it slightly wrong, for example:
Field value = "One: Stop Shop:
They search:
One Shop Stop
OR
One Stop Shop
Etc.. I want a really smart search so they find the information even if they don't search the exact thing.
What is the best way to build a smart search like this?
How to fetch the first two rows from Mysql DB using Mysql PHP function? Is there any function which can give me first 2 or 3 rows from the select query we fired?
I am using combination of php+jQuery for captcha validation and later sending mails and do other stuff. The pseudo code is something like this:
captcha_code = jQuery.post(.....execute captcha script and get status)
if(captcha_code == "correct"){
send_mail_using_php_script;
}
Now I have no idea whether spammers can directly execute the "send_mail_using_php_script". Do they? If yes, then shall I move captcha validation in send_mail_using_php_script to make it more safer? Is there any other safer method?
Prashant
Suppose you have a string: "SELECT * FROM TABLE WHERE column1 = :var1 AND column2 = :var2"
Now, how do I get an array with all the variables like so:
Array
(
[0] => :var1
[1] => :var2
)
I've tried it with PHP's preg_match_all, but I struggle with the regex.
$varcount = preg_match_all("/ :.+ /", $sql, $out);
How can I convert a COleDateTime::GetCurrentTime() to a unix time stamp or more specifically I want to convert the value so I can use it in PHP with the date() function?
Ok, say I have a page with the url: URL.com/checkout/completed, how can I setup an if statemet to perform:
<if "This page has url of checkout/completed">
Content
<else>
No content
</if>
Is there a way? A simple way, my php/smarty-fu lacks.. A lot.
Thanks.
How to include an image inside another image in PHP? I want to do it like in twitterbackgrounds.com personalized backgroud. there is one main image and we can upload four personal images after that it will show as watermark of the main image.
hi
I've tried a few php IDEs , but still searching for the FASTEST one
all Java based IDEs are too slow, I have 2 computers to work, my home pc which is too fast, and my laptop witch is good , but cant handle a heave software.
and I have to work on them both, so I'm looking for the best free ide which is fast
I'm not talking about text-editors , because I already have np++ and its great, but looking for extra features to help me save time..
any tips?
When connecting to mysql, I have functions to get the relevant error message and error code, I see nothing of the sort in the list of ftp functions of PHP.
Is there a best practice to handle errors in FTP?
I am trying to set up automated .htaccess updating. This clearly needs to be as secure as possible, however right now the best I can do file permission-wise is 666.
What can I do to setup either my server or php code so that my script's fwrite() command will work with 644 or better? For instance is there a way to set my script(s) to run as owner?
I have an exec function in php file that execs a bash script. It script calls fmpeg to transcode a video file.
How can I know when transcoding is finish??
$script = "/opt/lamp../name.sh"
exec("$script $videoIn $id")
I will try using next code but it doesn't workd.
if (exec("$script $videoIn $id"))
{
//print on screen that the video has been transcoded
}
How to create a cron job in PHP for getting the update of modified date and time of files/folders?
I am a newbie to create a cron job how to get started?
Most of the applications that I'm finding, inncluding LiveHelp and PHP Live Chat! feature terrible, un-commented, non-cross-browser compatible Javascript.
I'm looking for chat software that uses a Javascript framework to avoid some persistent and common bugs related to the DOM.
Hi I have to flip a thumpnail image before merge it with another jpeg file. but when I rotate 45 degree using php. It shows a black background. how can I avoid that. any body can help me.
I'm trying to write a script for users to register to a club, and it does all the validation stuff properly and works great until it gets to the part where its supposed to check for duplicates. I'm not sure what is going wrong. HELP PLEASE!!!
Thank you in Advance,
<?php
mysql_connect ("sqlhost", "username", "password") or die(mysql_error());
mysql_select_db ("databasename") or die(mysql_error());
$errormsgdb = "";
$errordb = "Sorry but that ";
$error1db = "Name";
$error2db = "email";
$error3db = "mobile number";
$errordbe = " is already registered";
$pass1db = "No Matching Name";
$pass2db = "No Matching Email";
$pass3db = "No Matching Mobile";
$errorcount = 0;
$qResult = mysql_query ("SELECT * FROM table");
$nRows = mysql_num_rows($qResult);
for ($i=1; $i< $nRows+1; $i++){
$result = mysql_query("SELECT id,fname,lname,dob,email,mobile,agree,code,joindate FROM table WHERE fname = '$ffname");
if ($result > 0) {
$errorcount = $errorcount++;
$passdb = 0;
$errormsgdb = $error1db;
echo "<div class=\"box red\">$errordb $errormsgdb
} else {
$pass = 1;
$errormsgdb = $pass1db;
echo "<div class=\"box green\">$errormsgdb</div><br />";
}
//--------------- Check if DB checks returned errors ------------------------------------>
if($errorcount <= 0){
$dobp = $_REQUEST['day'].'/'.$_REQUEST['month'].'/'.$_REQUEST['year'];
$dob = $_REQUEST['year'].$_REQUEST['month'].$_REQUEST['day'];
//header('Location: thankyou.php?ffname='.$ffname.'&flname='.$flname.'&dob='.$dob.'&femail='.$femail.'&fmobile='.$fmobile.'&agree='.$agree.'&code='.$code.'&dobp='.$dobp);
echo "<div class='box green'>Form completed! Error Count = $errorcount</div>";
} else {
echo "<div class='box red'>There was an Error! Error Count = $errorcount</div>";
}
}
?>
I need to find a certain key in a pdf file. As far as I know the only way to do that is to interpret a pdf as txt file. I want to do this in PHP without installing a addon/framework/etc.
Thanks