fife Posted September 30, 2010 Share Posted September 30, 2010 Hi. I have built a form on a page call join.php On this form I pass a variable in this manner; $url = "thankyou.php?val_id=".$validation.""; header("Location: {$url}"); So on the next page (which is the thankyou for registering page I want this page on load to find the user from the $validation and then email the user. I have done this many times but for some reason this time the output is "No database selected!" There really is though. Also I can see in the browser window the code I have passed so its not like that is not working! Here is the code, can anyone see my error because I just have no idea whats up! <?php include(thedatabase.php'); session_start(); $val_id = $_GET['val_id']; $FullRec__query=sprintf("SELECT * FROM users WHERE val_id= %s", $val_id); $FullRec = mysql_query($FullRec__query) or die(mysql_error()); $userInfo = mysql_fetch_array($FullRec); $user = $userInfo['username']; mail($userInfo['email'],"Validation Link From Us","Dear ".$userInfo['username'].",\n\nThank you for signing up to www.thesite.co.uk. Please find below you validation link to gain access to the site.\n\n link:\nhttp://www.thesite.co.uk/val_entrance.php?validation_id=" . $_GET['val_id'] . "\n\nTeam site\n\n\n\nFor a full list of terms and conditions please go to the main area on your page and click the terms at the bottom of the page!"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/214817-get-info-from-a-post/ Share on other sites More sharing options...
kartul Posted September 30, 2010 Share Posted September 30, 2010 change first line to: <?php include('thedatabase.php'); you were missing ' at the start Quote Link to comment https://forums.phpfreaks.com/topic/214817-get-info-from-a-post/#findComment-1117526 Share on other sites More sharing options...
fife Posted September 30, 2010 Author Share Posted September 30, 2010 Hey yes I'm sorry thats not the issue. It was just the way i posted the code. My original is not missing that in the code. I still have the no database selected Quote Link to comment https://forums.phpfreaks.com/topic/214817-get-info-from-a-post/#findComment-1117528 Share on other sites More sharing options...
the182guy Posted September 30, 2010 Share Posted September 30, 2010 Post the code that's in thedatabase.php (obviously remove your real user/pass). Quote Link to comment https://forums.phpfreaks.com/topic/214817-get-info-from-a-post/#findComment-1117532 Share on other sites More sharing options...
fife Posted September 30, 2010 Author Share Posted September 30, 2010 <?php $hostname_thebizconnect = "name"; $database_thebizconnect = "database"; $username_thebizconnect = "user"; $password_thebizconnect = "password"; $thesite = mysql_pconnect($hostname_name, $username_thebizconnect, $password_thesite) or trigger_error(mysql_error(),E_USER_ERROR); ?> Quote Link to comment https://forums.phpfreaks.com/topic/214817-get-info-from-a-post/#findComment-1117535 Share on other sites More sharing options...
the182guy Posted September 30, 2010 Share Posted September 30, 2010 1. The variable names that you have declared (host, user, pass) don't match up in your connect call. 2. There is no call to mysql_select_db() 3. Is the any reason you're using mysql_pconnect (persistent) as opposed to mysql_connect() ? Quote Link to comment https://forums.phpfreaks.com/topic/214817-get-info-from-a-post/#findComment-1117536 Share on other sites More sharing options...
fife Posted September 30, 2010 Author Share Posted September 30, 2010 sorry i was being distracted by my boss then who thinks he knows the issue but really he has no idea. Here is the proper connect file again, <?php $hostname_thebizconnect = "name"; $database_thebizconnect = "name"; $username_thebizconnect = "user"; $password_thebizconnect = "password"; $thebizconnect = mysql_pconnect($hostname_thebizconnect, $username_thebizconnect, $password_thebizconnect) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($database_thebizconnect); ?> Basically whats going on was my boss was trying to prove that merging dreamweaver code with your own code is quicker than writing your own! Don't get me wrong i preffer to write my own but now we have started and ended up with this issue. I really want to know the error so I can then say to him "see, here is the error! Wouldn't it have been much quicker to write my own code" lol. Anyway, now I'm getting the internal server error 500. Like its trying to send but failing somewhere. Quote Link to comment https://forums.phpfreaks.com/topic/214817-get-info-from-a-post/#findComment-1117539 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.