Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One more: Insert using info from two tables

Status
Not open for further replies.

kelani

MIS
Nov 29, 2000
44
US
Ok masters, the last part of this mess. - this follows up to the poetry formattign thread some of you just replied to. After this, 99% of my questions are answered in previous threads. Just hope I can find my $#%@#$! book soon.

Now that the poetry is formatted, I have it so that only registered users can post. The poem adds, the data formats, but I want to add data from another table that I am querying. I'm guessing I can use CFSET again, but again, all syntax I try gives me mad errors. Here we go.

<cfquery name=&quot;search_db&quot; datasource=&quot;db26401a&quot; username=&quot;username&quot; password=&quot;passwd&quot; dbserver=&quot;localhost&quot; dbname=&quot;dbname&quot;>
SELECT email, uname and pswd FROM users WHERE uname = '#form.uname#' AND pswd = '#form.pswd#'
</cfquery>

<CFIF #search_db.recordcount# is 1>

(authentication, it works fine, now I need the username and email posted in the next part)


<cfset form.data=replace(data, &quot;#chr(13)##chr(10)#&quot;, &quot;<br>&quot;, &quot;all&quot;)>

(data formatting - thanks Darkman!)

<cfquery name=&quot;db_insert&quot; datasource=&quot;db26401a&quot; username=&quot;username&quot; password=&quot;passwd&quot; dbserver=&quot;localhost&quot; dbname=&quot;dbname&quot;>
INSERT INTO poetry (id, info, cpr, data, email) VALUES ('#form.id#', '#form.info#', '#form.cpr#', '#form.data#', '#form.name#')
</cfquery>

Now, how do I set 'name' and 'email' to be the uname and email variables from the search_db query?

Once again, I am in your debt. :)

Kelani
 
Heck, I can even get the username just because they're using it to authenticate, but not the email address :(

Help?
 
i answered your question in the other thread ! sorry i haven't seeen this one - but why do you post twice ?
 
Iza - thank you very much for replying to the previous thread.

I posted twive because i thought the question was buried too far in a (somewhat) unrelated (and assumed closed) thread and would be missed. Bad judgment call.

Looks like everything now works. Just that simple function solves about 35 similar problems with user/content creation.

i did know these things back in 1998, but lost the job required, and fell far out of practice. Plus, using PHP for a long time has fried my brain.

Much more of this, and I'll be able to help people again.

Thanks so much

Kelani
 
yes, some threads get very long and end up in somewhat unrelated problems ... don't know how to solve this or even if it needs to b solved !
(hey, *that* is funny because i'm just starting to use php, maybe we could associate ;] )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top