|
Posted by cashmere on 06/19/06 17:40
cashmere@t-online.de wrote:
> mens libertina wrote:
> > cashmere@t-online.de wrote:
> > > When you think about it, it should be easy!
> >
> >
> > To paraphrase Bruce Lee: when you gain true understanding of the
> > problem, the solution presents itself.
> >
> > Glad you got through it and good luck :)
>
> Hey I don't kid myself that I know what I'm doing. I meant easy for
> youse guys.
> I take my hat off to those who really do.
> Anyway guys, I changed things a little and have a new prob.!
> I realised that every id needs its own database!! (cos there are a lot
> of 'em.)
> It was easy to get the value from the url as before
> $db = $_GET['id'];
> etc
> if (mysql_creat_db("$db")) {
> etc
>
> then
>
> mysql_select_db("$db");
> $sql='CREATE TABLE `multiple`( ìd` int(5) NOT NULL `content` text NOT
> NULL
> etc PRIMARY KEY (ìd`)) ; // could be typos in there I'm not pasting
> (on wrong computer)
> mysql_query($sql);
>
> OK, the above creates a database called whatever 5 digit id was
> clicked, and creates a table in it called multiple which has 2 columns,
> id and content.
> Now, looking at the page with the form for posting the user content, I
> first figured I'd copy/paste all of it at the end of the above but that
> just hung for a while. Obviously not a good idea as the FORM
> ACTION='<?php echo($_SERVER[PHP_SELF']) part was not working.
> So I removed that again and instead put this line at the bottom
> print ("Click <a href='msg_form.php?id=$db'>here!</a>;
> This takes me to the form page that we got working before, and here I
> replaced
> mysql_select_db("memb_id") or die etc. with mysql_select_db("$id") or
> die etc.
> And promptly got No Database Selected.
> Attempts to get the $_GET variable in there resulted in parse errors.
> Just to be sure the script is otherwise working, if I hardcode the
> particular id as the database name, everything works. The comment gets
> posted into the comment field.
> So how to get the just-created database selected? Any ideas?
> Cheers Dave
Sorry guys, plr disregard the above. When I put $_POST['id'] as the db
name, it worked!!
Of course, you might say.
Cheers Dave
[Back to original message]
|