nav33n 472 Purple hazed! Team Colleague Featured Poster

Umm! Set the temperature of your AC to -0 (!?!). I am sure, those blood sucking mosquitoes will freeze to death ! Oh well, if you dont have an AC at home, you can hide behind the door and attack them from behind !

nav33n 472 Purple hazed! Team Colleague Featured Poster

orbit chewing gum :(

nav33n 472 Purple hazed! Team Colleague Featured Poster

Which smoker smells the best?

TBH, 'no one' (smoker/non-smoker) smells the best, until they brush their teeth (atleast twice a day) and take bath (at least once a day), then empty a can of deo !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Since you want to run exactly the same query and check only for one condition, you can do it this way.

$query="select * from huge_table where conditions joins etc";
$result=mysql_query($query);
$price_p=array();
$price_s=array();
while($row=mysql_fetch_array($result,MYSQL_ASSOC)){
   if($row['price']=="P"){
       array_push($price_p,$row['price']);
   }
   if($row['price']=="S"){
       array_push($price_s,$row['price']);
   }
}

So, by the end of the execution of this query, you will have 2 arrays, 1 with price=p values and the other with price=s values.

Cheers,
Naveen.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Many thnx for guiding. Now can u pls. tell me what field should i choose to get good amount of salary and also long time Option i have : Asp.Net or Php

thnx,

If we discuss salary here, I would definitely say that an asp.net programmer gets a LOT MORE than a php programmer (thats in India,I don't know bout the rest of the world). Well, in my company, while I earn peanuts, .net programmers are looting the company !

But basically, it all comes down to what you like ! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

If you don't have access to a server you can install xampp to test on.

http://www.apachefriends.org/en/xampp-windows.html

That includes php and is very easy for a beginner to setup and get coding.

Or even wamp http://www.wampserver.com/en/download.php

nav33n 472 Purple hazed! Team Colleague Featured Poster

why dont you use if else if instead of checking the substring every time ?

if(substr($row[0],-2,1)=="_") { 
//$row[0] has only 1 digit after the underscore
} else if (substr($row[0],-3,1)=="_"){
      //$row[0] has 2 digits after the underscore
} else {
   // $row[0] doesnt have an underscore
}

This will work, i am sure.

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
// Have a button/link ("Send message") on the member profile. When clicked, it has to fetch the "email_address" of that member from the respective table. Assign it to $to_address. 
$to_address="address_of_the_recipient";
if(isset($_REQUEST['submit'])){
	$subject=$_REQUEST['subject'];
	$message=$_REQUEST['message'];
	$headers = 'From: Naveen < >' . "\r\n";
	mail($to_address, $subject, $message, $headers); 
	echo "Message sent successfully..";
} else {
?>
<html>
<body>
<FORM METHOD=POST ACTION="mail.php">
Subject: <INPUT TYPE="text" NAME="subject" size="30"><br />
Message: <TEXTAREA NAME="message" ROWS="10" COLS="20"></TEXTAREA><br />
<INPUT TYPE="submit" name="submit" value="submit">
</FORM>
</body>
</html>
<?php 
}
?>

The above code has not been checked for sanity, but it does what it has to.
Cheers,
Nav

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php //add_days.php
if(isset($_REQUEST['submit'])){
	$start_date="2007-11-25";
	$add_days=$_REQUEST['days'];
	$new_date = date('Y-m-d', strtotime($start_date.' + '.$add_days. ' days'));
	echo $new_date;
}
?>
<html>
<body>
<FORM METHOD=POST ACTION="add_days.php">
<INPUT TYPE="radio" NAME="days" value="7">7<br />
<INPUT TYPE="radio" NAME="days" value="14">14<br />
<INPUT TYPE="radio" NAME="days" value="30">30<br />
<INPUT TYPE="submit" name="submit" value="submit">
</FORM>
</body>
</html>

This will do the work for you.

Cheers.
Nav

nav33n 472 Purple hazed! Team Colleague Featured Poster

Check http://www.goodphptutorials.com/out/Secure_File_Upload_with_PHP

In the above link, you can upload 1 file at a time. You can modify the above code so that it can upload 5 files simultaneously.

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php 
$con=mysql_connect("host","user","pass");
mysql_select_db("dbname");
$query="select columnname from table where condition";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
$document_contents=$row['columnname'];
header("Content-Type: application/msword");
header('Content-Disposition: attachment; filename="document.doc"');
echo $document_contents;
?>

Thats how you retrieve a document from a table.

Cheers.
Nav

nav33n 472 Purple hazed! Team Colleague Featured Poster

If your computer beeps more than what it used to, then I think its your RAM which has the fault.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Oh, btw, you cant pass the data from 1page to another without using <form>. Try the following.

<?php  //page1.php
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
$line = $_GET['id'];

$result=mysql_query("SELECT * FROM table1 where id='$line'") or die("ERROR:".mysql_error());
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{
$line = mysql_fetch_row($result);
print '<form name="test" method="post" action="page2.php">';
print 'Name<input type="text" maxlength="19" size="53" name="name1" value="'.$line[0].'" />';

print '<input type="hidden" maxlength="19" size="53" name="id" value="'.$line[0].'" />';
print '<input type="Submit" name="Submit" value="Submit" />';
print '</form>';
}
?>

<?php  //page2.php
$name1=$_POST['name1'];
$id1=$_POST['id'];
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");


if (isset($_REQUEST['Submit']))
{
mysql_query("UPDATE table1 SET name='$name1' where id='$id1'") or die("ERROR:".mysql_error());
echo $name1;
echo $id1;
echo "THANKS FOR ENTERING UR DETAILS";
}
?>

I hope it helps.

nav33n 472 Purple hazed! Team Colleague Featured Poster
print '<input type="hidden" maxlength="19" size="53" name="name1" value="'.$line[0].'" />';

This has to be

print '<input type="hidden" maxlength="19" size="53" name="id1" value="'.$line[0].'" />';

in page 1, because, in page2, ur trying to access $_POST[$id1] which never existed !

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are not passing $id from the previous page. Both has the name "name1".

Cheers.

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) thanks !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi all,

I am Naveen, an Engineering graduate from India. I have been working on php/mysql for past 1 1/2 yrs. I was searching for something and I accidently got here. I hope to learn something from the forum. Have a nice day!

Cheers,
Nav