Hi
$var1 = 22;
$var2 = 10;
echo $var1 = ($var1 < $var2) ? $var1 : $var2; //smaller var
echo '<br />';
echo $var2 = ($var1 > $var2) ? $var1 : $var2; //greater var
I expect it to print 10 and 22 but it prints 10 and 10. any ideas what I am doing wrong?
Thanks
UPDATE
Thanks all.
$min = min($var1, $var2);
$...
i have an variable
<?php
$a="$testit with $";
ehco $a;
its shows undefined variable $testit but it is not an variable its an string how to do it in php...
...
How to get the next row from the Database table? Such that the row might be incremented row that is if structure has a field called "id" then the row can be id++ or very next incremented row, but it may also b any other id containing row (NOT VERY NEXT) , (because the ids could be deleted from the table).
I am using Mysql Database
below...
Hey Friends,
I have created custom registration form in drupal 6. i have used changed the behavior of the drupal registration page by adding this code in themes. template file
function earthen_theme($existing, $type, $theme, $path) {
return array(
// tell Drupal what template to use for the user register form
'user_register' =...
I have set up Eclipse PDT on Galileo. I'm able to run and debug PHP sites that are set up on XAMPP. The thing is, I want to profile one of the sites, but cannot for the life of me figure out how to set this up. There is a profiling menu when I right-click the PHP project, but no indication of how to proceed from there. BTW I'm using Xdeb...
iam using leigeber's sorting javascript to sort my data on my page......i took the js from here :-
leigeber's sorting javascript
Now this is shwoing highlighted sorted column and all and its all perfect.Now iam having some negative and some positive values in my data and i want to show those negative data in red color and positive in g...
hi ,
i am getting file content from file_get_content funtion in php.
and want to store that file in particular folder.
how could i store that file in particular folder.
$image = file_get_contents('http://www.affiliatewindow.com/logos/1961/logo.gif');
i want to save this image in particular folder.
any idea abt it?
...
hi,
I want to extract particular part of HTML using tidy in php.
the html page has table in it and i just want to fetch that table from html page.
please help and post the solution....
Thanks
...
I am new to programming PHP and am trying to validate a field in a form.
The field if for a RAL color code and so would look something like : RAL 1001.
so the letters RAL and then 4 numbers.
Can someone help me set them into a regular expression to validate them.
i have tried this with no success:
$string_exp = "/^[RAL][0-9 .-]+$/i";
...
So I have a form on PHP/HTML page. User submitss it to that same PHP/HTML page. So now PHP page I will have $_POST data. I want to when page is refreshed opnt some popUp browser windows which url's will be relative to users POST request. like www.example.com/bal-bla-bla.php? id=$_POST['StreamId']
...
i'm going to create a library that consists of a lot of separate classes.
i'm very familiar with mvc but have never created a pure library before.
i wonder where i should put the business logic? the kind of logic that usually resides in a controller in a mvc.
should it be in a class or in a "bootstrap" file?
and should one file inclu...
I am new to PHP and regular expression. I was going thorugh some online examples and came with this example:
<?php
echo preg_replace_callback('~-([a-z])~', function ($match) {
return strtoupper($match[1]);
}, 'hello-world');
// outputs helloWorld
?>
in php.net but to my surprise it does not work and keep getting error:
PHP Parse ...
I have two distinct modules that can be used independently, but Module2 is dependent on Module1.
Module2 has an operation that needs to be atomic, and it calls an operation in Module1 that also needs be atomic.
Assuming I have set PDO::ATTR_ERRMODE to PDO:ERRMODE_EXCEPTION, the following heavily genericised and snipped code yields this...
Driving me nuts...
Page with form is encoded as Unicode (UTF-8) via:
<meta http-equiv="content-type" content="text/html; charset=utf-8">
entry column in database is text utf8_unicode_ci
copying text from a Word document with " in it, like this: “1922.” is insta-fail and ends up in the database as â��1922.â�� (typing new data into the...
Assume that I have a class value object defined in php, where each variable in the class is defined. Something like:
class UserVO {
public $id;
public $name;
}
I now have a function in another class, which is expecting an array ($data).
function save_user($data) {
//run code to save the user
}
How do I tell php that the $data p...
EDIT: the difference between the pages are the simply $q1, $q2, $q3 becomes, for example, $q13, $q14, $q15 - they are questions in the form.
Hi all,
I have the following code:
$rguid = $_POST["r"];
$ip=substr($_SERVER['REMOTE_ADDR'], 0, 50);
$browser=substr($_SERVER['HTTP_USER_AGENT'], 0, 255);
$q1 = $_POST["q1"];
$q2 = $_POST["q2...
Hi, can anyone suggest the neatest way to do this comparison? I need to test if a date provided in dd/mm/yyyy format is less than a fixed date, e.g 01/05/2009 - I know I can convert these to unix time format using strtotime, then make the comparison, but I'm curious if there is a quicker way to do it - many thanks, just looking for a hin...
I was wondering how can I grab the value from a hidden field using PHP?.
Here is the hidden field.
<input type="hidden" name="delete" value="' . $row['delete_id'] . '" />
...
I created one module in drupal name as newmodule.I use form alter to alter user registration form for adding one field location.When i submit the form, how i can get the value of the new field which i created .
...
I need to take a file and move it to a windows machine on a specific folder where it is then to be printed automatically. How would I accomplish something like this? Is it possible with PHP?
...