Current location: Hot Scripts Forums » Programming Languages » PHP » need help with tables


need help with tables

Reply
  #1 (permalink)  
Old 04-02-11, 08:53 PM
ckdoublenecks ckdoublenecks is offline
Wannabe Coder
 
Join Date: Jul 2010
Posts: 123
Thanks: 11
Thanked 0 Times in 0 Posts
need help with tables

I want to read records from the database and print these tables but I need help
PHP Code:

<?php
mysql_connect
(localhost,root,"");
mysql_select_db(oodb) or die( "Unable to select database");
$query=" SELECT * FROM oocust";
$result=mysql_query($query);
$num=mysql_numrows($result);
?><HTML><HEAD>
<script type="text/javascript">
var monthNames = [ "January","February","March","April","May","June","July",
                   "August","September","October","November","December"     ];
var today = new Date();  
var mmyy = monthNames[today.getMonth()] + " / " + today.getFullYear();
</script>
</HEAD><BODY  bgcolor="#CCCC99" background="oldorchard.jpg"><b><center>
<font size=+2><b> Old Orchard Invoice </font>Date: 
<script type="text/javascript">document.write(mmyy);</script></center><?php>
echo 
"<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="5" background="oldorchard.jpg">
<TD>
<TABLE BORDER="
0" CELLPADDING="10" CELLSPACING="10" background="oldorchard.jpg">
<TD>
<TABLE BORDER="
0" CELLPADDING="1" CELLSPACING="1" background="oldorchard.jpg">
    <TD>
<input type=text size=25 value="
Old Orchard Plumbing"><br>
<input type=text size=25 value="
2210 EHogan Hollow Road"><br>
<input type=text size=25 value="
MargateFl  33063"><br></TD>
      <TR>
   <td>
<input type=text size=3 value="
Bill To:"><br>
<input type=text size=25 value="
$bname"><br>
<input type=text size=25 value="
$bstreet:">><br>
<input type=text size=25 value="
$bcity"><br>
<input type=text size=25 value="
$contact"><br></TD>
      <tr>
   <td>
<input type=text size=5 value="
Ship To:"><br>
<input type=text size=25 value="
$sname:"><br>
<input type=text size=25 value="
$street"><br>
<input type=text size=25 value="
$scity"></td>
</TR>
      </TABLE>
      </TD>
     <TD>
<input type=text size=25 value="
Invoice No$invnum"><br>
<input type=text size=25 value="
Date$mm/dd/yyyy"><br>
<input type=text size=25 value="
Terms$terms"><br>
<input type=text size=25 value="
Due Date$duedate"><br>
<input type=text size=25 value="
Order No$ordernum"><br>
<input type=text size=25 value="
Territory:"><br>
<input type=text size=25 value="
Salesperson:"><br>
</TD>
</TABLE>
</TD>
<TD align=center><img src="
dave pic.jpg" width=250 height=350></td>
</TABLE>

echo "
</tr>";
<hr>
echo "
</table>";mysql_close();
?> </b></BODY></HTML>

Last edited by job0107; 04-02-11 at 10:39 PM.
Reply With Quote
  #2 (permalink)  
Old 04-04-11, 01:33 PM
ckdoublenecks ckdoublenecks is offline
Wannabe Coder
 
Join Date: Jul 2010
Posts: 123
Thanks: 11
Thanked 0 Times in 0 Posts
I want to read records from the database and print these tables but I need help - I've trimmed this way down trying to resolve. The only fields that print out are invnum and ordernum and I get this message:
Quote:
while ( = mysql_fetch_assoc(Resource id #5) ) { echo '
<?php?>
<HTML><HEAD>
<script type="text/javascript">
var monthNames = [ "January","February","March","April","May","June", "July",
"August","September","October","November","Decembe r" ];
var today = new Date();
var date = monthNames[today.getMonth()] + " - " + today.getDate() + " - " + today.getFullYear();
</script>
</HEAD><BODY>
</center><div align=right>
<script type="text/javascript">document.write(date);</script>
</div>
<?php
mysql_connect(localhost,root,"");
mysql_select_db(numbersdb) or die( "Unable to select database");
if(!empty($_POST["submit"]))
{
$invnum = $_POST['invnum'];
}
mysql_query("UPDATE numbdata SET invnum=invnum+1");
$result=mysql_query("select invnum from numbdata") or die ("Error - could not retrieve invoice number from database");
$data=mysql_fetch_assoc($result);
echo "Invoice No: ".$data['invnum'];
mysql_close();
mysql_connect(localhost,root,"");
mysql_select_db(oodb) or die( "Unable to select database");
if(!empty($_POST["submit"]))
{
$ordernum = $_POST['ordernum'];
$query=" SELECT * FROM oocust";
$result=mysql_query($query);
if(mysql_num_rows($result))
{
$bname = $_POST['bname'];
$sname = $_POST['sname'];
$terms = $_POST['terms'];
echo "<form action='#' method='post'>
while ($row = mysql_fetch_assoc($result) )
{
echo '<TABLE BORDER=0 CELLPADDING=5 CELLSPACING=5 background='oldorchard.jpg'>
<TD>
<TABLE BORDER=0 CELLPADDING=10 CELLSPACING=10 background='oldorchard.jpg'>
<TD>
<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=1 background='oldorchard.jpg'>
<TD>
<input type=text size=25 value='Old Orchard Plumbing'><br>
<input type=text size=25 value='2210 E. Hogan Hollow Road'><br>
<input type=text size=25 value='Margate, Fl 33063'><br>
</TD>
<TR>
<td>
<input type=text size=4 value='Bill To:'><br>
<input type=text size=25 value='$bname'><br>

<tr>
<td>
<input type=text size=5 value='Ship To:'><br>
<input type=text size=25 value='$sname'><br>

</TR>
</TABLE>
</TD>
<TD>
<input type=text size=5 value='Terms: '>
<input type=text size=12 value='$terms'><br>
<input type=text size=10 value='$ordernum'><br>
</TD>
</TABLE>
</TD>
<TD align=center><img src='dave pic.jpg' width=250 height=350></td>
</TABLE>
<tr>
</tr>
</table>";
echo "</form>";
}
else{echo "No listing for order no. $ordernum.<br />Select another?<br />";}
}
?>
<form method="post" action="#">
<br />
<input type="text" name="ordernum"/> <p>
<input type="submit" name="submit" value="+"/>
</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
Accessing Tables with an id perleod JavaScript 1 09-01-09 05:44 AM
show tables question maklooby PHP 1 04-19-09 05:47 PM
updating database tables when tables may or may not have changed? Tim Mousel PHP 0 05-21-06 05:25 PM
REQUEST: Tutorial or prmg on mysql/php/related tables chippewapublishing Script Requests 0 08-05-05 01:50 PM
script that measures height of tables and vertically aligns nested tables amj01 Script Requests 1 07-04-03 01:20 PM


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