nav33n 472 Purple hazed! Team Colleague Featured Poster

I guess Dani assumes that you have enough common sense to not click a link which will obviously get no results :)

:) My point exactly. Why do you need something which don't yield any result ? It's not about assuming (or not assuming) something.

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are almost there! I have modified your code, very small changes.

<?php
if(isset($_POST['submit'])) {
	for($i=1;$i<=$_POST['count'];$i++) {
		$textfieldname = "marquee_".$i;
		print $_POST[$textfieldname];
		print "<br />";
	}
}
?>
<html>
<head>
 
<script language="javascript" type="text/javascript"> 
 
    function addField() { 
    var tbody = document.getElementById("tblBody"); 
    var ctr = tbody.getElementsByTagName("input").length + 1; 
    var input; 
   
    if ( ctr > 15 ) { 
          alert ("If you want to tell the whole world, dont do it all at once please"); 
    }else{ 
   
        if (document.all){ //input.name doesn't work in IE 
            input = document.createElement('<input name="field_'+ctr+'"> x <input name="field_'+ctr+'">'); 
        }else{ 
            input = document.createElement('input'); 
            input.name = "marquee_"+ctr; 
        } 
  
        input.id = input.name; 
        input.type = "text"; 
        input.value = ""; 
        input.className = "textfield"; 
        var cell = document.createElement('td'); 
        cell.style.height = '30px'; 
        cell.appendChild(document.createTextNode(ctr+". ")); 
        cell.appendChild(input); 
        var row = document.createElement('tr'); 
        row.appendChild(cell); 
        tbody.appendChild(row); 
   		document.getElementById('count').value = ctr;   
    } 
}  
</script> 
</head>  
 
 
<body> 
 
 
 
 
    <form name="the_form" id="the_form" method="post" action=""> 
     	<input type="hidden" name="count" id="count">
          <table width="100%"  border="0" cellspacing="0" cellpadding="0"> 
          <tbody id="tblBody"> 
            <tr> 
              <td height="30"> 
                1. <input name="marquee_1" type="text" class="textfield" id="field_1" /> 
              </td> 
            </tr> 
            <tr> 
              <td height="30"> 
                2. <input name="marquee_2" type="text" class="textfield" id="field_2" /> 
              </td> 
            </tr> 
            <tr> 
              <td height="30"> 
                3. <input name="marquee_3" type="text" class="textfield" id="field_3" /> 
              </td> 
            </tr> 
            
             
        </tbody>
        </table> 
          <input name="add" type="button" class="button" id="add" value="Add Another" onClick="addField();"/>           
			<input type="submit" name="submit" value="Get Components" />
           
    </form>
    </body>
    </html>

(P.S. If count value is empty, then it means, 'Add another' button wasn't clicked and no fields were added).

nav33n 472 Purple hazed! Team Colleague Featured Poster

I was solved the problem.
Don't know why I can't use Index as my field in database, after I changed my field name then no problem already. Thanks for helping. :)

