nav33n 472 Purple hazed! Team Colleague Featured Poster

There seems to be a problem with the smallest bit I have to enter the follwing numbers in this order 89;44;20 a
This outputs 44 as the smallest if I change the order 20;44;89 then it outputs 20.

Are you sure about that ? I don't think so. It works fine for me.

And most importantly all the outputs have to be one under the other I tried adding <br> and <p> tags but this dose not work.

Try "\n".

<html>
<head>
<script type="text/javascript">
var firstnumber = prompt("Enter first number and Click OK", "0");
var secondnumber = prompt("Enter second number and Click Ok", "0");
var thirdnumber = prompt("Enter third number and Click Ok", "0");
var total = Math.floor(firstnumber)+ Math.floor(secondnumber)+ Math.floor(thirdnumber);
var average= (Math.floor(firstnumber)+ Math.floor(secondnumber)+ Math.floor(thirdnumber))/3;
var largest = Math.max(firstnumber, secondnumber, thirdnumber);
var smallest = Math.min(firstnumber, secondnumber, thirdnumber);
alert("Sum: " + total + "\n Average: " + average + "\n smallest:" + smallest + "\n largest: " + largest +"\n")
</script> 
</head>
<body>
</body>
</html>
nav33n 472 Purple hazed! Team Colleague Featured Poster

Yep :) Almost like Daniweb's "Go Advanced" and "preview" buttons !

nav33n 472 Purple hazed! Team Colleague Featured Poster

umm.. the form doesn't have a submit button..
But anyway, I am sure it works.

nav33n 472 Purple hazed! Team Colleague Featured Poster

The script that I posted works fine for me, you can see it here.
http://dev.ositnet.com/test.php

:@ Its asking for username and password !

P.S. Its working for them now.. ;)

nav33n 472 Purple hazed! Team Colleague Featured Poster

I don't think so. uncomment print_r($_POST) and see if it shows any data on page load.

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

Thanks Troy III, for taking the time out to look at my script.

I’ve made the recommended changes but the problem still persists as it doesn’t prompt the user for the integer an I have no idea how to displays the average, product, smallest and largest of the numbers in an alert dialog. All I manage was the sum part.

<script type="text/javajscript">
<!--

var firstNumber, secondNumber, number 1, number2, number3, sum;

