nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb! Please post your question here.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome Dilnesaw!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

No.

Do you like this game ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

First check the file type you are trying to upload. You can get the filetype of the file you are trying to upload by using $_FILES. I guess you are uploading a different file type(and checking for a different filetype).

if($_FILES['file']['type'] == "image/pjpeg" || $_FILES['file']['type']=="image/jpeg" || $_FILES['file']['type']=="image/gif") {
   //do something
} else {
  //wrong extension
}
nav33n 472 Purple hazed! Team Colleague Featured Poster

Reading gives me immense pleasure. Reading love letters that is.

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) You are welcome! I am not a guru! There are sooooo many things that I am not aware of.

isset() checks whether a variable is set, has a value (even null) in it. So, this would pass the value of that variable, only if its set.

if(isset[$_POST['name'])){
  $name=$_POST['name'];
} else {
  echo "Name is not set.";
}

As I said, If you assign null to a variable and check if it is set, it would return true.

$x="";
if(isset($x)){
echo "X is set";
} else {
echo "X is not set.";
}

In this case, it returns X is set, even though it doesn't have any value.

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

Raining doesnt necessary relate to water falling from sky! :)

Err! You are supposed to start a sentence with the last word of the previous post! Software, in this case.

Sky is blue, water is blue, the fishes are dumb, so are you!

nav33n 472 Purple hazed! Team Colleague Featured Poster

The Gimp is an open source software.

nav33n 472 Purple hazed! Team Colleague Featured Poster

It's okay. He's just admiring the shape of your skull. - Fear and loathing in Las vegas.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Simply WoW!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb! Please post your question in msaccess forum.

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are welcome! And yep, you can use both AND and && .

nav33n 472 Purple hazed! Team Colleague Featured Poster

Paint is microsoft window's default picture editor. Its commonly known as Mspaint!

nav33n 472 Purple hazed! Team Colleague Featured Poster

In general, non-correlated subqueries are faster than joins, and correlated subqueries are slower than joins.

I was talking about non-correlated subqueries.

Ref: http://docs.hp.com/en/36216-90103/ch03s02.html

Oops! I didn't see your edited post !

nav33n 472 Purple hazed! Team Colleague Featured Poster

No.

Are you mad ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

A sub-query returns only those records which matches the condition where as joins returns the cartesian product(if no condition is specified).
If you want to fetch the data from many tables, sub-queries are more efficient than joins.
:)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Soul is invincible! Only the body dies.

nav33n 472 Purple hazed! Team Colleague Featured Poster
<script language="javascript" type="text/javascript">
//start display day/date code
//file:

DaysofWeek = new Array()
DaysofWeek[0]="Sunday"
DaysofWeek[1]="Monday"
DaysofWeek[2]="Tuesday"
DaysofWeek[3]="Wednesday"
DaysofWeek[4]="Thursday"
DaysofWeek[5]="Friday"
DaysofWeek[6]="Saturday"

Months = new Array()
Months[0]="January"
Months[1]="February"
Months[2]="March"
Months[3]="April"
Months[4]="May"
Months[5]="June"
Months[6]="July"
Months[7]="August"
Months[8]="September"
Months[9]="October"
Months[10]="November"
Months[11]="December"


function fixNumber(the_number){
if (the_number < 10){
the_number = "0" + the_number;
}
return the_number;
}

function fixPMHours(the_number){
if (the_number>12){
the_number = the_number - 12;
}
return the_number;
}


var dayVal;
var timeVal=new Date()
var m=timeVal.getMinutes()
var h=timeVal.getHours()
var fixed_hour = fixPMHours(h);
var da=timeVal.getDate()
var mo=timeVal.getMonth()
var year=timeVal.getYear()
var showDay=DaysofWeek[timeVal.getDay()]
var showMonth=Months[timeVal.getMonth()]
var fixed_minute = fixNumber(m);
var the_time = fixed_hour + ":" + fixed_minute;
var the_date = (showDay+", "+showMonth+" "+da+", "+year+" ")

function showTime(){
var timeValue = the_date+" ";
timeValue +=(h >= 12) ? " " : " ";
document.write(timeValue);
}


//file://end display day/date code
</script></font>
<font size="1" face="ms sans serif" color="#63C7DE">
<script language="javascript">
showTime();
</script>
</font></div>

This works in both IE and FF. The problem was file: :twisted:

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
	if(isset($_POST['submit'])) {
		for($i=0;$i<count($_FILES['fileupload']);$i++) {
			print $_FILES['fileupload']['name'][$i]."<br />";
		}
	}
	?>
<html>
<body>
<form name="upload" method="post" action="upload.php" enctype="multipart/form-data">
<table>
<tr><td>
<input type="file" name="fileupload[]">
</td></tr>
<tr><td>
<input type="file" name="fileupload[]">
</td></tr>
<tr><td>
<input type="file" name="fileupload[]">
</td></tr>
<tr><td>
<input type="file" name="fileupload[]">
</td></tr>
<tr><td>
<input type="submit" name="submit">
</td></tr>
</table>
</form>
</body>
</html>

This works for me! :)

OmniX commented: Gave me a working example +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Someone At The Unicef Ripped Nine Insects, No Offence!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Can you show us your script ? What is the error that you are getting ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Have 3 textboxes in your form. Call it firstname, lastname and date_of_birth. The page submits to 'somepage.php'. In somepage.php, you can access the form variables like,