FYI, index is a mysql reserved keyword. If at all you want to use them, you should use `, like, `index`. I personally don't prefer using reserved keywords.
Here is a list of reserved keywords.

nav33n 472 Purple hazed! Team Colleague Featured Poster

http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html Check for foreign key constraints, primary key, foreign key in google.

From the above link:
InnoDB rejects any INSERT or UPDATE operation that attempts to create a foreign key value in a child table if there is no a matching candidate key value in the parent table.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hmm.. Right.. This link is missing!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Okay, one more suggestion.

Why should 0 be a hyperlink in this case ?

Posts Currently Negative: 0

Clicking that leads to nowhere. It says,

Sorry - no matches. Please try some different terms.

Look at niek_e's profile for example.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yeah. Don't forget to study.

:D I passed with flying colors already.

nav33n 472 Purple hazed! Team Colleague Featured Poster

case solved. The site was down. :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Ah! that explains it. Thanks for your quick response Dani. Cheers!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Test 2 ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

test ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

:icon_eek: Strange things have been happening lately.
1. Visited threads are still marked as unread ?
2. Even though I made the last post in this thread, php forum doesn't say so.
I have attached the screenshots of the forum and the thread.

One more bug. The url, http://www.daniweb.com/forums/online.php doesn't serve its purpose. When I click this url, all I get is

1 members and 0 guests
Most users ever online was 9355, Jun 1st, 2009 at 8:20 pm.
Last Activity User Name Reverse Sort Order Location
1 Minute Ago nav33n*
Viewing Who's Online

Screenshot attached.
And,
When I double click on the folder icon which on hover says, "Double-click this icon to mark this forum and its contents as read", it makes all the thread in the forum 'read' for time being. When I reload the page, some threads are back to 'unread' status again.

I have checked all these 'errors' couple of times just to make sure I wasn't dreaming (its 2 in the morning) :).

Edit: What happened to my attachments ? :-O

nav33n 472 Purple hazed! Team Colleague Featured Poster

ckeditor ? Hmm.. Haven't tried it. Anyways, goodluck man. Cheers!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Pretty simple. Fetch the data from the database and place it between <textarea> tags. Here is an example.

<?php
if(isset($_POST['save'])) {
	print "<pre>";
	print_r($_POST);
	print "</pre>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Full featured example</title>

<!-- TinyMCE -->
<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		content_css : "css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
</script>
<!-- /TinyMCE -->

</head>
<body>

<form method="post" action="live_example.php">
	<div>
		<h3>Full featured example</h3>

		<p>
			This page shows all available buttons and plugins that are included in the TinyMCE core package.
			There are more examples on how to use TinyMCE in the <a href="http://wiki.moxiecode.com/examples/tinymce/">Wiki</a>.
		</p>

		<!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded -->
		<div>
			<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">
<?php
$con = mysql_connect("localhost","root");
mysql_select_db("test_cms");
$query = "SELECT * FROM category where ct_id=1";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
$contents = $row['ct_description'];
echo $contents;
?>
			</textarea>
		</div>

		<!-- Some integration calls -->
		<a href="javascript:;" onmousedown="tinyMCE.get('elm1').show();">[Show]</a>
		<a href="javascript:;" onmousedown="tinyMCE.get('elm1').hide();">[Hide]</a>
		<a …
nav33n 472 Purple hazed! Team Colleague Featured Poster

EDIT. That's weird. Now I have zero negative :-O

Its fine! I changed it to +1 when I saw your comment :D

Not sure if I like it. I got 3 negative votes for posts where I posted help :(

(and those 3 posts didn't deserve a negative vote!)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi all,

I have a suggestion (not sure if it has already been discussed).

In the profile, at the community tab, we have, for example,

Code Snippets: 10

If this number 10 is made a href linking to all the code snippets posted by that particular user, it would be great.
At present, to find a code snippet posted by a user, we have to go to statistics tab, click on Find all threads started by xyz , then look for "code snippet".
This is like searching for a needle in the haystack if the user has created a lot of threads (okay, I'm exaggerating ;)).

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

Great! That would solve around 80% of the question asked by the members! Good luck..

nav33n 472 Purple hazed! Team Colleague Featured Poster

How about a tutorial on pagination (this question has been asked n number of times) , carts, htaccess, image handling, regular expressions, ...

cwarn23 commented: great suggestions +4
nav33n 472 Purple hazed! Team Colleague Featured Poster

Thats awesome! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Is that all of the error_reporting need to change to "error_reporting = E_ALL & ~E_NOTICE"?

Just now I didn't restart, now I restart already. It does not have the error already. But it still connect to "Please Enter Index and Association Name Completely" although I typed the index and name.

Since you aren't seeing the notices anymore, you have solved that problem. The other 'problem' you are talking about is a user defined error message. That simply means, you have written the logic wrong. I don't have enough time to go through your code, so I can only comment on it later.

What does "error_reporting = E_ALL & ~E_NOTICE" means?

This simply tells the php parser to report all the errors ~(negating or excluding) notices.

nav33n 472 Purple hazed! Team Colleague Featured Poster

What did you change ? php.ini or your script ?
If you are talking bout php.ini, did you restart your server ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Notices are not errors. If you try to use a variable without initializing it, you will get a notice. To disable notices, edit your php.ini and set error_reporting as,

error_reporting = E_ALL & ~E_NOTICE

This will show all the errors except notices.
But, if you want fix these notices, initialize every variable to null or 0 before using it.

nav33n 472 Purple hazed! Team Colleague Featured Poster

I would still think about encrypting my password. :) Anyways, Congrats and good luck.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Umm.. I am not 100% sure if that is how you are supposed to write a query in java. As far as I can see, there is no need to use trigger in your case and its better you post your question in java forum to get satisfactory response :)
Before you post your question in java forum, do a quick google on mysql insert in java . :)

Oh, btw, for better response, please use code tags next time you post your code.

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

I have used zend studio, aptana, php Designer, eclipse, netbeans, maguma studio, dev php, editplus, etc. Among all these, I liked zend studio 5.5 more. The later versions, 6 and 7 had a lot of bugs when I last used it (like irregular brace mismatching, delayed code suggest (in ver7), searching a particular string has to be done by clicking "next" instead of F3, etc). But it also has some unique features like refactor, phpdoc, code completion and so on.
As codejoust mentioned, more features = more bloated = consumption of more system resources!
Aptana is a good alternative to zend studio (and its free!).

nav33n 472 Purple hazed! Team Colleague Featured Poster

Can you explain how you are storing these values in the table ? Here is a simple example of what I am talking about. Its in php, but I am sure its not completely different from java.

<?php
if(isset($_POST['submit'])) {
	$starttime = $_POST['starttime'];
	$endtime = $_POST['endtime'];
	$duration = $endtime - $starttime;
	$query = "insert into table (starttime,endtime,duration) values ('$starttime','$endtime','$duration')";
	mysql_query($query);
}
?>
<html>
<body>
<form method='post'>
Starttime: <input type='text' name='starttime' /><br />
Endtime: <input type='text name='endtime' /><br />
<input type='submit' name='submit' value='submit'>
</form>
</body>
</html>

What it does is, it shows a form where the user can enter the starttime and endtime. Then, when he clicks on submit, it calculates the difference between endtime and starttime and inserts all these 3 values in the table.
I hope this is clear.
P.S. I am considering you enter both starttime and endtime at the same time. (If not, please mention how you are inserting/etc).

nav33n 472 Purple hazed! Team Colleague Featured Poster

Also, try sending a simple mail to see if it works.

<?php
mail("youraddress@domain.com","test","test mail ! Hope it works","from: youraddress@domain.com");
?>

If it does, then its obvious that you missed out something in your other script.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Try this.

$query = "select * from table where Concat( column1, ' ', column2 )
LIKE '%".$search."%'";

This will return all the rows from the table where column1 concatenated with column2 matches $search.
eg.

SELECT *
FROM master_table
WHERE Concat( firstname, ' ', lastname )
LIKE '%alli gator%'
nav33n 472 Purple hazed! Team Colleague Featured Poster

I want to fill that third column(duration) when I insert the values to the first 2 columns..

Why don't you calculate the difference between starttime and endtime and insert the difference while inserting values to the first 2 columns ?
I haven't used triggers myself, but I think its unnecessary to use trigger in this case.

nav33n 472 Purple hazed! Team Colleague Featured Poster

how do i select a row in a table columns i dont know the name of(and find the name of it)? but i know the cell/field of the column has a value of "55"
i also have to EXCLUDE ONE COLUMN that i know the name of.

does anyone know how to make the select statement that seleects all the columns with the value of 55. i only know the name of the column i want to exclude from the search.
?

I am not sure if I understood your question right. As far as I understand your question,
1. you can't select a record/row from the table without knowing the column you are querying on. You should know the column name.
ie.,

$query = "select * from locations where location_name = 'utopia'";

2. If you want to exclude a column from your retrieved result, use only those columns which you want to use. (This is helpful when you have huge queries and horrible execution time).
ie.,

$query = "select  country, pincode from locations where location_name='utopia'";
nav33n 472 Purple hazed! Team Colleague Featured Poster

Instead of storing the password just like a normal string, save it as an encrypted string, using SHA1 or something. This will provide you more security as well as solves your issue.
Here is an example to clarify any further doubt.

<?php
echo SHA1("ABC");
echo "<br />";
echo SHA1("abc");
?>
nav33n 472 Purple hazed! Team Colleague Featured Poster

We are getting close. When I put this code in my site and run it from the webpage it doesn't work properly. What happens is it opens google.com in a very tiny window where the "Click" button was. I don't want a pop up window but rather have it load google.com full size in the current window.

I don't know if this makes a difference but I'm inserting the code as a Widget in iWeb 09.

It works as it is. I haven't used iweb09, so I don't have the slightest clue :(
If you post your relevant code, maybe someone who has experience on iweb 09 can help you out!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi! Welcome to Daniweb.. Is this what you want ?

<html>
<head>
<script type="text/javascript">
function enableButton() {
	if(document.getElementById('option').checked){
		document.getElementById('b1').disabled='';
	} else {
		document.getElementById('b1').disabled='true';
	}
}
</script>
</head>
<body onload="enableButton();">
<form method="post">
<input type="checkbox" name="option"  id="option" onclick="javascript:enableButton();">Enable<br>
<input type="button" name="b1" value="Click" id="b1" onclick=location.replace('http://www.google.com') />
</form>
</body>
</html>
darkagn commented: Excellent suggestion. +6
nav33n 472 Purple hazed! Team Colleague Featured Poster

Why would somebody want to do that ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Sorry ! What does this code snippet do btw ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Interesting! ;)

Excellent!

You made it to Speed Level 4 (out of 5)

58 out of 70 correct

nav33n 472 Purple hazed! Team Colleague Featured Poster

What is the problem ? You would be selecting CourseName and courseID. So, when you post the form, You will have "MATHS" in $_POST and "101" in $_POST. Then it is all about the insert query.
Or am I missing something ? :-/

nav33n 472 Purple hazed! Team Colleague Featured Poster

The variables $table and $suburb will be empty when the page is first loaded. They will only populated once the form has been submitted - whatever other problems there may be, I think this should be avoided by using an if statement to check that the form has been submitted before executing any other code.

:) Thanks for waking me up. That is absolutely right.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Go to mysql console and create a new user either by following http://dev.mysql.com/doc/refman/5.1/en/adding-users.html OR go to phpmyadmin -> mysql database -> user table. Add a record there filling suitable fields and giving relevant privileges.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Can you post your code ? (and print the variable $sql and post it here ?)
I guess the variable $table is empty or something.

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Wohoo! Good luck..

nav33n 472 Purple hazed! Team Colleague Featured Poster

Are you using Linux server ? If yes, then make sure to check the case (lowercase/uppercase) of table and column names. Linux is case-sensitive. :)
Did you try printing out the query and executing it in mysql ?

Well, here is a quote from php.net

mysql_fetch_array
Return Values:
Returns an array of strings that corresponds to the fetched row, or FALSE if there are no more rows.

As you can see, you are using the empty result resource in the while loop. Try this.

<form action="" method="post" name="Form">
   <p>Business Type:
   <select name="table" id="table">
  <option value="Plumber">Plumber</option>
  <option value="Electrician">Electrician</option>
  <option value="Painter">Painter</option>
  </select>
  </p>
  <p>Suburb:
  <select name="suburb" id="suburb">
  <option value="Bucketty">Bucketty</option>
  <option value="Kulnura">Kulnura</option>
  <option value="Gosford">Gosford</option>
  </select>
  <br />
   
  <input type="submit" name="submit" value="Submit" />
  </p>
 </form>
      

<?php
$table = $_POST['table'];
$suburb = $_POST['suburb'];
$sql = "SELECT * FROM $table WHERE Suburb='$suburb'";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0) {
	while ($row = mysql_fetch_array($result)) {
	  echo '<br/> Name: '.$row['Name'];
	  echo '<br/> Suburb: '.$row['Suburb'];
	  echo '<br/> Listing: '.$row['Listing'];
	  echo '<br/><br/>';
	}
} else {
	echo "No records found :)";
}      
?>
nav33n 472 Purple hazed! Team Colleague Featured Poster

Hmm.. I tried your code snippet and it worked fine. There is one thing that I'd always do after having a header, an exit. This might or might not fix the problem, but try having an exit after readfile function. :-/

nav33n 472 Purple hazed! Team Colleague Featured Poster

Try

<?php ob_start(); ?>

to turn on output buffering (should be the 1st line of your code) and

<?php ob_flush(); ?>

as the last line to flush the buffered output.

nav33n 472 Purple hazed! Team Colleague Featured Poster

1. Do you have mysql_connect ?
2. Are you selecting the database ?
3. Does that table exist ?
4. Are you sure the query is correct ? Ie., echo the query and test it in phpmyadmin/mysql console.

If your answer is *yes to all*, please post your complete code, so that others can assist.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Thank you for posting the examples. I looked at the manual and did not understand it. I like forums where people post their own examples and not just refer to "manuals" because it helps me learn more. Thanks for your help.

I noticed, its your first post on Daniweb. Welcome to Daniweb! :)


P.S. Some people will never change. They are always whining.
:icon_rolleyes: Bah! Nevermind.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Ah! I see.. Happy learning :) Cheers!

nav33n 472 Purple hazed! Team Colleague Featured Poster
<label>Content: <textarea name="Content" /><?php echo $row['Content'];?></textarea></label><br />

Pretty simple ? eh ? :)

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php

if ( isset( $_POST['send'] ) ) {  
  $Title = $_POST['Title'];
  $Subtitle = $_POST['Subtitle'];
  $Content = $_POST['Content'];
  $Author = $_POST['Author'];
  $Date = $_POST['Date'];
  $id = $_POST['id'];

		  
		  echo $sql = "UPDATE `indexinfo` SET
          `Title` = '$Title',
          `Subtitle` = '$Subtitle',
        `Content` = '$Content',
        `Author` = '$Author',
          `Date` = '$Date'
          WHERE `id` = 1";  

  if (mysql_query($sql)) {
    echo '<p>Author details updated.</p>';
  } else {
    echo '<p>Error updating author details: ' .
        mysql_error() . '</p>';
  }

$result = mysql_query("select * from `indexinfo` where id = 1");
$row = mysql_fetch_array($result);
?>
<form action="#" method="post">
<p><h2>EDIT ZONE <?php echo $id;?>:  </h2></p>
<label>Title:<input type="text" name="Title" value="<?php echo $row['Title']; ?>" /></label><br />
<label>Subtitle: <input type="text" name="Subtitle" value="<?php echo $row['Subtitle']; ?>" /></label><br />
<label>Content: <TEXTAREA name="Content" ROWS=10 COLS=100><?php echo $row['Content']; ?></TEXTAREA><br />
<label>Author: <input type="text" name="Author" value="<?php echo $row['Author']; ?>" /></label><br />
<label>Date: <input type="text" name="Date" value="<?php echo $row['Date']; ?>" /></label><br />

<input type="submit" value="Submit" name="send" /></p>
</form>
<?php
} else {
?>
<form action="#" method="post">
<p>EDIT ZONE 1:</p>
<label>Title: <input type="text" name="Title"  /></label><br />
<label>Subtitle: <input type="text" name="Subtitle" /></label><br />
<label>Content: <TEXTAREA name="Content" ROWS=10 COLS=100></TEXTAREA><br />
<label>Author: <input type="text" name="Author" /></label><br />
<label>Date: <input type="text" name="Date" /></label><br />
<input type="hidden" name="id" />
<input type="submit" value="Submit" name="send" /></p>
</form>
<?php } ?>

Didn't test it, but I hope you can see the difference. ie., $row :)

You should also consider sanitizing user's inputs. Check out mysql_real_escape_string !
Btw, the value of $id is always null in this above script. You aren't assigning a value to $id anywhere …

nav33n 472 Purple hazed! Team Colleague Featured Poster

http://www.tizag.com/mysqlTutorial/mysqlfetcharray.php
You should use the array returned by mysql_fetch_array and not the result resource itself. ie., $row, $row etc and not $result !