vibhaJ 126 Master Poster

Here is a bit change in login code.

$results = mysql_query($login) or die(mysql_error());
if(mysql_num_rows($results) == 0) 
{
    echo "Invalid login";
    exit;
}
else
{
    echo "Successfull Login";
    exit;
}
vibhaJ 126 Master Poster

Based on error it seems you haven't provide space after FROM.
There must be a space after FROM for proper query.

vibhaJ 126 Master Poster

Try

$radmin="SELECT * FROM ".self::$admin;
vibhaJ 126 Master Poster

Check this..

<!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>Untitled Document</title>
<script language="javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script>
	function chooseGender()
	{
		var selectGender = $('input[name=gender]:checked', '#submitgender').val();
	 	if(selectGender)
		{
			$.ajax(
			{
				type: "POST",
				url: "ajax.php",
				data: "gender="+ selectGender,
				success: function()
				{
					$("#submitgender").hide();
					$("#rest").show();
				}
			});
		}
		else
		{
			alert('Select Gender.');
		}
	}
	</script>
</head>

<body>
<form id="submitgender" method="post">
	<table cellspacing="0" class="news" align="center" id="gender">
		<tr>
			<td colspan="2" style="border-bottom:1px solid #000;">
			<center>Click on your gender:<br>
			</td>
		</tr>
		<tr>
			<td style="border-right:1px solid #000; border-bottom:1px solid #000;" width="300">
			<center><input type="radio" name="gender" value="Male"><b>Male</b></center>
			</td>
			<td style="border-right:1px solid #000; border-bottom:1px solid #000;" width="300">
			<center><input type="radio" name="gender" value="Female"><b>Female</b></center>
			</td>
		</tr>
		<tr>
			<td style="border-right:1px solid #000;" width="300" height="400">
			<center><img src="http://www.elvonica.com/wardrobe/imgs/maleimage.png" /></center>
			</td>
			<td style="border-right:1px solid #000;" width="300" height="400">
			<center><img src="http://www.elvonica.com/wardrobe/imgs/femaleimage.png" /></center>
			</td>
		</tr>
		<tr>
			<td colspan="2" style="border-top:1px solid #000;">
			<button type="button" onclick="chooseGender()">Next</button>
			</td>
		</tr>
	</table>
</form>
		
	<table cellspacing="0" class="news" align="center" id="rest" style="display: none;">
CONTENT IS HERE, but the PHP works fine so I'm not going to bother showing it.
	</table>
</body>
</html>
vibhaJ 126 Master Poster
vibhaJ 126 Master Poster

If it is a simple form, use captcha.
Which can help you to prevent spamming.

vibhaJ 126 Master Poster

Try this.

RewriteEngine On
RewriteRule ^download\.php\?file\=([^/]*)$ /?d=$1 [L]
vibhaJ 126 Master Poster

Use array in field name.
When form is submitted using foreach delete each element.

<?php
if(isset($_POST['delete']))
{
	$checkboxAll = $_POST['checkbox'];
	foreach( $checkboxAll as $key=>$del_id )
	{
		$sql = "DELETE FROM Inq_cat WHERE Inq_id='$del_id'";
		$result = mysql_query($sql);
	}
	header("location:index.php");
	exit;
}
?> 
<form name="frm" id="frm" method="post">
<input name="checkbox[]" type="checkbox" value="1" /> Cat name 1
<input name="checkbox[]" type="checkbox" value="2" /> Cat name 2
<input name="checkbox[]" type="checkbox" value="3" /> Cat name 3
<input name="delete" value="delete" type="submit" />
</form>
vibhaJ 126 Master Poster

Below is normalization. Field names are self explainable.
Also as urtvi suggested check event uniqueness.

====================
Table Name : event 
====================
eventId  eventTitle date
1        Seminar
2        Robotics
3        AI

====================
Table Name : user
====================
userId  fullName  email
1       John      user1@test.com
2       Tanya     user2@test.com
3       Mathew    user3@test.com

===============================
Table Name : event_participant
===============================
participantId eventId userId
1             1       2
2             1       3
3             2       3
4             2       2
5             2       1
vibhaJ 126 Master Poster

Thanks SOS.
It is clear now.

vibhaJ 126 Master Poster

Hello All,