$firstname = $_POST['firstname']; 
$lastname = $_POST['lastname'];
....

Then in your query, you can use these posted form variables. $query="select * from users where firstname='$firstname' AND lastname='$lastname'"; :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

You haven't shown us where you want to include a where clause. You should mention your problem in detail. :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yes.

Do you like rain ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb! I am sure you will learn alot from this community :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

:P Welcome Crapodino!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

E is the 5th letter in English alphabet.

nav33n 472 Purple hazed! Team Colleague Featured Poster

ah! i see.. thanks :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

* Do NOT display the host,username and password while posting in a public forum(Unless you want your database to be hacked!).
* You aren't closing your form.

Anyway, I think you should learn php and mysql first. Here is the script. Name it vote.php and run it. Change table name and the column names.

<?php
$conn=mysql_connect("localhost","username","password"); 
mysql_select_db("dbname");
$query="select user_id from grads";
$result=mysql_query($query);
$option="";
while($row=mysql_fetch_array($result)) {
   $option.="<option value=".$row['user_id'].">".$row['user_id']."</option>";    
}
if(isset($_POST['submit'])) {
$query="UPDATE TABLE SET VOTE = 1 WHERE USER_ID ='".$_POST['priceisright']."'";	
mysql_query($query);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Etobicoke Collegiate Institute's Grad Survey 2008</title>
</head>
<body>
<form action="vote.php" method="post">
<fieldset><legend>Please complete the following questions. Thanks!</legend>

<label>1. Be on the price is right</label><br />
<select name="priceisright">
  <option value="">Please Choose One Person</option>
  <option value="">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />
<input name="submit" value="submit" type="submit">
</form>
</body>
</html>
nav33n 472 Purple hazed! Team Colleague Featured Poster

You wouldn't believe, but I just saw an alien.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome Rick!

P.S You will find help in Windows forum bout formatting your harddisk and installing windows !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb! You forgot to mention the programming language you work on :P

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Nope. It will show all the form variables that are passed. You can then use it to record the choices.

nav33n 472 Purple hazed! Team Colleague Featured Poster

ok.. That's not a problem!

<?php print_r($_POST); ?>

call that handle.php. This will print all the form variables :D !

nav33n 472 Purple hazed! Team Colleague Featured Poster

In handle.php just add print_r($_POST); at the top. You will get all the values passed from the form. You can then update your table by setting 1 for that particular person. And, the password generation script is a function. You just call the function, assign the return value to a variable, use that variable. Eg. $pass=functionname();

:)

nav33n 472 Purple hazed! Team Colleague Featured Poster

I presume that you don't have much knowledge on php. You can go to w3schools and start learning the basics. But anyway, here is the script that you want. Make sure you enter the username and password correctly for your mysql connection,give the correct database name and specify the correct columns in the query.

<?php
$conn=mysql_connect("localhost","username","password"); 
mysql_select_db("student");
$query="select user_id,student_name from student";
$result=mysql_query($query);
$option="";
while($row=mysql_fetch_array($result)){
   $option.="<option value=".$row['user_id'].">".$row['student_name']."</option>";    
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Etobicoke Collegiate Institute's Grad Survey 2008</title>
</head>
<body>
<form action="handle.php" method="post">
<fieldset><legend>Please complete the following questions. Thanks!</legend>

<label>1. Be on the price is right</label><br />
<select name="priceisright">
  <option value="">Please Choose One Person</option>
  <option value="">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />


</body>
</html>

Edit: If you encounter any errors, let me know.

Cheers,
Naveen

Sulley's Boo commented: jug jug jiyo =D +4
nav33n 472 Purple hazed! Team Colleague Featured Poster

It's ok folks, I've just cracked it.
Here's the solution

SELECT username, title, COUNT(replies.comment) AS 'count'
FROM users, topics
LEFT JOIN replies
ON topics.topicid = replies.topicID
WHERE users.userid = topics.userid
GROUP BY topics.title
ORDER BY RAND()

Order by rand() ? Thats something new that I am seeing. What does it order by (which column) ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Replace student_name with user_id in the query that I have given above. Then change, $row to $row.

As I said earlier, generating random password is easy. Check this site. Use that function in your script.

nav33n 472 Purple hazed! Team Colleague Featured Poster

What syntax should I use for my multiple table query? Will a JOIN be the fastest? Or would a simple multi-table query work just as quickly?

I think sub-queries are much faster than joins and also easier to understand.

What is the difference between using INNER and LEFT Joins?

Check this site. Its too confusing(for me) to explain.

And finally, when I access the information using php fetch_row functions, how do I designate which piece of data I am trying to access, since the syntax is $selectedrow and I am selecting from multiple tables, which may have some overlap of fields?

For this, you can use the table name along with the column names and use an alias. Eg.

$query="select emp.name as empname, emp.no as empno, dept.name as deptname, dept.location as deptlocation from employee emp, department dept where emp.deptid=dept.deptid";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
   $employee_name=$row['empname'];
   $department_location=$row['deptlocation'];
   .......
}

I hope that helps! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Phew! :) finally !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Please ask in Java forum :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb! Please post your question in respective programming forum. Read the guidelines before posting. We won't do your homework/office work. So, please show us what you have done so far.
Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome aboard!