Anyone know how to insert to multiple tables on Dreamweaver?

Hey everyone,
I'm a bit of a newbie at PHP and am trying to create my first "dynamic" site.  I have a registration table with fields idNo (primary key & auto-increment), username, password, email.  I also have another table called profile with fields idNo, location, musicalInfluences, aboutMe etc.  All of these fields except idNo have the default value of "update."  What I want to be able to do is add a second insert statement to the user registration behaviour so that I can have the idNo number added to the profile tables as well as the registration table.  That way the registration and profile are linked by idNo and I can create a record-set do automatically populate the profile table on my profile page when the user logs in.  All of the different profile traits would say "update" and I can then use an update server behaviour for the user to update there profile.
I might be approaching this the wrong way so I'm open to suggestions on how to create a user login and linked profile page.  One thing I could not work out was how, when the user clicks login with the correct credentials,  I was supposed to separate a first time user, directed to the create profile page, from a user who has already created a profile page and just wants to see it.  The only way I could think of was by using the default method explained before and then having an update page.  Sorry if that was a bit of a waffle.  Here is my code.  Any help would be much appreciated!!
This is the script that I have included on my registration page.  I just extracted the php and used an include to keep the html page tidy.
<?php require_once('Connections/soundstorm.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;   
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  return $theValue;
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
  $MM_dupKeyRedirect="usernameExists.php";
  $loginUsername = $_POST['username'];
  $LoginRS__query = sprintf("SELECT username FROM registration WHERE username=%s", GetSQLValueString($loginUsername, "text"));
  mysql_select_db($database_soundstorm, $soundstorm);
  $LoginRS=mysql_query($LoginRS__query, $soundstorm) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  //if there is a row in the database, the username was found - can not add the requested username
  if($loginFoundUser){
    $MM_qsChar = "?";
    //append the username to the redirect page
    if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
    $MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
    header ("Location: $MM_dupKeyRedirect");
    exit;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "registerForm")) {
  $insertSQL = sprintf("INSERT INTO registration (username, password, email) VALUES (%s, %s, %s)",
                       GetSQLValueString($_POST['username'], "text"),
                       GetSQLValueString($_POST['password'], "text"),
                       GetSQLValueString($_POST['email'], "text"));
  mysql_select_db($database_soundstorm, $soundstorm);
  $Result1 = mysql_query($insertSQL, $soundstorm) or die(mysql_error());
  $insertGoTo = "registerSuccess.html";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  header(sprintf("Location: %s", $insertGoTo));
?>

you can use a trigger in mysql. this trigger is for new records in your registration table. you can use mysql's last_insert_id() to get the last record inserted. just search for mysql triggers to get more info. note that this is not php code, it is mysql.

Similar Messages

  • Does anyone know how to insert an Articulate Engage interaction into a Captivate 2 project?

    I would like to insert an Articulate Engage interaction into
    a Captivate 2 project. And,er, that's it really. Does anyone know
    how to do it? When I try to insert the Articulate project as an
    animation, it functions fine in the preview screen, but once it's
    been inserted all I get is the loading screen.

    Hi again darren.winter
    If I were in your shoes, here is what I'd try. Place the
    content from Articulate in a specific folder. Then publish your
    Captivate to the same folder to ensure all files are there
    together. Then test. Obviously, this may work or it may fail. And
    just as obviously, if it works, you're done!
    If it fails, I think I'd try publishing my Captivate using
    different settings. Try publishing for different Flash versions.
    You might find that if you target Flash 6 it fails, but 7 or 8 may
    work.
    If the Flash version bit fails, are there some settings in
    Articulate that allow you to reduce the number of files that are
    required? For example, I know that when Captivate 2 came out, many
    folks had to scramble (and some still do) over the fact that it
    produced multiple output files. Some LMS' didn't like the fact
    there were typically two .SWF files to distribute. We then learned
    we could eliminate one of the .SWF files by turning off the
    borders. So I'm wondering if perhaps Articulate may have similar
    output options you could use.
    Hopefully something here helps... Rick

  • Anyone know how to forward/share multiple messages??

    I am trying to forward text messages to my email and I would like to forward the whole conversation? Is this possible rather than doing them individually??

    Hi rosi77!
    Thanks Ann154 for your reply. The ability to forward multiple messages instead of sending them one at a time is not something that you can do with the device. The messages would have to be sent one at a time. However, Ann154 has an excellent idea in searching the Android Market for an application that may be able to get this done for you. I'm not able to recommend a specific application, but I'm sure you will be able to find what you need in the Market. You can look for applications on your computer, as well as your phone, by visiting:
    https://market.android.com/
    I trust this information is helpful. Thanks and have a good day!
    Christina B
    VZW Support
    Follow us on Twitter @VZWSupport

  • I have WD 1TB and use Time Machine for the past 2 years. Now I have multiple folders in my external hard drive and want to know how to condense all folders into yearly folders instead. Anyone know how to do this?

    Now I have multiple folders in my external hard drive and want to know how to condense all folders into yearly folders instead. Anyone know how to do this?

    anthonycancel wrote:
    I want the folders I already backed up to come together into one folder when that year is over. Is there a way to manually do that or automatic through TM?
    I'm quite sure there is no "automatic" way to do this. I've never heard of anyone trying it either. I suppose if you wanted try it, you could simply create a new folder in the same partition TM is on, label it for that year, then gather all the days for that year and drag/drop them into the folder. I suspect (but do not know) you'd be risking the continuity of your backups, meaning TM would simply start over again, meaning that next back up would start a new series of backups, with the first one roughly equalling the entire capacity of your internal HD, instead of adding only the new data to the previous backup. Once again, I would recommend against it, unless you're fine with TM starting a new series of backups if it doesn't work out the way you want it to. Hope you'll post back with results so we can learn from it.

  • Does anyone know how to add multiple pictures to a single frame in iMovie?

    Does anyone know how to add multiple pictures to a single frame in iMovie?

    Maybe you would be better off posting this in the iPhoto or iDVD categories of the forums.
    http://discussions.apple.com/category.jspa?categoryID=143
    http://discussions.apple.com/category.jspa?categoryID=128
    The answer to your question depends on what you ant to do with the DVD.
    Do you want a DVD menu, slide show etc.
    iPhoto will allow you to burn straight to a DVD. Just select the album you want to burn then go to share in the tool bar and select Burn.

  • Does anyone know how to save multiple webpages in safari using automator?

    Does anyone know how to save multiple webpages in safari using automator?

    You will likely get better program help in a program forum
    The Cloud forum is not about using individual programs
    The Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • The red, green and yellow buttons in the upper left corner of the screen disappear whenever I open Safari.  I cannot minimize the Safari window which I often need to do if I am coordinating multiple windows.  Does anyone know how to get those buttons back

    The red, green and yellow buttons in the upper left corner of the screen disappear whenever I open Safari.  I cannot minimize the Safari window which I often need to do if I am coordinating multiple windows between different applications.  Does anyone know how to get those buttons back?  I guess I could just switch betwen appliations, but I am used to doing it the other way.

    You're welcome 
    You had Safari in full screen mode.

  • I am trying to upgrade from Tiger to Snow Leopard.  When I insert the disk and install starts, it states "This disk is used for Time Machine backups" and Mac OSX can't be installed.  Does anyone know how to correct this (since Tiger doesn't have Time Mach

    I am trying to upgrade from Tiger to Snow Leopard.  When I insert the disk and install starts, it states "This disk is used for Time Machine backups" and Mac OSX can't be installed.  Does anyone know how to correct this (since Tiger doesn't have Time Machine)?

    http://support.apple.com/kb/TS2986

  • Anyone know how to make vertical text in a table in keynote?

    anyone know how to make vertical text in a table in keynote?

    Just to add a bit more about this question. I have seen in other related questions that this feature (vertical text) is not available in (apparently) the whole iWork09. someone even said that it should be asked to the developers, so they include this feature in iWork10. I find this issue a bit sad. This feature has been present in msOffice since a while, and at least for me, this is quite important for my work. It is also apparently not possible to have different page orientation in the same document, meaning portrait and landscape, so one can have wide tables in a whole page, for example. If this is true, it is again sad, and I just cannot understand why such a basic feature is not available in an already 09 version. I am using only the trial version of iWork, but already in the first day I have discovered that I actually cannot do what I was used to. Again sadly I (and many others I guess) will have to stick to Office until the mac software is fully developed.

  • Anyone know how it works to have multiple websites on iweb?  I would like to make a separate one from the one I'm using now and have them both up and running

    Does anyone know how it works to create more than one site on iweb - I have my primary site and mobile me connected to my domain name for that site, but now I'd like to add a completely different site and domain name.

    Here is some additional info on multiple sites in a single MMe account:
    How to have multiple sites in a single MMe account with one or more sites having a domain name.
    A. All sites are in the same Domain.sites2 files
    1 - only one site can use the CNAME method of domain name forwarding and it must  the top site in the left hand pane of iWeb.
    Click to view full size
    2 - the other sites must use URL domain name forwarding which directs the domain name to the site's full MMe URL, http://web.me.com/MMe_Username/Site_Name,  or, if there is no domain name, just MobileMe's full URL.
    B. Each site is in its own Domain.sites2 file.
    Again, only one site can use CNAME forwarding.  This presents a problem since CNAME forwarding directs the domain name to the basic MMe account URL: http://web.me.com/MMe_Username/ which uses an index.html file in the root folder of the account, iDisk/Web/Sites. Each time a new site is published or an existing site uses the File->Publish Entire Site a new index.html file is created in that root directory, iDisk/Web/Sites folder, directing the browser to that particular site.  This file is what the CNAME method uses to find the site it represents.  Therefore some steps must be taken to assure that the index.html file in the MMe Accounts root directory always points to the correct site.  This can be accomplished is three ways.
    1 - don't use the CNAME method.  Just use  URL forwarding .  This, IMO, is the simplest method as it doesn't requre any additional effort on the user once the domain name has been set up.
    2 - use the following method suggested by Wyodor in this topic: Is it possible to have multiple sites when using ur Domain name?   
    In iWeb domainfile 1:
    Create a dummy site : _dummy
    with a blank page.
    Create your working site : Whatever
    Add pages
    Publish both Sites to the same same location on the same server.
    Your _dummy site is now the default Site.
    Check.
    In iWeb domainfile 2:
    Create/Use your CurrentSite.
    Move a page to the top of the Site and back. Publish the Site.
    iWeb will create a new index.html file in the root of the server and from now on CurrentSite is the default site.
    Check.
    From now on, never move your Whatever Site to the top of the list in the iWeb sidebar and never change the page in the _dummy site.
    Simply do not touch your _dummy ever again. And never forget that.
    3 - use Ethmoid's suggested method in Using two sites - setting one up with separate domain? or republishing the entire site that uses  CNAME forwarding.  Just making a minor change and publishing the site changes does not create a new index.html file. 
    The entire site must be republsihing in order to get that new site.  
    Or keep a copy of the CNAME site's index.html file on your Mac and replace it manually in the iDisk/Web/Sites fodler when necessary.
    NOTE:  the CNAME method provides a shorter URL:  http://www.Domain_Name.com/Site_Name/Page_Name.  CNAME does not have masking.
    The URL forwarding displays the full MMe URL:   http://web.me.com/MMe_Username/Domain_Name/Page_Name.   With domain name masking that will be shortened to:   http://www.Domain_Name.com for every page of your site.
    WARNING: with masking visitors will only be able to bookmark and enter at the first page of the site.  If a page is refreshed the visitor is taken back to the first page.  Also search engines will only be able to index the first page of the site.
    OT

  • TS3276 Hello. When trying to forward a multiple page PDF document, only the first page appears. Does anyone know how to fix this. TY

    Hello. When trying to forward a multiple page PDF document, only the first page appears. Does anyone know how to fix this. TY

    Are you sure?   I believe the mail program only previews the first page for you, but sends the whole attachment.  Try opening the attachment (e.g., select and hit spacebar for a preview of the whole thing, or by double-clicking it, or control-clicking then "Open...")  You should see the whole document.

  • I have changed provider and inserted new sim but it shows 'sim not valid' does anyone know how to unlock iPhone 5?

    i have changed provider and inserted new sim but it shows 'sim not valid' does anyone know how to unlock iPhone 5?

    Yes, contact the carrier the iPhone is locked to.
    Only they can officially unlock the iPhone and if you qualify. No one else.

  • My phone app freezes and message app crashes. I tried restarting multiple times and the problem persists. Everytime i go to the phone app and press on a contact to call it just freezes up and does nothing. Does anyone know how to fix this problem?

    My phone app freezes and when i press on contact either it freezes or does nothing. Anyone know how to fix this problem? Also messaging app crashes. ANOTHER NEW PROBLEM: I can't receive calls either.

    Try to reset the phone by holding the sleep and home button for about 10sec, until the Apple logo comes back again. You will not lose any data by resetting, but it can cure some glitches.
    If this does not help, setting it up as new device would be the next step:
    How to erase your iOS device and then set it up as a new device or restore it from backups

  • Does anyone know how to remove multiple wireless profiles?

    Interestingly enough, I recently setup a new computer with the same itunes library as my old computer which I moved to another part of the house. I renamed BOTH libraries from their previous names. These are both iMacs. Now, all my iOS devices (iphones/ipads/etc.) show up on BOTH and wirelessly sync to BOTH! So, I turned off wireless sync on one of the machines but the devices still show up in the menu. Also, on the devices themselves both libraries show up as available to sync. Does anyone know how to remove the wireless capabilities from one computer or device so the devices just sync with a single library?

    The instructions that are on reedcorner are great, however if you wish to do things in a simpler way; I have created an Automator workflow that can take you through the process. You can download it here: https://public.me.com/edson.ajj

  • Does anyone know how to import multiple email addresses from the cc part of an email inot addressbook without having to do them one by one?

    i'm trying to import a group that i belong to from the cc area of an email i received in mail to addressbook without having to do them one by one which is plainly tedious. does anyone know how to do this? can i convert them to vcards somehow, all together not individually?
    thanks!!

    I have the same question

Maybe you are looking for

  • Fixed File- File Sender Adapter

    I have a Fixed File. Space is the Separator for each Field. I am SENDING the file. Issue :  The File is not picking up and I am not seeing my job in the SXMB_MONI. (We are in sp14) Please assist me. Note : I have looked the Adapter Monitor and I see

  • Lightroom 5 - Lens correction / correction objectif - Sony Alpha A7 SEL2870

    Hello everybody. I download lightroom 5 (trial version). I shoot in Raw with my Sony Alpha A7 with the basic lens 28-70 (SEL2870). I didn't found the correction for my lens. The version is (I think) update. How can I do? Thanks Hello tout le monde. J

  • Hey! something you may not know .....

    a  Laptop Battery is portable and can run on batteries alone. Nickel-Cadmium (NiCad) batteries were the first type of battery commonly used in laptop computers, and older laptops sometimes still use them. They have a life of roughly two hours between

  • Why we use INTO CORRESPONDING FIELDS OF TABLE

    why we use INTO CORRESPONDING FIELDS OF TABLE

  • Adobe photoshop elements version 2 new download?

    I do not manage to find the download for ADOBE photoshop elements version 2 for which I have a key. My computer is a PC with Windows 7 For some unknown reasons the program does not work anymore