When i see my 'Latest Reputation Received' in list some icons are green and some are blue.
Is there any meaning for it?

See attached image.

Thanks,
Vibha

vibhaJ 126 Master Poster

Find my inline comments.
Your logic and loop was messy and i didn't get it.
So i have recreated code.
For any php function help visit http://php.net/

<?
	$first="rahul";
	$second="shiva";
	echo "<h2>$first & $second</h2>";
   	$len= strlen($first) + strlen($second); // total no of letter in both words
 	
	// in this for loop we will check for matching  letters
	for($i=0;$i<strlen($first);$i++){
		for($j=0;$j<strlen($second);$j++){
			if($first[$i]==$second[$j])
			{
				echo '<br />Letter common : '.$first[$i];
				$len=$len-2; // two letters found common so 2 letters removed from total count
			}
		}
	}	
	$frd = explode(" ","F R I E N D S"); // created array for FRIENDS iteration
	echo '<br />Remaining Length : '.$len;
	echo '<br /><br />';
	$cnt = 0;
	while(count($frd)!=1) // untill we get only one element from FRIENDS do the loop
	{
		// this if-else loop will check the location which will be cut from FRIENDS
		if($len>count($frd))
		{
			$de = ($len % (count($frd)));
			if($de == 0)
				$de = count($frd);
			$l = $de -1;
		}
		else
			$l = $len-1;
		
		echo '<br />'.implode('',$frd).' Cross on '.$frd[$l];
		unset($frd[$l]); // removing crossed/cut element from FRIENDS array
		
		$frd = explode('#',implode('#',$frd));
		echo ', Remaining '.implode('',$frd);	
		$cnt++;		
	}
	echo '<h2>Answer is : '.implode('',$frd).'</h2>';
	
?>
vibhaJ 126 Master Poster

Sometimes if you are continuously sending emails from one email address to second email address.
Email server automatically forward it to spam after some attempts.
Also check mail function header contents like from name and from email.

vibhaJ 126 Master Poster

Once you know basics of AJAX, jquery provides a good way to use it.
http://api.jquery.com/jQuery.ajax/

vibhaJ 126 Master Poster

Your php shortag setting is closed.
Replace <? to <?php at first line.

vibhaJ 126 Master Poster

Can you create test.php and copy all my above code and run it in your browser.
And post whether your output is correct or not??

vibhaJ 126 Master Poster

This is because it is executing this way,
when first time it try to check pos 1 (from array value) ,increase it and make 2.
Second time it try to check pos 2 (from array value), NOW HERE from above first iteration you have also made pos 2. So here update will affect 2 row.
so on..
Solution is firstly you need to get all unique ID field for which you want to increase pos.
Then in update query use that unique id.
i.e. "UPDATE table1 SET position='$z'+1 Where id='$stored_id' ";

Green-z commented: Thanks for great support +0
vibhaJ 126 Master Poster

Have you tried this ????

Here i have made a script.
I think this is exactly what you want.
Try and give me feedback.

<?
	$first="rahul";
	$second="shiva";
	echo "<h2>$first & $second</h2>";
   	$len= strlen($first) + strlen($second);
 
	for($i=0;$i<strlen($first);$i++){
		for($j=0;$j<strlen($second);$j++){
			if($first[$i]==$second[$j])
			{
				echo '<br />Letter common : '.$first[$i];
				$len=$len-2;
			}
		}
	}	
	$frd = explode(" ","F R I E N D S");
	echo '<br />Remaining Length : '.$len;
	echo '<br /><br />';
	$cnt = 0;
	while(count($frd)!=1)
	{
		if($len>count($frd))
		{
			$de = ($len % (count($frd)));
			if($de == 0)
				$de = count($frd);
			$l = $de -1;
		}
		else
			$l = $len-1;
		
		echo '<br />'.implode('',$frd).' Cross on '.$frd[$l];
		unset($frd[$l]);
		
		$frd = explode('#',implode('#',$frd));
		echo ', Remaining '.implode('',$frd);	
		$cnt++;		
	}
	echo '<h2>Answer is : '.implode('',$frd).'</h2>';
	
?>
vibhaJ 126 Master Poster

Where is inactive_batch field?
Post complete code in CODE tags.

vibhaJ 126 Master Poster