firstNumber= window.prompt( 'Enter the first number", "0" );
secondNumber = window.prompt( 'Enter the second number", '0' );
ThirdNumber = window.prompt( 'Enter the third number", '0' );
number1 = parselnt( firstNumber ); number2 = parselnt( secondNumber );number3 = parselnt( ThirdNumber );
sum = number1 + number2 +number3;

window.status = "sum: " + sum;

-->
</script>
</head>
<body onload="window.prompt;">

</body>
</html>

Here are some more changes.
1. script type="text/javascript". You have a typo.
2. its parseInt and not parselnt.
3.

<body onload="window.prompt;">

Doesn't make any sense to me. You don't need it.
And ofcourse, don't forget points mentioned by Troy III !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yes you can. Just keep it within the form tag.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Okay ! I have attached a working copy of the editor. Check it and tell us if you still have problems!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Umm.. what are you guys trying ? Tinymce or fckeditor ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

hi
in my ftp
public_html/tinymce/jscripts/tiny_mce/tiny_mce.js
i have the below path as

<script language="javascript" type="text/javascript" src="./tiny_mce/tiny_mce.js"></script>

As you can see, you have the wrong path in src. :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

In the above example, test.php , we have this line.

<script language="javascript" type="text/javascript" src="./tiny_mce/tiny_mce.js"></script>

Check if tiny_mce.js exists in the above path. If the file (tiny_mce.js) doesn't exist in the path specified, specify the right path.
./tinymce/jscripts/tiny_mce/tiny_mce.js thats the path in the latest tiny_mce version.

nav33n 472 Purple hazed! Team Colleague Featured Poster

ya did that but i got only a text area and a submit buuton

Check if the path you specify in scr=..../tiny_mce.js is correct.

nav33n 472 Purple hazed! Team Colleague Featured Poster

it's bullcrap. if you're gonna post something funny, make sure IT IS funny.

lol.

i laughed so hard it took me five minutes to get through it!! Seriously funny to me

It's a very funny memo...

I think people found it funny :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Here is a simple example.

<?php
	if(isset($_POST['submit'])) {
			if(isset($_POST['option'])) {
			$option = $_POST['option'];
			if($option == "yes") {
				//insert or update or do whatever you want with the posted values
				header("location: page3.php");
			} else {
				header("location: page4.php");
			}
		} else {
			echo "You didn't select an option!";
		}
	}
?>
<html>
<body>
<form method="post" action="page1.php">
<input type="radio" name="option" value="yes"> Yes <br />
<input type="radio" name="option" value="no"> No <br />
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

Submit the page to itself and then take relevant action.

nav33n 472 Purple hazed! Team Colleague Featured Poster

You can download tinymce editor from the url you have provided. Here is an example how you can use it.

<?php
if(isset($_POST['submit'])) {
	print_r($_POST);
}
?>
<!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" xml:lang="en" lang="en"><head>
	<script language="javascript" type="text/javascript" src="./tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
	mode : "textareas",
	theme : "advanced",
	plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
	theme_advanced_buttons1_add_before : "save,separator",
	theme_advanced_buttons1_add : "fontselect,fontsizeselect",
	theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
	theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
	theme_advanced_buttons3_add_before : "tablecontrols,separator",
	theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_path_location : "bottom",
	plugin_insertdate_dateFormat : "%Y-%m-%d",
	plugin_insertdate_timeFormat : "%H:%M:%S",
	extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
	external_link_list_url : "example_data/example_link_list.js",
	external_image_list_url : "example_data/example_image_list.js",
	flash_external_list_url : "example_data/example_flash_list.js"
});
</script>
</head>
<body>
<form method="post" action="test.php">
<textarea name="description" cols="100" rows="27"></textarea>
<input type="submit" name="submit" value="submit" />
</form>
</body>
</html>

Copy this code and call it test.php . Don't forget to give the right path for tiny_mce.js :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Umm.. okay ! I won't mark this 'solved' until its fixed ;)

nav33n 472 Purple hazed! Team Colleague Featured Poster

As you have said it already, You can get the contents of the csv file to an array (keeping ID as key), modify/update the required records, write the data back to csv again using fputcsv .

nav33n 472 Purple hazed! Team Colleague Featured Poster

http://in.php.net/fopen Check out the different modes.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Is there a way I can alter my existing code to be able to do this for just the ID (the first column in my table)?

Use print_r to display the array contents and use the required field. ie., print_r($data);

Doesn't create a URL, just text, can I alter that to create a URL out of it?

print "<a href='http://www.somesite.com?id=$id'> Click here </a>"; ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hmm.. I see..

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yep. It will create a user called "naveen" with password "password1" and grant SELECT,INSERT,UPDATE,DELETE permissions for that user.

kevin wood commented: one of the most helpfull people i have come across +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

var seconds= <?=$aegs?>;

Try with double quotes around.
ie., var seconds= "<?=$aegs?>"; Do the same with the rest of javascript variables.

nav33n 472 Purple hazed! Team Colleague Featured Poster

is it possible to create a new db on the server with a new user name and password without having to login to the phpmyadmin section on the control panel on the server?

You have to create a new user (and grant required permissions) using 'root' credentials.
Eg.

<?php
$con = mysql_connect("localhost","root");
mysql_select_db("test");

$query = "Create user 'naveen'@'localhost' IDENTIFIED BY 'password1'";
mysql_query($query);
$query2 = "GRANT SELECT,INSERT,UPDATE,DELETE ON *.* TO 'naveen'@'localhost'";
mysql_query($query2);

mysql_close($con);
echo mysql_connect("localhost","naveen","password1");
?>

I am sorry! I don't have a link to any good tutorial.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Why does it say "Activate your membership to contribute" for closed threads ? See the screenshot to see what I am talking about !

nav33n 472 Purple hazed! Team Colleague Featured Poster

There is nothing wrong with your create table query. The only thing that I found missing was the dot operator. Do you still have the error ? If yes, you need to post your complete code as I don't see any other errors!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Open your php.ini file and look for "File Uploads". Check upload_tmp_dir path. If there isn't any, specify the path. Restart web server and try again !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Check if you have a path for the temp directory in upload_tmp_dir in php.ini , you have all the permissions for that folder. Your code seems ok to me. But, in this part, it will check if the file already exists. If it does, then you are overwriting the original file and then displaying the message 'file already exists'. :S

