0

What is wrong here ... as verb_id and item_code is being entered into the database as "0" ... even the date is like 0000/00/00 ...

Thanx in advance !!

<?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());
//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());

$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','$verb_id','item_code','post_description','posted_on')";
$tbl_res=mysql_query($tbl_sql) or die(mysql_error());


?>
3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by pearll
0

here you go..

<?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());
    $vrd_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_code['item_code']."','".$post_description."','".$posted_on."')";
    $tbl_res=mysql_query($tbl_sql) or die(mysql_error());
     
     
    ?>

Edited by six_sic6: n/a

0

here you go..

<?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());
    $vrd_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_code['item_code']."','".$post_description."','".$posted_on."')";
    $tbl_res=mysql_query($tbl_sql) or die(mysql_error());
     
     
    ?>

It is shwing the following in the browser ...

Parse error: syntax error, unexpected '$' in /home/heaven/public_html/offer_list.php on line 34

And line 34 is

$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_code['item_code']."','".$post_description."','".$posted_on."')";
<?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());
     
     
    ?>

Edited by pearll: n/a

0

correct this line like:

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_code['item_code']."','".$post_description."','".$posted_on."')";
0

Okay i did the minor modifications reagrdinh .$ and $. :)


Thnak u six_sic6 and Shanti

Edited by pearll: n/a

This question has already been answered. 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.