Current location: Hot Scripts Forums » Programming Languages » PHP » why won't this work


why won't this work

Reply
  #1 (permalink)  
Old 09-18-10, 04:24 PM
ckdoublenecks ckdoublenecks is offline
Wannabe Coder
 
Join Date: Jul 2010
Posts: 123
Thanks: 11
Thanked 0 Times in 0 Posts
why won't this work

PHP Code:

<?php

mysql_connect
(localhost,root,"");
mysql_select_db(prerentdb) or die( "Unable to select database");
if(!empty(
$_POST["submit"]))
{
 
$apt $_POST['apt'];
 
$query="SELECT * FROM payments Where apt='$apt'";
 
$result=mysql_query($query);
 if(
mysql_num_rows($result))
 {
  echo 
"<form action='#' method='post'><b>
<font size=2><b>Hammock Oaks Apartments</font>&nbsp;&nbsp;&nbsp;Rent Receipt<p>;
        while(
$row = mysql_fetch_assoc($result))
  {
      echo "
$name in apartment $apt has paid $amtpaid on this day $datepaid<br />";
}
        else{echo "
No listing for apartment $apt.<br />Please select another.<br />";}
}
?>
<form method="
post" action="#">
 
<br />
 <
input type="text" name="apt"/> <p>
<
input type="submit" name="submit" value="receipt apartment"/>
</
form>
Reply With Quote
  #2 (permalink)  
Old 09-19-10, 05:37 PM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Hey,
It is hard for us to "guess" what the problem is or what doesnt work. So please be more specific. You get any errors?

/Yero
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Reply With Quote
  #3 (permalink)  
Old 09-19-10, 05:40 PM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Decided to guess anyway. This might work better:

PHP Code:

<?php 

mysql_connect
(localhost,root,""); 
mysql_select_db(prerentdb) or die( "Unable to select database"); 
if(!empty(
$_POST["submit"])) 

 
$apt $_POST['apt']; 
 
$query="SELECT * FROM payments Where apt='$apt'"
 
$result=mysql_query($query); 
 if(
mysql_num_rows($result)) 
 { 
  echo 
"<form action='#' method='post'><b> 
<font size=2><b>Hammock Oaks Apartments</font>&nbsp;&nbsp;&nbsp;Rent Receipt<p>"

        while(
$row mysql_fetch_assoc($result)) 
  { 
      echo 
$name ."in apartment." $apt ."has paid".  $amtpaid ."on this day"$datepaid."<br />"

        else{echo 
"No listing for apartment ".$apt."<br />Please select another.<br />";} 

?> 
<form method="post" action="#"> 
 <br /> 
 <input type="text" name="apt"/> <p> 
<input type="submit" name="submit" value="receipt apartment"/> 
</form>
My php isnt very good. But you missed some closing quotes
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Reply With Quote
  #4 (permalink)  
Old 09-19-10, 07:42 PM
ckdoublenecks ckdoublenecks is offline
Wannabe Coder
 
Join Date: Jul 2010
Posts: 123
Thanks: 11
Thanked 0 Times in 0 Posts
thanks guys - I solved it with this code

Quote:
<?php
mysql_connect(localhost,root,"");
mysql_select_db(prerentdb) or die( "Unable to select database");
if(!empty($_POST["submit"]))
{
$apt = $_POST['apt'];
$query="SELECT name, apt, amtpaid, datepaid FROM payments Where apt='$apt'";
$result=mysql_query($query);
if(mysql_num_rows($result))
{
echo "<form action='#' method='post'><font size=4><b>Hammock Oaks Apartments</font>&nbsp;&nbsp;&nbsp;Rent Receipt<br /><br /><i>amount paid is the total paid this month<br /><br /></i>
<table border='0'>
<tr>
<th>.</th>
</tr>";
echo "</table>";
echo "</form>";
while(list($name,$apt,$amtpaid,$datepaid)= mysql_fetch_row($result))
{
echo "$name in apartment $apt has paid $amtpaid on this day $datepaid<br />";
}

}
else{echo "No listing for appartment $apt.<br />Please select another.<br />";}
}
?>
<form method="post" action="#">
<br />
<input type="text" name="apt"/> <p>
<input type="submit" name="submit" value="receipt apartment"/>
</form>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
URGENT! Mail form Flash 8/MX PHP doesn't work anymore Dougielove Script Requests 4 03-15-09 08:50 AM
The Art Nexus seeking PHP programmers TheArtNexus Job Offers & Assistance 5 02-26-08 03:08 AM
I'm desperate for work, I'll do any work for cheap [PHP/MySQL] Anastas Job Offers & Assistance 17 02-12-06 11:18 AM


All times are GMT -5. The time now is 08:42 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.