nav33n 472 Purple hazed! Team Colleague Featured Poster

You can do this in 2 ways. One, to store whatever the user enters in text box in a table and then get the records from the table and use it in drop down list. The second method, which is a temporary method, is to have a session array variable, which stores the values of the text entered by the user in the textbox. Then, loop through the array and use it in dropdown list. As I said, this is only a temporary solution.
Btw, you can also use javascript to do the same. Here is the link.
http://www.w3schools.com/htmldom/met_select_add.asp

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

While fetching, use str_replace to replace "<br />" with "".
ie.,

str_replace("<br />", "", $data);
nav33n 472 Purple hazed! Team Colleague Featured Poster

As cwarn23 has already mentioned, Php is case sensitive. The 'case sensitivity' of mysql depends on which server it is on. Linux is strictly case sensitive while windows is not.
You can try by changing userID to userid in your query and try again!

nav33n 472 Purple hazed! Team Colleague Featured Poster

I would rather do something like this.

select * from table where column REGEXP "am.*.a"

The regular expression will search the column for any value which starts with am and ends with a. I can't think of any other alternative solution!

nav33n 472 Purple hazed! Team Colleague Featured Poster

It would really help if you tell us what errors are you getting and also, by using code-tags to wrap your code.

nav33n 472 Purple hazed! Team Colleague Featured Poster
Select * from suppliers group by supplier_TIN order by supplier_num desc;

This will list all the records with least supplier_num ..

nav33n 472 Purple hazed! Team Colleague Featured Poster

