RSprinkel Posted September 17, 2006 Share Posted September 17, 2006 Hi all,I need some help here on a few things I am trying to do.1) I am trying to create a form that I want data pulled out of a MySQL table called users from a column named sierra and then placed in a Drop Down box in the form. I have searched here and tried many of the ideas here and apparently I am not grabbing the concept.2) I want to have a form that pulls data from 3 different databases. It is a profile form for my league. When someone clicks on a members name the profile page will pull up displaying 3 different things. 1)Basic info on the member coming from the users table, Accomplishments within the league - Coming from the accomplishments table, and 3) Winnings - which would come from a win table. All of these tables are in the same database. Thank you all very much in advance. Quote Link to comment https://forums.phpfreaks.com/topic/21051-a-few-things-needing-help-on-please/ Share on other sites More sharing options...
AndyB Posted September 17, 2006 Share Posted September 17, 2006 Part 1[code]Choose a user: <select name="user"><?php// assumes database connection already exists$query = "SELECT sierra from users";$result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);while ($row = mysql_fetch_array($result)) { echo "<option value='". $row['sierra']. "'>". $row['sierra']. "</option>\n";?></select>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/21051-a-few-things-needing-help-on-please/#findComment-93451 Share on other sites More sharing options...
RSprinkel Posted September 17, 2006 Author Share Posted September 17, 2006 Hi AndyB,I am getting this error now when I inserted this code.Parse error: syntax error, unexpected $end in /home/../../../../test.php on line 75 Quote Link to comment https://forums.phpfreaks.com/topic/21051-a-few-things-needing-help-on-please/#findComment-93507 Share on other sites More sharing options...
redarrow Posted September 17, 2006 Share Posted September 17, 2006 what line is 75 then sorry my cristal ball not working. Quote Link to comment https://forums.phpfreaks.com/topic/21051-a-few-things-needing-help-on-please/#findComment-93511 Share on other sites More sharing options...
AndyB Posted September 17, 2006 Share Posted September 17, 2006 [code]Choose a user: <select name="user"><?php// assumes database connection already exists$query = "SELECT sierra from users";$result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);while ($row = mysql_fetch_array($result)) { echo "<option value='". $row['sierra']. "'>". $row['sierra']. "</option>\n";} // close the loop, dummy?></select>[/code]My code, my fault, see fixed version above. Quote Link to comment https://forums.phpfreaks.com/topic/21051-a-few-things-needing-help-on-please/#findComment-93514 Share on other sites More sharing options...
RSprinkel Posted September 17, 2006 Author Share Posted September 17, 2006 [quote author=redarrow link=topic=108379.msg436037#msg436037 date=1158504691]what line is 75 then sorry my cristal ball not working.[/quote]LOL sorry I didn't post that and when I re-read what I wrote I was about to post it.But no need to now. It WORKS GREAT thank you very much for the update.Again Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/21051-a-few-things-needing-help-on-please/#findComment-93517 Share on other sites More sharing options...
AndyB Posted September 17, 2006 Share Posted September 17, 2006 It's amazing how a little coffee reduces errors in my scripts :)For future reference, that error message - and it probably references the line number after the end of your script - is symptomatic of an unclosed loop. Quote Link to comment https://forums.phpfreaks.com/topic/21051-a-few-things-needing-help-on-please/#findComment-93522 Share on other sites More sharing options...
redarrow Posted September 17, 2006 Share Posted September 17, 2006 cheek your spelling of the varable.also cheek that the varable is set and also your POSTING['correct name '];good luck. Quote Link to comment https://forums.phpfreaks.com/topic/21051-a-few-things-needing-help-on-please/#findComment-93539 Share on other sites More sharing options...
RSprinkel Posted September 17, 2006 Author Share Posted September 17, 2006 Ok I got this script working now without any errors. Now when I go to post the info into the database it posts everything but the sierra name into the db. Man this PHP stuff is tuff, LOL.Here is the process script.[code]<?phpinclude 'db.php';$sierra = $_POST['sierra'];$date = $_POST['date'];$series = $_POST['series'];$nmod = $_POST['nmod'];$track = $_POST['track'];$sierra = stripslashes($sierra);$date = stripslashes($date);$series = stripslashes($series);$nmod = stripslashes($nmod);$track = stripslashes($track);//insert info into win table$sql = mysql_query ("INSERT INTO win (sierra, date, series, nmod, track)VALUES('$sierra','$date','$series','$nmod','$track')") or die (mysql_error());if(!$sql){ echo 'There has been an error processing your pirep. Please contact the webmaster.';}mysql_close($connection);//show user decision pageinclude 'test_filed.php';?>[/code]All table fields are correct in the db and coincide with the script.Again Thanks much for tolerating me and my NON PHP knowledge, LOL. Quote Link to comment https://forums.phpfreaks.com/topic/21051-a-few-things-needing-help-on-please/#findComment-93576 Share on other sites More sharing options...
AndyB Posted September 17, 2006 Share Posted September 17, 2006 check the form to ensure that the name of the 'name' field in the input line is indeed sierra, spelling and case identical to the name of the variable you're expecting in the $_POST array. Quote Link to comment https://forums.phpfreaks.com/topic/21051-a-few-things-needing-help-on-please/#findComment-93585 Share on other sites More sharing options...
RSprinkel Posted September 17, 2006 Author Share Posted September 17, 2006 AndyB,Thanks again very much for your expertise. I did something dumb and changed the <select name="sierra"> to <select users="sierra">. That is strictly my fault. What a DUMB thing for me to do, LOL.Again Thank You very much. Working like a charm now. Quote Link to comment https://forums.phpfreaks.com/topic/21051-a-few-things-needing-help-on-please/#findComment-93593 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.