0

Can smbdy tell me that what is wrong in the second part of the form here in syntax.... ?? here i am providing the first part 2 as sm variables are from that part...however just tell me what is syntactically wrong in second part ...plz .. thanx in advance !!

The first part which is working properly is

<?php
    $verb_description=$_REQUEST['verb'];
    $item_description=$_REQUEST['item'];
    $post_description=$_REQUEST['post_description'];
    //to fetch verb_id
    $verb_sql="SELECT verb_id FROM tbl_verbs_master WHERE verb_description='".$verb_description."'";
    $verb_id=mysql_query($verb_sql) or die(mysql_error());
    $vrb_id = mysql_fetch_array($verb_id);
    //to fetch item_code
    $item_sql="SELECT item_code FROM tbl_item_master WHERE item_description='$item_description'";
    $item_code=mysql_query($item_sql) or die(mysql_error());
    $itm_id = mysql_fetch_array($item_code);
    
    $posted_on=date("Y/m/d");
    $user_id="9";
    $tbl_sql="INSERT INTO tbl_user_post_requirement(user_id,verb_id,item_code,post_description,posted_on)VALUES('".$user_id."','".$vrb_id['verb_id']."','".$itm_id['item_code']."','".$post_description."','".$posted_on."')";
    $tbl_res=mysql_query($tbl_sql) or die(mysql_error());
     
     
    ?>

*************

And the second part which is not working is.......

<?php 
	//code for showing offers
	
	$sql="SELECT SOS_verb_id FROM tbl_verbs_mapping WHERE SRS_verb_id='.$vrb_id['verb_id'].'";
	$res=mysql_query($sql) or die(mysql_error());
	$result = mysql_fetch_array($res);
	
	$tb_sql="SELECT * FROM tbl_verbs_master where verb_id='.$result['verb_id'].' AND item_code='.$itm_id['item_code'].'";
	$tb_res=mysql_query($tb_sql) or die(mysql_error());
	$tb_result = mysql_fetch_array($tb_res);
	
	while($row = mysql_fetch_array($tb_result)){
	echo $row['user_id']. " wants to ". $row['verb_description']." " .'"$item_description."';
	echo "<br />";
	}
	 ?>

Edited by pearll: n/a

2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by danishbacker
0

Please help me .... Please .. just check the syntax error in second part .

0

Can smbdy tell me that what is wrong in the second part of the form here in syntax.... ?? here i am providing the first part 2 as sm variables are from that part...however just tell me what is syntactically wrong in second part ...plz .. thanx in advance !!

The first part which is working properly is

<?php
    $verb_description=$_REQUEST['verb'];
    $item_description=$_REQUEST['item'];
    $post_description=$_REQUEST['post_description'];
    //to fetch verb_id
    $verb_sql="SELECT verb_id FROM tbl_verbs_master WHERE verb_description='".$verb_description."'";
    $verb_id=mysql_query($verb_sql) or die(mysql_error());
    $vrb_id = mysql_fetch_array($verb_id);
    //to fetch item_code
    $item_sql="SELECT item_code FROM tbl_item_master WHERE item_description='$item_description'";
    $item_code=mysql_query($item_sql) or die(mysql_error());
    $itm_id = mysql_fetch_array($item_code);
    
    $posted_on=date("Y/m/d");
    $user_id="9";
    $tbl_sql="INSERT INTO tbl_user_post_requirement(user_id,verb_id,item_code,post_description,posted_on)VALUES('".$user_id."','".$vrb_id['verb_id']."','".$itm_id['item_code']."','".$post_description."','".$posted_on."')";
    $tbl_res=mysql_query($tbl_sql) or die(mysql_error());
     
     
    ?>

*************

And the second part which is not working is.......

<?php 
	//code for showing offers
	
	$sql="SELECT SOS_verb_id FROM tbl_verbs_mapping WHERE SRS_verb_id='.$vrb_id['verb_id'].'";
	$res=mysql_query($sql) or die(mysql_error());
	$result = mysql_fetch_array($res);
	
	$tb_sql="SELECT * FROM tbl_verbs_master where verb_id='.$result['verb_id'].' AND item_code='.$itm_id['item_code'].'";
	$tb_res=mysql_query($tb_sql) or die(mysql_error());
	$tb_result = mysql_fetch_array($tb_res);
	
	while($row = mysql_fetch_array($tb_result)){
	echo $row['user_id']. " wants to ". $row['verb_description']." " .'"$item_description."';
	echo "<br />";
	}
	 ?>

I think the problem is with your sql string. Try this.

$sql="SELECT SOS_verb_id FROM tbl_verbs_mapping WHERE SRS_verb_id='".$vrb_id['verb_id']."'";


$tb_sql="SELECT * FROM tbl_verbs_master where verb_id='".$result['verb_id']."' AND item_code='".$itm_id['item_code']."'";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.