Here i have made a script.
I think this is exactly what you want.
Try and give me feedback.

<?
	$first="rahul";
	$second="shiva";
	echo "<h2>$first & $second</h2>";
   	$len= strlen($first) + strlen($second);
 
	for($i=0;$i<strlen($first);$i++){
		for($j=0;$j<strlen($second);$j++){
			if($first[$i]==$second[$j])
			{
				echo '<br />Letter common : '.$first[$i];
				$len=$len-2;
			}
		}
	}	
	$frd = explode(" ","F R I E N D S");
	echo '<br />Remaining Length : '.$len;
	echo '<br /><br />';
	$cnt = 0;
	while(count($frd)!=1)
	{
		if($len>count($frd))
		{
			$de = ($len % (count($frd)));
			if($de == 0)
				$de = count($frd);
			$l = $de -1;
		}
		else
			$l = $len-1;
		
		echo '<br />'.implode('',$frd).' Cross on '.$frd[$l];
		unset($frd[$l]);
		
		$frd = explode('#',implode('#',$frd));
		echo ', Remaining '.implode('',$frd);	
		$cnt++;		
	}
	echo '<h2>Answer is : '.implode('',$frd).'</h2>';
	
?>
vibhaJ 126 Master Poster

Rahul this FRIENDS game we were doing in school :)

vibhaJ 126 Master Poster

Make sure your field type is INT.

vibhaJ 126 Master Poster

It is just a notice.
You can ignore it and stop getting error message by

<?php error_reporting (E_ALL ^ E_NOTICE); ?>
vibhaJ 126 Master Poster
vibhaJ 126 Master Poster

Use square bracket.

$keyarray[$i] = $tranrec[0];
vibhaJ 126 Master Poster

Oh i forget FROM.
Try this code and post output.

<?php
$q=$_GET['q'];

$con = mysql_connect('localhost', 'root', '');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("ajax_demo", $con)or die('cannot connect');

$q = preg_replace('/\s\s+/', ' ', $q); // remove extra spaces
$sql = "SELECT *,CONCAT(FirstName, ' ',LastName) as fullname FROM `ajax_demo_table` WHERE CONCAT(FirstName, ' ',LastName) LIKE  CONVERT(_utf8 '%".$q."%' USING latin1) COLLATE latin1_swedish_ci ";

$result = mysql_query($sql);//or die('cannot query '.$result);

echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
<th>Hometown</th>
<th>Job</th>
</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['FirstName'] . "</td>";
  echo "<td>" . $row['LastName'] . "</td>";
  echo "<td>" . $row['Age'] . "</td>";
  echo "<td>" . $row['Hometown'] . "</td>";
  echo "<td>" . $row['Job'] . "</td>";
  echo "</tr>";
  }
echo "</table>";

mysql_close($con);
?>
vibhaJ 126 Master Poster

No. Just add my code at line number 12 and remove your $sql query.

vibhaJ 126 Master Poster

Try this code.

$q = preg_replace('/\s\s+/', ' ', $q); // remove extra spaces
	$sql = "SELECT *,CONCAT(FirstName, ' ',LastName) as fullname WHERE CONCAT(FirstName, ' ',LastName) LIKE  CONVERT(_utf8 '%".$q."%' USING latin1) COLLATE latin1_swedish_ci ";
vibhaJ 126 Master Poster

Yeah i forget to replace that double quote to single.
Generally when you are using editor( i use dream weaver ) if string is not completed proper you can see color change.

vibhaJ 126 Master Poster

Hi if you check jquery UI demo here.
Once you click on another widget rest will automatically closed.

vibhaJ 126 Master Poster

Use stripslashes function to display content.
http://in2.php.net/manual/en/function.stripslashes.php#example-4053

vibhaJ 126 Master Poster

what is the name of the staffname field in table?
Are passing array to function?

vibhaJ 126 Master Poster

You can use paypal IPN for that.
Website owner must have business account in paypal.
Once account is generated he can create API credintials i.e. API_UserName, API_Password, API_Signature which will be used in php coding.
Here is a sample code link : https://cms.paypal.com/cms_content/US/en_US/files/developer/nvp_DoDirectPayment_php.txt

Now in your website you have to give credit card payment form. and as in above code it will pay directly to business account.

vibhaJ 126 Master Poster

