Jump to content

kumpel

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by kumpel

  1. kumpel

    LEFT JOIN problem

    Sorry, here is the error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN ordersON items.CHECKOUT_ID=orders.CHECKOUT_IDORDER BY orders.ORDER_ID' at line 1
  2. kumpel

    LEFT JOIN problem

    Hi I have the following script which seems to come up with an error all the time, I am doing something wrong I just dont know what, cxan someone help? <?phpmysql_connect ("localhost", "xxxx","xxxxx") or die (mysql_error());mysql_select_db ("xxxxxxxxx"); $sql_statement = "SELECT items.quantity". "FROM items LEFT JOIN orders". "ON items.CHECKOUT_ID=orders.CHECKOUT_ID". "ORDER BY orders.ORDER_ID"; $result = mysql_query($sql_statement) or die(mysql_error());while($row = mysql_fetch_array($result)) { echo $row['quantity']. " ". $row['size']; echo "<br />";} ?>
  3. kumpel

    PHP coding help

    Thanks, I managed to find what I needed, it was the LEFT JOIN command, now to try and make it work............
  4. kumpel

    PHP coding help

    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
×
×
  • Create New...