/    Sign up×
Community /Pin to ProfileBookmark

Fatal error: Call to undefined function valueset() in /opt/lampp/htdocs/webserver/ton

[code=php]
<?php echo $_SESSION[‘cust_id’];
$cust_id= $_SESSION[‘cust_id’];

?>

[/code]

[code=php]
<div style=”float:left;width:120px;height:22px;padding-top:3px;” id=”l_cust”>Customer Name:</div>
<div style=”float:left;width:640px;height:22px;padding-top:3px;”><input style=”width:600px;border-radius: 8px;-webkit-border-radius: 5px;-moz-border-radius: 5px;” type=”text” name=”customer_name” id=”customer_name” value=”<?php include(‘php_libs.php’); echo valueset(‘customer_details’,’castomer_name’,’$cust_id’); ?> “/></div>
[/code]

[code=php]
function valueset($table_name,$field_name,$cust_id){

$sql=”select $field_name from $table_name where cust_id=’$cust_id’;”;
include(‘database.php’);
mysql_select_db(“myproject”,$con);
$r=@mysql_query($sql,$con) or die(‘mysql error’);
$row=mysql_fetch_assoc($sql);

/*while ($row = mysql_fetch_assoc($result)) {

}*/

return $r[$field_name];

}

[/code]

My idea is simple.the perticuler textfield should retain the value of the select query.my DB is MySql.I am trying to work with this code.but its not working.how do i do?i am new to PHP.

kind regads

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@gvreAug 30.2011 — If you use a db abstraction layer (like adodb), you can get a field value easier.

eg.
[code=php]$field = $db->GetOne("SELECT field FROM table WHERE cust_id='1'");[/code]
You should also start reading a good php book for beginners. You will learn a lot of useful things.
Copy linkTweet thisAlerts:
@NogDogAug 30.2011 — Maybe try changing the include() to a require(), to verify that the file is, in fact, being included?
Copy linkTweet thisAlerts:
@csayantanauthorSep 30.2011 — We do not have ADODB but we have DQL ie. Doctrine.
×

Success!

Help @csayantan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...