Formatted email

<?php


  $groupname = $_REQUEST['groupname'] ;
  $info = $_REQUEST['info'] ;
  $size = $_REQUEST['size'] ;
  $special = $_REQUEST['special'] ;
  $firstname =$_REQUEST['firstname'] ;
  $lastname = $_REQUEST['lastname'] ;
  $address1 = $_REQUEST['address1'] ;
  $address2 = $_REQUEST['address2'] ;
  $city = $_REQUEST['city'] ;
  $prov = $_REQUEST['prov'] ;
  $email = $_REQUEST['email'] ;
  $phone1 = $_REQUEST['phone1'] ;
  $phone2 = $_REQUEST['phone2'] ;
  $phone3 = $_REQUEST['phone3'] ;
  $website = $_REQUEST['website'] ;
  
$message = "<table width='600px' border="0" cellspacing='3' cellpadding='3'>
  <tr>
    <td><strong>Groupname :</strong></td>
    <td>$groupname</td>
  </tr>
  <tr>
    <td><strong>Info :</strong></td>
    <td>$info</td>
  </tr>
  <tr>
    <td><strong>Size :</strong></td>
    <td>$size</td>
  </tr>
  <tr>
    <td><strong>Special :</strong></td>
    <td>$special</td>
  </tr>
  <tr>
    <td><strong>Firstname :</strong></td>
    <td>$firstname</td>
  </tr>
  <tr>
    <td><strong>Lastname :</strong></td>
    <td>$lastname</td>
  </tr>
  <tr>
    <td><strong>Address1 :</strong></td>
    <td>$address1</td>
  </tr>
  <tr>
    <td><strong>Address2 :</strong></td>
    <td>$address2</td>
  </tr>
  <tr>
    <td><strong>City :</strong></td>
    <td>$city</td>
  </tr>
  <tr>
    <td><strong>Prov :</strong></td>
    <td>$prov</td>
  </tr>
  <tr>
    <td><strong>Email :</strong></td>
    <td>$email</td>
  </tr>
  <tr>
    <td><strong>Phone1 :</strong></td>
    <td>$phone1</td>
  </tr>
  <tr>
    <td><strong>Phone2 :</strong></td>
    <td>$phone2</td>
  </tr>
  <tr>
    <td><strong>Phone3 :</strong></td>
    <td>$phone3</td>
  </tr>
  <tr>
    <td><strong>Website :</strong></td>
    <td>$website</td>
  </tr>
</table>" ;
  $headers  = "From: ".$email."\r\n";
  $headers .= 'MIME-Version: 1.0' . "\n";
  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
	
  mail( "user@mailserver.com", "Vendor Application",
    $message, $headers );
  header( "Location: http://www.thewebsiteimlinkingto.ca/thanks!.html" );
  
  
?>
vibhaJ 126 Master Poster

str variable is in JavaScript. It is client side language.
While PHP is server side language.
Can you post your reason for passing str value to php tag with example.

vibhaJ 126 Master Poster

That line was for submitting form without button click.
BTW here is one demo code which may help you.

<!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>Untitled Document</title>
</head>

<body>
<script language="javascript">
function showMe(str)
{
	document.getElementById('myDiv').innerHTML = ' You have selected : '+str;
}
</script>
<select name="ccrseid" onchange="showMe(this.value);">
<option value="">Select</option>
<option value="One">One</option>
<option value="Two">Two</option>
<option value="Three">Three</option>
<option value="Four">Four</option>
</select>
<div id="myDiv"></div>
</body>
</html>
vibhaJ 126 Master Poster

Add this code.
This code will print all forms posted data.

if(isset($_POST))
{
    echo '<pre>';
    print_r($_POST);
}

Post your output here.

vibhaJ 126 Master Poster

You can also use loop for getting its value.

<?
	$chk_list = $_POST['chk_list'];
	foreach($chk_list as $key=>$Veh_id)
	{
		echo '<br />'.$Veh_id.' is checked';
	}
?>
vibhaJ 126 Master Poster
vibhaJ 126 Master Poster

[By mistake]

