Jump to content

shayster

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

shayster's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You guys were great. Thanks for the help!!!
  2. Can you please give me an example of how to use the mysql_data_seek()? I tried to look it up and figure out how to use it by I am fairly new to this. Thanks again.
  3. Yeah that's what I thought. I tried reset($result); but got: Warning: reset() [function.reset]: Passed variable is not an array or object in
  4. Nope. The error is definitely in the second while statement. Is it because I am trying to while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) after doing a while ($field = mysql_fetch_field($result))? Do I have to separate them some how?
  5. Okay first of all I am new and this is my first function. I borrowed most of the code but then tried to change it to suit my needs. The function is suppose to receive an id and then use it in the function to join two tables and then display the results in a table. I get the Table and the field names but can't get the results from the table. I added a line to print the id to assure the function was getting it and it was. I also ran the query through mysql directly and got the proper results. Thanks in advance: function orderidToEditOrder($orderid){ //given a table name, generates HTML table including //edit buttons $orderid = filter_input(INPUT_POST, "orderid"); $orderid = mysql_real_escape_string($orderid); global $dbConn; $output = ""; $query = "select category.cat_name, orders.wgt_ounces, orders.del_date from orders, category where orders.id='$ordersid' and category.id=orders.cat_id"; $result = mysql_query($query, $dbConn); $output .= "<table border = '1'>\n"; //get column headings //get field names $output .= "<tr>\n"; while ($field = mysql_fetch_field($result)){ $output .= " <th>$field->name</th>\n"; } // end while //add empty columns for edit $output .= "<th width=70></th>\n"; $output .= "</tr>\n\n"; //get row data as an associative array while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo "<tr>\n"; $output .= " <td>Item: {$row['category.cat_name']} </td>"; $output .= "<td>Weight in Ounces: {$row['orders.wgt_ounces']} </td>"; $output .= "<td>Delivery Date: {$row['orders.del_date']} </td></tr>"; } $output .="</table>"; return $output; } // end orderidToEditOrder
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.