Jump to content

Lashiec

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Everything posted by Lashiec

  1. something like... <form method="post" action=""> <input type="text" name="whatever" value="<?=var1?>" /> <input type="submit" name="submit" /> </form> At the top of the page do something like: if(isset($_POST['submit'])) { $var1 = 'a'; } In the form above the value for the input text field will be filled in with the 'a' from $var1.
  2. It just returns the pointers value. I read over the array functions and didn't see anything to be able to set the internal counter of an array to a specific value. I just saw reset, end, next, prev and so on. But you could do something like $key = array_search('value', $array) and then do echo $array[$key], but that may not be what you're looking for since you're using the internal pointers...
  3. http://us2.php.net/manual/en/function.array-search.php Try the array_search() function instead. It finds the item in the array and returns it's index.
  4. Lashiec

    .=

    You'll get a notice that $myVar isn't defined if you try to $myVar .= "whatever"; without doing something like $myVar = null;. It still should work, but coding so you don't get notices is better. If you have all warning/notices turned on that is.
  5. Well, I took your URL and put in index.php and it seems to be including the file correctly. The link about the 7dwarves.htm has the <?php include... ?> code in it, but because it's an .htm page it won't actually process the php code. Rename it to 7dwarves.php and it will work. PHP code is only parsed on pages with the .php extension, unless you change some settings somewhere.
  6. Well, from what I understand maybe this would work. In the new table you have a column for unique ID to the table, another column for the ID of the forum post, and then whatever else for the message and other info. Then when you go to look for the edited messages in this new table you can sort them by the unique ID, that way you will know which post was first and second and so on. You can also look for the ID of the original message on the forum and get the specific edits for that one, sorted by their unique ID. So, a user posts, lets say it's post # 50. They go ahead and edit it, what would happen is in your new database it gets this info: Unique ID = 1, Forum ID = 50, Message = original message. When they go ahead and edit their post again it gets another entry. Unique ID = 2, Forum ID = 50, Message = ... and so on. That would be one way to keep the posts in order.
  7. Maybe have a field with a time stamp in it so you can sort it by time edited and view them in order. Or, some unique ID in the new table that you can sort the table by and pull out all the specific posts you want to and they should be in order then.
  8. Off the top of my head maybe a separate database table that when a post is edited it kicks the original message into that database with the ID.
  9. Gee, that was fast. Thanks, that should do it.
  10. I'm working on some recipe databse for a website and I'm in the planning states of how to set the thing up. Right now I figure I need a few different tables in my databse so it looks nice. Table one would be the recipe listing, which has the name of the recipe, date put in, who posted it, instructions, and so on. Table two would have the ingredients, amounts, and little notes about them if needed. What I'm trying to do is tie the multiple list of ingredients to the single listing of the recipe. From what I know I think I'll have to use a unique ID in the first table that is auto_incrementing. In the second table there will be an ID column as well, but it won't be unique to the table. That way, when a recipe is posted and it is the first one added it gets the ID of 1. The ingredients will then all be given an ID of 1 on the second table so that when I click the recipe to view it on an html page it will pull the ID 1 from table one and everything with ID 1 in the second table and put it all on my page. But, I'm not sure how to go about doing this. The part that I'm unsure of is how to get the ID from table 1 out right after I've put that recipe listing in so that I can add that ID to all the ingredients listed in table two. I was planning on letting mySQL take care of incrementing and picking an ID for table 1. I was thinking that I would have to add the recipe to table 1, then turn around and do a select on the table with multiple values to get the exact listing and grab the ID at this point and add all the ingredients with the ID. But, that just seems to be a lot of extra work on the database and was hoping there was a better way about going at this. Any help is appreciated, or any idea of a new way to make the database and tables would work too. Thanks!
×
×
  • 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.