Jump to content

PHP coding help


kumpel
 Share

Recommended Posts

Hi, I am new to this game so pls bear with me. I have the following script which extracts data into a simple page format from search.html page, it searches on an order number 'term' and then displays the info below. <?phpmysql_connect ("localhost", "xxxxx","xxxxxx") or die (mysql_error());mysql_select_db ("xxxxxxxxx"); $term = $_POST['term']; $sql = mysql_query("select * from orders where ORDER_ID like '%$term%'");while ($row = mysql_fetch_array($sql)) { echo '<div id="main" style="position: absolute; margin-left: -800px; width: 800px; top: 100px; left: 50%; height: 100%;">'; echo "<tr>"; echo '<br/>'.$row['firstname']; echo ' '.$row['lastname']; echo '<br/>'.$row['shipto_street']; echo '<br/>'.$row['shipto_zip']; echo ' '.$row['shipto_city']; echo '<br/>'.$row['shipto_countrycode']; echo '<br/><br/>'; echo '<br/><br/>'; echo '<br/>RECHNUNG Nr:'.$row['ORDER_ID']; echo '<br/><br/>'; echo date("m/d/y"); echo "</tr>"; }echo "</table>" ?> //forms a simple table with headings <table class="orders" cellpadding="8" width="960" style="text-align:center; vertical-align:middle; font-size:13px; margin-top:20px"> <tr> <th width="80">qty</th> <th width="50">size</th> <!-- <th width="50">Form</th> --> <th width="50">delivery</th> <th>extras</th> <th width="50">Amount</th> </tr> What I would like to know is how can I display the info qty, size, delivery etc if this info is from another table in the same database and the only match is a "CHECK_OUT" id that is common to both tables. The "CHECK_OUT" must do a match against the ORDER NR 'term' and fill the columns with that data? Hope that makes sense? Any help would be appreciated

  • Like 1
Link to comment
Share on other sites

im not that good with php but this doesnt look right to me

echo '<br/>'.$row['firstname'];echo ' '.$row['lastname'];echo '<br/>'.$row['shipto_street'];echo '<br/>'.$row['shipto_zip'];echo ' '.$row['shipto_city'];echo '<br/>'.$row['shipto_countrycode'];echo '<br/><br/>';echo '<br/><br/>';echo '<br/>RECHNUNG Nr:'.$row['ORDER_ID'];echo '<br/><br/>';echo date("m/d/y");

you have open single quotes but no closing single quotes then you have both open and close single quotes but nuthing in ittry this

echo '<br/>' . $row['firstname'];echo $row['lastname'];echo '<br/>' . $row['shipto_street'];echo '<br/>' . $row['shipto_zip'];echo $row['shipto_city'];echo '<br/>' . $row['shipto_countrycode'];echo '<br/><br/>';echo '<br/><br/>';echo '<br/>RECHNUNG Nr:' . $row['ORDER_ID'];echo '<br/><br/>';echo date("m/d/y");

all i did was remove the single quotes that doesnt have anything in it and echo out the row, also i place some spaces between the dots and the variablealso where on this line you need an opening table tab

echo '<div id="main" style="position: absolute; margin-left: -800px; width: 800px; top: 100px; left: 50%; height: 100%;">';echo "<tr>";

so do this

echo '<div id="main" style="position: absolute; margin-left: -800px; width: 800px; top: 100px; left: 50%; height: 100%;">';echo "<table>";echo "<tr>";

i dont fully understand the php codes, so most likely someone else gonna help you out a little better. well i hope that help

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...