nav33n 472 Purple hazed! Team Colleague Featured Poster

Obviously its adding 1 record because you have 1 sql statement to insert and you are not looping it either. In your html form, you should have different input elements name. For example, you can concatenate $i value with textbox name to give it a unique name. When the page is submitted, you can loop through the posted values and insert into the table. Just a small example.

<?php //page1.php
for ($i=1;$i<10;$i++){
	echo "<form name=update method=post action=page2.php>";
	echo "Name : <input type=text name=name_".$i.">\t";	
	echo "Marks1: <input type=text name=test1_".$i."><br />";
}
echo "<input type=submit name=submit value=submit>";
?>
<?php //page2.php
for ($i=1;$i<10;$i++){
	$name = "name_".$i;
	$new_name=$_POST[$name];
	$marks = "test1_".$i;
	$new_marks=$_POST[$marks];
	//database connection string
	$query="insert into table (col1,col2) values ('$new_name','$new_marks')";
	mysql_query($query);
}
echo "All names and marks are entered into the table !!";
?>

Hope it helps.

nav33n 472 Purple hazed! Team Colleague Featured Poster

What's wrong ? Are you getting any errors ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Umm..I dont think its possible(I am quite sure its not possible!).. When a user opens a page on your site, hes opening an instance of your page in his browser and its different for different users. Why do you want something like this btw ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Umm.. are you asking whether it is possible to refresh other visitor's page when 'one' of the visitor clicks a link/submits a form/.. ??

nav33n 472 Purple hazed! Team Colleague Featured Poster

Its pretty easy. In page 1, say, you are listing all the houses with hyperlinks. Eg.

$query="select id from houses";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
echo "<a href=houseinfo.php?id=".$row['id'];
}

In houseinfo.php, you just have to get the id from the url, fetch its information from the table and print it.

<?php //houseinfo.php
$id=$_GET['id'];
$query="select * from houses where id = '$id'";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
print "Address : ". $row['address'];
print "Cost: ". $row['cost'];
...

Thats bout it..

nav33n 472 Purple hazed! Team Colleague Featured Poster
nav33n 472 Purple hazed! Team Colleague Featured Poster

You can use, sum(ifnull(points,0), points_added). If the 1st expression in ifnull ie., points is null, it returns 0 and if its not null, it returns points value. I too dont know much about joins and related problems, but, this link might be useful.

http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html

nav33n 472 Purple hazed! Team Colleague Featured Poster

so.... you consider the germans from wwI heros? it sounds like you have a confused mind...

He was being sarcastic dude !
:icon_confused:

nav33n 472 Purple hazed! Team Colleague Featured Poster

Okay ! There is no problem with your script. There must be some problem with your smtp configuration. Open php.ini and look for [mail function]. See if smtp is set to your outgoing mail server.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Before sending the mail, try to print what's in $email. Or, hardcode email address and try sending a mail. I am sure something goes wrong while fetching the data from the database cuz it works here.

nav33n 472 Purple hazed! Team Colleague Featured Poster

I dont see a closing brace of if (isset($_REQUEST['submit'])) .
$username and $password is not declared.
And, $from="yourname@domain.com"; should be $from = "From: [email]yourname@domain.com[/email]";

nav33n 472 Purple hazed! Team Colleague Featured Poster

@iamthwee, Unfortunately, you don't know the difference between stupidity and sarcasm.

nav33n 472 Purple hazed! Team Colleague Featured Poster

paypal or credit card ?

iamthwee commented: no -2
~s.o.s~ commented: 6 bags of rice. ;-) +20
nav33n 472 Purple hazed! Team Colleague Featured Poster

Umm..what's so difficult about it ? I hope you know the query to fetch the records from the table ?

$subject="Test mail";
$from="From : yourname@domain.com";
$query="select * from tablename";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
   $email=$row['email'];
   $name = $row['name'];
  email($email,$subject,$message,$from);
}
nav33n 472 Purple hazed! Team Colleague Featured Poster

oh oops! :-O

<?php
$arr=array("data_01"=>1,"data_02"=>2,"data_03"=>3);
?>
nav33n 472 Purple hazed! Team Colleague Featured Poster

No. What he means is, he wants an array with user defined variables as index. Eg. instead of accessing the array like, $arr[0], $arr[1],.. he wants to access it like, $arr[$data_01], $arr[$data_02],...

I dont think its possible.

nav33n 472 Purple hazed! Team Colleague Featured Poster