vibhaJ 126 Master Poster
<?php 
	
		 
		require ("scripts/connect.php");
		 
		$dynamicList = "";
		$sql = mysql_query("SELECT * FROM products WHERE category = 'anyoccasion'");
		$productcount = mysql_num_rows($sql); // count the output amount
		if ($productcount > 0) 
		{
			$cnt = 0;
			$perRowProduct = 3;
			
			$dynamicList .= '<table width="100%" border="0" cellspacing="0" cellpadding="6">';
			while($row = mysql_fetch_array($sql))
			{ 
				$id = $row["id"];
				$productname = $row["productname"];
				$price = $row["price"];
				$dateadded = strftime("%b %d, %Y", strtotime($row["dateadded"]));
				
				if( $cnt==0 || $cnt % $perRowProduct==0 )
				{
					$dynamicList .= '<tr>';
				}
				$dynamicList .= '<td width="17%" valign="top"><a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="inventoryimages/' . $id . '.jpg" alt="' . $productname . '" width="77" height="102" border="1" /></a></td>
				<td width="83%" valign="top">' . $productname . '<br />
				£' . $price . '<br />
				<a href="product.php?id=' . $id . '">View Product Details</a></td>
				
				<td width="17%" valign="top"><a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="inventoryimages/' . $id . '.jpg" alt="' . $productname . '" width="77" height="102" border="1" /></a></td>
				<td width="83%" valign="top">' . $productname . '<br />
				£' . $price . '<br />
				<a href="product.php?id=' . $id . '">View Product Details</a></td>';
				
				if( ($cnt+1) % $perRowProduct==0 || ($cnt+1)==$productcount )
				{
					$dynamicList .= '</tr>';
				}
				$cnt++;	    
			}
			$dynamicList .= '</table>';
			
		} else {
			$dynamicList = "We have no Birthday Cards listed in our store yet";
		}
		mysql_close();
		
		?>
		
	<table >
	<tr>
	<td><?php echo $dynamicList; ?></td>
	</tr>
	</table>

$perRowProduct is total column per row.

vibhaJ 126 Master Poster

it's demo is not working on given link.

vibhaJ 126 Master Poster

You must filter your select query based on selection.

vibhaJ 126 Master Poster

You forget mysql_query function before while.

<?
	$sql="SELECT * FROM registered_members WHERE firstname LIKE '".$q."%' OR lastname LIKE '".$q."%'";
	$rs = mysql_query($sql);
	While($row = mysql_fetch_array($rs)){
	$id= $_SESSION['SESS_MEMBER_ID']; //current user ID.
	$x_id= $row['member_id'];
	$result = mysql_query("SELECT registered_members.firstname,registered_members.lastname,registered_members.member_id,friends.m_id,friends.f_id,friends.restriction FROM registered_members,friends WHERE (m_id=$id AND f_id=$x_id AND restriction='green') OR (f_id=$id AND m_id=x_id AND restriction='green')");
?>
vibhaJ 126 Master Poster

I can't retrieve the remaining values.

After form submission You can only get one value that user have selected.
Why do you want all values in drop down?

vibhaJ 126 Master Poster

Below is JavaScript for submitting form on change of drop-down.

print "<select name='ccrseid' onchange='document.getElementById(\'formId\').submit();'>";

Where formId is the id of form tag.

vibhaJ 126 Master Poster

If data type is timestamp it will automatically take current datetime.
You don't need to add it in insert query.

<?php
include("connect_mysql.php");
$date=date("Y-m-s H:i:s");
mysql_query("insert into buy_db (from_site, model, ip) values ('".$_REQUEST['site']."', '".$_REQUEST['model']."', '".$_REQUEST['ip']."')");
//header('Location:'.$_REQUEST['url']);
?>
vibhaJ 126 Master Poster
vibhaJ 126 Master Poster

In both page array name ie $lang will be same?
You mean you can't modify template.php and newvalues.php's php code.
You want third php file which will take both file's array as an input.
What will be output? A string?
Sorry but one example of input and output will be more clear. :)

vibhaJ 126 Master Poster

Try this code and see what error you are getting.

<?
	echo $query= "SELECT * FROM table WHERE col1 LIKE '%$search_Recordset2%' OR col2 LIKE '%$search_Recordset2%' OR col3 LIKE '%$search_Recordset2%'";	
	$result = mysql_query($query);
	if (!$result) {
		die('Invalid query: ' . mysql_error());
	}

?>