| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 579
![]() ![]() | Another problem. Sorry Sorry, I know I've asked a lot of questions but this SHOULD be the last.. for now. lol, just kidding. Right, When a user submits a new thread on my forum, the thread is inserted into my "threads" table in the database and the post is submitted into the "posts" table at the same time. The thread is represented in the "threads" column of the "posts" table as a number (the id of the thread). But the post is submitted at the same time as the thread so how will I be able to assign the post to the correct thread? I hope that makes sense. Sorry if i wasn't very clear
__________________ SQL Dumpster - SQL Database Dumps and Resources |
| |
| | THREAD STARTER #3 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 579
![]() ![]() | Thanks for the reply. I have a threadID column in the posts table but I'm unsure how to insert the new thread ID into it the same time it is being created. I'll try and illustrate the tables: Posts: ID, category, threadid, author, content, time, date Threads: ID, title, author, starttime, startdate Then as you can imagine, as the user submits a new thread, I want the post inserted into the "posts" table as well as the thread into the "threads" table
__________________ SQL Dumpster - SQL Database Dumps and Resources |
| |
| | THREAD STARTER #5 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 579
![]() ![]() | Thanks iNod. That's definately the correct method but I think I'm going wrong somewhere. it's inserting into the database the actual text "mysql_insert_id". Here's my code: PHP Code: http://www.darkfx.co.uk/darkfx/threads.php?category=1
__________________ SQL Dumpster - SQL Database Dumps and Resources
Last edited by Encenta.com; 10-22-2005 at 12:12 PM.
|
| |
| | #6 (permalink) |
| Eating Pie Join Date: Nov 2004 Location: Canada
Posts: 2,267
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Ouch.. I suggest deleting that script from ftp right away.. Thats a major BW hog. Now.. Lets fix it up. First thing put ' (quotes) around $lastid The rest seems to be correct can you post rest of php. iNod
__________________ I feel old. |
| |
| | THREAD STARTER #7 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 579
![]() ![]() | lol. removed script for now PHP Code:
__________________ SQL Dumpster - SQL Database Dumps and Resources |
| |
| | #8 (permalink) |
| Eating Pie Join Date: Nov 2004 Location: Canada
Posts: 2,267
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | PHP Code: I am wondering why it is looping. iNod
__________________ I feel old. |
| |
| | THREAD STARTER #9 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 579
![]() ![]() | Well, the page which displays the threads is: PHP Code:
__________________ SQL Dumpster - SQL Database Dumps and Resources |
| |
| | THREAD STARTER #10 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 579
![]() ![]() | I got the ThreadID thing orking. But the problem now is that when displaying the threads, it isn't looping. It only displays the last row in the database
__________________ SQL Dumpster - SQL Database Dumps and Resources |
| |
| | #11 (permalink) |
| Eating Pie Join Date: Nov 2004 Location: Canada
Posts: 2,267
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Hello, Get read of that while $i stuff. Use this format PHP Code: Select all from bob. (Table I made was candy) While $row is equal to mysql_fetch_array do. print "Bob eats candy or what not"; } iNod
__________________ I feel old. |
| |
| | THREAD STARTER #12 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 579
![]() ![]() | Thank you so much once again! NP$ donated!!
__________________ SQL Dumpster - SQL Database Dumps and Resources |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem With Prozilla Image Hosting Script | Maverick | Website Development | 3 | 02-01-2006 03:32 PM |
| Very wierd Windows problem | Ravi_s | Web Design Discussion | 0 | 08-12-2005 10:29 PM |
| MySQL or PHP problem | Wildchild22 | Website Development | 10 | 07-14-2005 05:24 AM |
| vBulletin Problem!!!!!!!!!!!! | domaino | Programming | 11 | 06-23-2005 06:29 AM |