yeah.. its confusing sometimes and most of the time, you tend to forget that you have a prefix !!

nav33n 472 Purple hazed! Team Colleague Featured Poster

...for future reference, never declare a prefix, always leave this option blank.

May be they are talking about the prefix while creating a database. For example, if your host is somehost, it will add prefix somehost_databasename while creating a database. I guess thats what they mean by that.

nav33n 472 Purple hazed! Team Colleague Featured Poster
nav33n 472 Purple hazed! Team Colleague Featured Poster

if thats the case, why not generate one more random number ?

<?php
	$arr=array();
	for($i=0;$i<7;$i++){
		$arr[$i]="./img/images/".$i.".jpg";
	}
	$random=rand(0,6);
	$random_1=rand(0,6);
		echo "<img src=".$arr[$random].">";
		echo "<img src=".$arr[$random_1].">";
?>

This will do.. Don't you think ?

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
	$arr=array();
	for($i=0;$i<7;$i++){
		$arr[$i]="./img/images/".$i.".jpg"; //assigning the image location to the array $arr.
	}
	$random=rand(0,6); //generating a random number
	echo "<img src=".$arr[$random].">";
//printing the image
?>

Thats it :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

you are welcome.

nav33n 472 Purple hazed! Team Colleague Featured Poster
if($chapter!=0){  // if chapter has some value and if its not 0.
   $prev_link=$chapter - 1; //set previous link as chapter - 1.
} else {
$prev_link=0; //if chapter = 0, then theres no previous link, make it 0 as well.
}
if($chapter < count($lines)){ //if the chapter is less than the number of lines, next_link is valid.
   $next_link=$chapter + 1; //assign next chapter to $next_link
}


echo "<a href='file.php?chapter=$prev_link'>Previous chapter</a><br>";
echo "<a href='file.php?chapter=$next_link'>Next  chapter</a><br>

Thats it, i guess. Btw, most of the people dont use vars anymore. Its outdated. You can do something like this.
[inline]
$file_select=(isset($_REQUEST))?$_REQUEST: "ttc_intro";[/inline] Here you are checking if file_select has been set by any of the methods, $_GET or $_POST. if its set, then assign that value to $file_select, else, assign ttc_intro to $file_select. You can do the same thing while checking for chapters as well..

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

using order by clause.

order by date asc | desc

nav33n 472 Purple hazed! Team Colleague Featured Poster

how does the admin enter the dates? does he have a form ? what is the name of those text fields ? basically, this will work.

$sql="select * from table where date between '$start_date' and '$end_date'";

$start_date and $end_date are post variables of the form.

nav33n 472 Purple hazed! Team Colleague Featured Poster
$sql="select * from table where (start_date between '$start_date' and '$end_date') or (end_date between '$start_date' and '$end_date')";

considering start_date and end_date are the columns of your table, the first condition will fetch the records if the start_date lies between the range of $start_date and $end_date (the user's input). similarly, it checks if end_date lies between the range.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Dont disable it. make it readonly.
<input type="text" name="name" value="somevalue" readonly> .

nav33n 472 Purple hazed! Team Colleague Featured Poster

Running the following code will list everything properly. But it lists EVERY row from the database.
$query = "SELECT * from tblQuotes, tblTitles WHERE tblQuotes.Serial = tblTitles.Serial";

The above query is perfect and i dont know WHY it lists every row !

nav33n 472 Purple hazed! Team Colleague Featured Poster

I am getting the right output. i am getting 03:14:16 PM which is the right time.

$time_now=mktime(date('h')+5,date('i')+30,date('s'));

date('h')+5 will add 5 hrs to UTC time.
date('i')+30 will add 30 mins to UTC time.

Since we are 5-30 hrs ahead of UTC time, i am sure this will work. It probably wont work if you have set some other timezone. :)

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
$time_now=mktime(date('h')+5,date('i')+30,date('s'));
 print "<br>".date('h:i:s A',$time_now);
?>

Thats for php.

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

well, thats because, you are probably testing it locally, like, http://localhost/ip.php and most probably, while configuring apache, you have given IP as 127.0.0.1 (or localhost). Try putting it on a server and check. It will work. :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

$_SERVER is used to get the IP address of a client.

More about it Here

nav33n 472 Purple hazed! Team Colleague Featured Poster

If you want current date and time to insert to a table, you can use now() function of mysql.

http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_now

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

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

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.