Column names which are mysql keywords have to be wrapped in ` or else, it would give the above error. date, status, from etc are all keywords.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Have an onclick event at the coordinates.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Google is your best friend.

nav33n 472 Purple hazed! Team Colleague Featured Poster

I don't understand, where is the textarea that you mentioned in your earlier post ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Great! You are welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Umm.. Yeah, well, almost.. This looks good except the part where you insert string values to a varchar column of the table. Strings should be wrapped in ' single quotes.. So, pass the values accordingly.. ie.,

$obj_Connection = new Database();
$obj_Connection->getConnection();
$table = "food";
$columns = "type, calories";
$data = "[single_quote_here]'cake'[/single_quote], 1000";
$obj_Connection->insertToTable($table, $columns, $data);
$obj_Connection->closeConnection();

I hope you understood what I am talking bout.

Venom Rush commented: Thanks for the help. Really appreciate it ;) +2
nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
session_start();
$_SESSION['seekerid']="test";
?>
<html>
<head>
<script type="text/javascript">
      function addmanips(){ 
         var nW = window.open('add_qualifica.php?seeker_id=<? echo $_SESSION["seekerid"]; ?>&action=new','AddQualification','width=640,height=480,menubar=no,status=no,location=no,toolbar=no,scrollbars=no'); 
       	 nW=null;
	   } 	
	</script>
	</head>
	<body onload='addmanips();'>
</body>
</html>

this works for me!

nav33n 472 Purple hazed! Team Colleague Featured Poster

The example posted above can also deal with multiple tables. But, if you have different forms and different operations (like one form inserting a record to food table, another form to animals table, etc), you can have multiple functions. Sorry for my ignorance, but, I am not really sure what exactly is the problem :-/

nav33n 472 Purple hazed! Team Colleague Featured Poster

hi.........
help me plss to write coding to open a new pop up window while clicking on specific points on a map...


regards
enet

This is called imagemapping. Check this out!
http://www.milonic.com/menusample4.php

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi there! I am not sure about the idea of an abstract class or an interface. Here is a simple example of a class with 3 functions, getConnection, closeConnection and insertToTable. getConnection is to connect to the database and closeConnection to close(!). The function insertToTable takes 1 parameter, that is an array. You can pass as many values you want through the array and insert relative values to the table.

<?php
class Database {
	private $db_connection;
	public function getConnection(){
		$this->db_connection=mysql_connect("localhost","root","passw");
		mysql_select_db("databasename");
		if(!$this->db_connection) {
			die('Could not connect'.mysql_error());
		} else {
			return $this->db_connection;
		} 
	}
	public function closeConnection() {
		mysql_close($this->db_connection);
	}
	public function insertToTable($data){
		 $animal_type = $data['animal_type'];
		 $animal_age = $data['animal_age'];
		 /* and all the other data */
		 $insert_to_table1 = "insert into animal (type) values ('$animal_type');
		 mysql_query($insert_to_table1);
		 $insert_to_table2 = "insert into animal_age (age) values ('$animal_age');
		 mysql_query($insert_to_table2);
	}
}	
$obj_Connection = new Database();
$obj_Connection->getConnection();
$data = array();
$data['animal_type'] = "dog";
$data['animal_age'] = 12;
$obj_Connection->insertToTable($data);
$obj_Connection->closeConnection();
?>

Cheers!

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
session_start();
$_SESSION['user']="test";
echo "<script type='text/javascript'>alert('".$_SESSION['user']."');</script>";
?>

Like this ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

i get this error when i try to add the field

Error
SQL query: 

ALTER TABLE `default_en_comments` ADD `comment_id` INT NOT NULL AUTO_INCREMENT FIRST 

MySQL said:  

#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key

You should make this column comment_id as primary key. I guess, you have a user table(which should also have a column 'user_id' and it should be a primary key). When saving the comment from a particular user, say with user_id=1, insert a record in the comments table for this user (There should also be a column user_id (foreign key) in comments table so that you know who posted the comment).
Here is an example of the table structure I am talking about.
This is the users table.

Table USERS
 -user_id (auto increment, primary key)
 -user_name (varchar)
 -user_password(varchar)
 .....other user details

This would be the comments table

Table comments
 -comment_id (auto increment, primary key)
 -user_id (which references user_id of user table)
 -comment (varchar/text)
.... and all the other fields which you think are required.

When the user posts a comment, you need to insert a record in the comment table where user_id is the user_id of the logged user. This way, you can also have an option to edit the posted comment/or delete it.

I hope this will clear some doubts!

Cheers,
Nav

nav33n 472 Purple hazed! Team Colleague Featured Poster

Use nl2br function :)
ex.

$message_with_breaks = nl2br($_POST['message']);
nav33n 472 Purple hazed! Team Colleague Featured Poster

If you 'investigate' properly in phpmyadmin, there is an option exactly below the table's structure to add a new column. You can specify the columnname, its datatype and mention "auto_increment" under extra. :-) Its quite simple.

ALTER TABLE tablename ADD columnname INT NOT NULL AUTO_INCREMENT

is the query (just in case if you can't find it!)

nav33n 472 Purple hazed! Team Colleague Featured Poster

If you want to 'move' a column from one table to another table, both the tables should have a common column to link these 2 tables. First, as Vermadba has mentioned, you have to create a column called "id" in table_2 first. Then, update the second table's "id" column using joins.
For example,

update table_2,table_1 set table_2.id=table_1.id where table_1.counter = table_2.counter

This will update table_2's id column with id values of table_1.
Then delete the column "id" from table_1.
Cheers,
Nav

nav33n 472 Purple hazed! Team Colleague Featured Poster

Using set_time_limit(0) in your script will make the maximum execution time to 'infinity'. This usually happens if you are processing large number of data or if one of the loop in your script has failed..

nav33n 472 Purple hazed! Team Colleague Featured Poster

There are so many extra }. You need to post your complete code because this code doesnt make much sense.

nav33n 472 Purple hazed! Team Colleague Featured Poster

or wamp :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

There is nothing in $service_category. It is empty. Thats the reason.

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
$reg = '/<td>(.*)<\/td>/s';
$sub = '<td><a class="page" title="myPage" href="/mypage/888"><img class="hotel" src="mypage.png" /></a></td>';
preg_match($reg,$sub,$matches);
print htmlentities($matches[1]);
?>

Cheers!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Use php's date function.
http://in2.php.net/date

nav33n 472 Purple hazed! Team Colleague Featured Poster

Nope. You dont have to include anything. I don't understand why it isn't working for you, but its writing the contents to the excel file when I execute the script :-/

nav33n 472 Purple hazed! Team Colleague Featured Poster

$sql = "INSERT INTO `wkho_users`.`directory` (id, organisation, type, addr1, addr2, addr3, addr4, addr5, pcode, phone, fax, gen_email, other, person, position, ext, pers_email) VALUES ('','$org','$type', '$addr1','$addr2','$addr3','$addr4','$addr5','$pcode','$telno','$fax','$web','$notes', '$name','$title','$ext','$email'";

Missing ) in the end.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Since you are trying to use .png files, $im_src = imagecreatefromjpeg($source); will not work. Because, imagecreatefromjpeg will work for jpeg files !
If you want to work with .png files , you should use imagecreatefrompng .

nav33n 472 Purple hazed! Team Colleague Featured Poster

I didn't go through your code. But this is wrong.

if ($membersprofiles[username]= $username)
{
$bank_balance = $bank[bank_balance];

}

You are comparing. so, you need ==.

if ($membersprofiles[username] == $username)
{
$bank_balance = $bank[bank_balance];

}
nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi Nav33n,

I still not able to make it work. I can see the .xls file is open and save base on the time of modify. But when I open the file, it's empty. Do you know what's wrong with it.

Thank you
enz

There are only 2 possible reasons.
1. The permission on .xls file.
2. You aren't writing any data to the file. Maybe the variable is empty ?
Try writing a string to the file and see if it works. That is,

<?php
$fp = fopen("test.xls","a+");
fwrite($fp,"This is some string");
fclose($fp);
?>

See if it works!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi Nav33n,

I tried that code, open file seems to be alright but the fwrite doesn't seem to work. I put the xls file in the same folder with the .php file. I run the .php file a few times but nothing write to the .xls file.

I google the command and saw that they also used the same with the one you provided, dont know where i'm doing wrong. :(

enz

Umm.. Can you read data from the excel file ? Try that ! also check file permissions. :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

mcd is right. You need to pass the array as a parameter if you want it to use inside a function.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hmm.. Comment out this line $body2=rtrim(chunk_split(base64_encode($body2))); for time being ! I am wondering why it is not working! I hope someone else has an answer :?:

nav33n 472 Purple hazed! Team Colleague Featured Poster

If you echo $body2, you will see an encoded string. That is because, you are using base64_encode for $body2.

nav33n 472 Purple hazed! Team Colleague Featured Poster

:-/ This script is working fine for me! I get mails with html tags.

nav33n 472 Purple hazed! Team Colleague Featured Poster

The names of your input are wrong. That is,

<label>
Movie Name: <input name=\"$moviename\" type=\"text\" value=\"$moviename\" size=\"31\" maxlength=\"30\" />
</label>

name=\"moviename\" and not name=\"$moviename\" Since the variables will be empty, the input tags name will be empty too.

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
$value1 = $_POST['something1'];
$value2 = $_POST['something2'];
$value3 = $_POST['something3'];
$fp=fopen("example.xls","a+");
$test="$value1 \t $value2 \t $value3 \t \n";
//where $value1,$value2 and $value3 POSTED values to write to excel
fwrite($fp,$test);
fclose($fp);
?>
nav33n 472 Purple hazed! Team Colleague Featured Poster

Here is an example.

<?php
$file="test.xls";
$test="<table border=1><tr><td>Cell 1</td><td>Cell 2</td></tr></table>";
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$file");
echo $test;
?>
nav33n 472 Purple hazed! Team Colleague Featured Poster

I just passed a dummy value for $groupname and it works. I stick to my words, your variable is empty, so it isn't working.

nav33n 472 Purple hazed! Team Colleague Featured Poster

I don't really understand what your script does!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Looks good ! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster
CREATE TABLE `dw_order_items` (
  `order_item_id` INTEGER unsigned NOT NULL auto_increment  PRIMARY KEY,
  `order_id` INTEGER unsigned NOT NULL,
  `item_id` INTEGER unsigned NOT NULL,
  `item_qty` INTEGER UNSIGNED NOT NULL DEFAULT 1
)

This will also create an index on the primary key, order_item_id. :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hey Thanks a bunch.. I think I got it resolved for now, until I find another problem with it..

I just changed my sql table from this:

CREATE TABLE `dw_order_items` (
  `order_id` INTEGER unsigned NOT NULL,
  `item_id` INTEGER unsigned NOT NULL,
  `item_qty` INTEGER UNSIGNED NOT NULL,
  PRIMARY KEY  (`order_id`, `item_id`)
)

to this:

CREATE TABLE `dw_order_items` (
  `order_id` INTEGER unsigned NOT NULL,
  `item_id` INTEGER unsigned NOT NULL,
  `item_qty` INTEGER UNSIGNED NOT NULL
)

And it worked out.. Seems that the primary keys were screwing it up when this table did not need one.. I guess this table was more of a storage area for the id's and quantity..

Couldn't have done it without your help.. THANK YOU!!!

The obvious reason why you got that error was, you have order_id (or is it item_id) as primary key. Primary keys have to be unique and it shouldn't be null. I believe, you already had an entry for 8. Take Demiloy's suggestion. You don't have to make item_id/order_id an auto increment field, but, you can have an integer field (id or counter) in your mysql table and make it auto_increment and primary key. (I believe, if you make a key primary, its also becomes the index). If it isn't marked as 'index', you can do that.
I isn't a good thing for a table not to have indexes (or primary key). Since, you are calling this a 'storage area', you need index if you want to speed up your query execution.

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

Use explode to explode the string to an array and use the 2nd index. ie., $array[2].

nav33n 472 Purple hazed! Team Colleague Featured Poster

So the $dataholder array would just have the data for the matched ID?

No. In the above example, $dataholder will have all the records of the csv file.

What if I want to pull the individual fields from that array?

You can do that by specifying the id. If you want to pull the record for id 4, $dataholder[4] will pull the relevant record.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Do you know html ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

i changed the body accordingly. i am trying to get to info sent to my email and then have the page redirected to my paypal page. i get this message "Parse error: syntax error, unexpected '<' in /home/mysigninname/public_html/orderformprocess4.php on line 48"

<?php

/* Subject and Email Variables */

	$emailSubject = 'Crazy PHP Scripting!';
	$webMaster = 'myemail@gmail.com';
	
/* Gathering Dara Variables */

	$nameField = $_POST['name'];	
	$emailField = $_POST['email'];
	$lettersubjectField = $_POST['lettersubject'];
	$colorField = $_POST['color'];
	$angelcharacterField = $_POST['angelcharacter'];
	$recipientnameField = $_POST['recipientname'];
	$cityField = $_POST['city'];
	$streetnameField = $_POST['streetname'];
	$friendsiblingField = $_POST['friendsibling'];
	$genderField = $_POST['gender'];
	$ageField = $_POST['age'];
	$schoolField = $_POST['school'];	
	$fromField = $_POST['from'];
	$toField = $_POST['to'];
	
	$body = <<<EOD
<br><hr><br>
Name: $nameField <br>
Email: $emailField <br>
Letter Subject: $lettersubjectField <br>
Color: $colorField <br>
Angel Character: $angelcharacterField <br>
Recipient Name: $recipientnameField <br>
City: $cityField <br>
Street Name: $streetnameField <br>
Friendsibling: $friendsiblingField <br>
Gender: $genderField <br>
Age: $ageField <br>
School: $schoolField <br>
From: $fromField <br>
To: $toField <br>
EOD;

	$headers = "From: $email\r\n";
	$headers .= "Content-type: text/html\r\n";
	$success = mail($webMaster, $emailSubject, $body, $headers);
	

<script language="JavaScript" type="text/JavaScript">
<!--
window.location.href = "https://www.myredirect.com
</script>	

?>

If you read the error message, it clearly says the problem is in the line with <script language... > tag. You need to close your php tag ?> before <script>.