Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 11-24-2010, 03:42 PM need help with echo
Average Talker

Posts: 17
Name: charlie
Trades: 0
Why won't the apartment# echo?
Code:
 
</body></html> 
<?php
if (isset( $_POST['apt']) ) {
$dep=$_POST['dep'];
$apt=$_POST['apt'];
$name=$_POST['name'];
$amtpaid=$_POST['amtpaid'];
$damage=$_POST['damage'];
$month=$_POST['month'];
$courtcost=$_POST['courtcost'];
$nsf=$_POST['nsf'];
$latechg=$_POST['latechg'];
$secdep=$_POST['secdep'];
$comments=$_POST['comments'];
$stat = mysql_connect(localhost,root,"") or die('Unable to connect to database: ' . mysql_error()); 
$stat = mysql_select_db(mschgdb) or die('Unable to select database: ' . mysql_error()); 
$query = "INSERT INTO miscdata VALUES 
('','$dep','$apt','$name','$amtpaid','$damage','$month','$courtcost','$nsf','$latechg','$secdep','$comments')"; 
$stat = mysql_query($query) or die('Query failed: ' . mysql_error());
// *******************************************************************
echo '<p style="color: red; text-align: center">data has been inserted in apartment $apt</p>';
// *****************************************************
mysql_close();
}
?>
ckdoublenecks is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-24-2010, 03:46 PM Re: need help with echo
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
Do you get any errors in the http server error log file?
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Old 11-24-2010, 04:56 PM Re: need help with echo
Average Talker

Posts: 17
Name: charlie
Trades: 0
no, I just get "data has been inserted in apartment $apt" . Could it have to do with the HTML code associated with it? :
Quote:
<html>
<head>
<style type="text/css">
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs...n.js"></script>
<script type="text/javascript">
function getResults() {
var search_val = $("#apt").val();
$.post("prerentget.php", { search_term: search_val }, function(data) {
if (data.length > 0) {
$("#name")[0].value = data;
}
})
}
</script>
<script type="text/javascript">
window.google_analytics_uacct = "UA-256751-2";
</script>
<script type="text/javascript">
window.google_analytics_uacct = "UA-256751-2";
</script>
</head>
<body onload="document.form.apt.focus()">
<form name="form" action="<?php $_SERVER[PHP_SELF] ?>" method="post">
<INPUT TYPE="text" name=dep>Dep#<BR>
<input type="text" size="2" name="apt" id="apt"
onkeyup="getResults();if(this.value.length==this.s ize)document.form.name.focus();" />Apt<br />
<input type="text" name="name" id="name" />Name<br />
<INPUT TYPE="text" name=amtpaid>Amount Paid<BR>
<INPUT TYPE="text" name=damage>Damage Chg<BR>
<INPUT TYPE="text" name=month>Month Incurred<BR>
<INPUT TYPE="text" name=courtcost>Court Costs<BR>
<INPUT TYPE="text" name=nsf>NSF<BR>
<INPUT TYPE="text" name=latechg>Late Charges<BR>
<INPUT TYPE="text" name=secdep>Sec Deposit<BR>
<INPUT TYPE="text" name=comments>Comments<BR>
<p>
<INPUT type="submit" value="submit data" />
</p>
</form>
<script type="text/javascript"><!--
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
//-->
</script>
<script type="text/javascript"><!--
try {
var pageTracker = _gat._getTracker("UA-256751-2");
pageTracker._trackPageview();
} catch(err) {}
//-->
</script>
ckdoublenecks is offline
Reply With Quote
View Public Profile
 
Old 11-24-2010, 06:30 PM Re: need help with echo
Gakoyu Ojima's Avatar
Skilled Talker

Posts: 59
Location: Netherlands.
Trades: 0
You did not add concatenations.

Change:

PHP Code:
echo '<p style="color: red; text-align: center">data has been inserted in apartment $apt</p>'
Into:

PHP Code:
echo '<p style="color: red; text-align: center">data has been inserted in apartment' $apt '</p>'
__________________
$gocore = new gakoyucore();
$con = mysql_connect($gocore->server, $gocore->username, $gocore->password) or die(mysql_error());
Gakoyu Ojima is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to need help with echo
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.35558 seconds with 12 queries