Jump to content

RopeADope

Members
  • Posts

    157
  • Joined

  • Last visited

Everything posted by RopeADope

  1. Hi all. I've got a database still in the development stage. The structure was already in place and my job at the moment is to convert it from MS Access to MySQL. My question is one of structure and efficiency. Currently, there's in the neighborhood of 26 tables, of this number there are two main types(with various sub-types), the 13 obj tables and 13 min tables. My thought is to combine the 13 obj tables and 13 min tables to 1 obj table and 1 min table(foregoing the sub-types). So my question is... Is it more manageable/efficient to have more tables with fewer data entries, or fewer tables with more data entries?
  2. I don't get any errors, nothing gets updated though. I'll check out the mysql_real_escape_string and see if that fixes anything. In the mean time, any other help would be great.
  3. I have some php code that's supposed to execute a mysql statement to update an already existing record. I can't figure out why it doesn't update. Here's the bit of code. The Form: echo "<form method=\"post\" action=\"edit2.php\" enctype=\"multipart/form-data\"> <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"100000\"> <input type=\"hidden\" name=\"id\" value\"$id\"> <tr><td>Image</td><td></td><td><img src=\"$dir\" width=\"50\" height=\"50\"></td></tr> <tr><td>Upload New Image</td><td></td><td><input type=\"file\" name=\"file\" id=\"file\"></td></tr> <tr><td>Type</td><td></td><td><input type=\"text\" name=\"type\" value=\"$type\"></td></tr> <tr><td>Name</td><td></td><td><input type=\"text\" name=\"product_name\" value=\"$product_name\"></td></tr> <tr><td>Price</td><td>\$</td><td><input type=\"text\" name=\"price\" value=\"$price\"></td></tr> <tr><td>Description</td><td></td><td><input type=\"text\" name=\"description\" value=\"$description\"></td></tr> <tr><td colspan=\"3\"><center><input type=\"submit\" value=\"Submit\"></td></tr></form>"; The update: <?php include('./inc/session.php'); $id=$_POST['id']; $type=$_POST['type']; $product_name=$_POST['product_name']; $price=$_POST['price']; $description=$_POST['description']; include('./inc/connect.php'); $sql="UPDATE products SET type='$type', product_name='$product_name', price='$price', description='$description' WHERE id='$id'"; $result=mysql_query($sql)or die(mysql_error()); mysql_close(); echo "Updated"; ?>
  4. Thanks for the suggestion. That's actually what I plan on doing next but I'm not very well versed in arrays. I'm trying to get it to the point where the table created has prepopulated data from a database and is editable. I already have a database connector, but would you mind giving an example of how the multidimensional array would work with this? A link works as well if you have one :-)
  5. Is there any way to make this more efficient, or is this about as bare bones as this sort of function can get?
  6. Hi all, this may be in the wrong forums so mods feel free to move it. I'm just looking for some critique on this function I wrote. Keep in mind that I'm a novice ;-) ################################################## # Creates a Table # ################################################## <?php $rows=5; $columns=5; function createTable($rows,$columns){ echo "<table>"; for($x=0;$x<$rows;$x++){ echo "<tr>"; for($i=0;$i<$columns;$i++){ echo "<td>space</td>"; } echo "</tr>"; } echo "</table>"; } ?> <?php createTable($rows,$columns)?>
×
×
  • 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.