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


?>

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

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

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."')";

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


Thnak u six_sic6 and Shanti

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.