if (file_exists("/upload/" . $_FILES["description"]["name"]))
{
move_uploaded_file($_FILES["description"]["tmp_name"], "/upload/" . $_FILES["description"]["name"]);
echo "Your description has been uploaded: " . "upload/" . $_FILES["description"]["name"];
echo $_FILES["description"]["name"] . "already exists.";
}
else
{
move_uploaded_file($_FILES["description"]["tmp_name"], "/upload/" . $_FILES["description"]["name"]);
echo "Your description has been uploaded: " . "/upload/" . $_FILES["description"]["name"];
}

nav33n 472 Purple hazed! Team Colleague Featured Poster

i have wrote a code for file uploader and it was working fine but now its getting sme problems...

Be specific. What problem exactly ?
P.S Please use [code] tags next time you post your code.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Use die with mysql_query.
ie., $result = mysql_query($query) or die (mysql_error()); If your query fails, it will 'inform' you why it failed.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Nevermind. Thats a bad idea. :( I still can't think of a way to achieve this. Anyone else has any ideas on this one ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

I don't use language in the code tags because I don't like the colors it adds. It makes the page harder to read.

I think its the other way around ! Highlighted syntax is much easier to read. Oh well, everyone has their own likes and dislikes :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

What exactly are you trying to do ? Because, earlier you said,

When I am trying to run a while loop to determine if one of the (many) email addresses inside my "table_1" match any of the email addresses inside my "table_2".

Now you are saying,

I don't need a number of emails, I need to know if a specific email address is inside both MYSQL tables.

Can you be more specific ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

You can do it this way (I think). Since it has a .rar extension, you can download the file to the temp folder, rename it and then stream it. :S I don't know about any other possible way.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Umm.. The AddType will 'inform' php parser to parse files with .gne extension just like a php file. I don't think that will solve your problem. Why don't you use rename to rename your .rar file to .flv ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Here is an example.

<?php
$handle = fopen('somefile.csv', 'r');
if ($handle)
{
  
    //the top line is the field names
    $fields = fgetcsv($handle, 4096, ',');
   
    //loop through one row at a time
    while (($data = fgetcsv($handle, 1000, ',')) !== FALSE)
    {
        $name=$data[0];
        $address=$data[1];
        print "somesite.com?id=".$name.$address;
    }

    fclose($handle);
}
?>

If it isn't clear enough, just ask :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

"U can't touch this" should have been "U shouldn't touch this!!!" ;)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yep! it seems like a tough job for me!

nav33n 472 Purple hazed! Team Colleague Featured Poster

I am not sure. Maybe this could help.
http://phpbuilder.com/manual/en/faq.com.php#faq.com.q1

nav33n 472 Purple hazed! Team Colleague Featured Poster

mysql_query($sql) or die (mysql_error() mysql_errno());

Try this.

mysql_query($sql) or die (mysql_error(). mysql_errno());

Notice the concatenation operator .
Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

Or even tinymce editor.

nav33n 472 Purple hazed! Team Colleague Featured Poster

You should use parseInt.

var1=document.getelementbyid('txt1').value;
var2=document.getelementbyid('txt2').value;
var3=parseInt(var1)+parseInt(var2);
alert(var3);
nav33n 472 Purple hazed! Team Colleague Featured Poster

Can you post your code ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

help me asap!!!>>> please...

No one will help you unless you mention your problem. :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

date is a mysql reserved keyword. Its better if you change the column name "date" to something else. If you don't want to change the column name, use ` around the column name. Oh, btw, if your query isn't still working, print your query and execute it in mysql console/phpmyadmin.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Argh! You are right. Php doesn't like . in the names of form elements. It replaces . by _.

<?php
print_r($_POST);
?>
<html>
<body>
<form method="post">
<input type="text" name="some.name">
<input type="submit" name="submit.1" value="submit">
</form>
</body>
</html>

Hmm.. strange! Lets see if someone else has an idea !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Are you sure the path for temp dir is correct in your php.ini file ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Permissions maybe ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Ah :@ lol.. You are welcome!