Jump to content

srhino

Members
  • Posts

    66
  • Joined

  • Last visited

Everything posted by srhino

  1. I will query the following from a database. team player1 player2 player3 player4 player5 score thru Here is the code that I have started. I have not finished writing yet because I wasn't sure where to go. <?php $con = mysql_connect("localhost", "test", "test") or die('Could not connect to database'); mysql_select_db("bestball", $con) or die('Sory could not connect to the dadtabase'); $query = "SELECT * FROM scoring order by rank" ; $result = mysql_query($query); echo " <table width=\"100%\" border=\"1\" align=\"center\"> <tr> <br> <td>Rank</td> <td>Team Name</td> <td>Player 1</td> <td>Player2</td> <td>Player3</td> <td>Player4</td> <td>Player5</td> <td>Score</td> <td>Thru</td></TR> <tr> <td>$rank</td> <td>$team</td> <td>$p1</td> <td>$p2</td> <td>$p3</td> <td>$p4</td> <td>$p5</td> <td>$score</td> <td>$th</td> </tr> </table>"; ?>
  2. Hey everyone! I am trying to build a really simple golf leaderboard. Is there a way to build it so when they data records show it will automatically sort the records in order? I would like it to sort similar to below 1 John -4 2 Scott -3 2 Fred -3 2 xxxx -3 5 xxxx -2 5 xxxx -2 7 xxxx -1 8 xxxx 0 Thanks in advance for your input
  3. Can someone tell me how to do this? I have a database with customers in it. I update a section called notes so I can put notes of our conversation in it. here is the code on the update... The problem is when I go to update it doesn't show whats is already in the database. <tr><td>Notes:</td><td><textarea rows=\"10\" cols=\"50\" name=\"notes\" value=\"$notes\"></textarea></td></tr><br> When I put in like this <tr><td>Notes:</td><td><input type=\"text\" size=\"40\" name=\"notes\" value=\"$notes\"></td></tr><br> You can do it correctly...there is just not a text area to see all the notes? Help please
  4. I'm sorry I am really new at this and I still cant figure it out...I have triued all the things you suggest and it's not working. I have figured out that it has something to do with my query. When I take out the WHERE clause in my query on the update page it will update...but it changes every record...when I put in a WHERE CLAUSE that says WHERE tournid = 'tournid' the form stops working but pretends like it works...in other words it gives me the scoring posted comment although it doesn't actually update. Thanks
  5. How do I make tournid a hidden input field in my form?
  6. Ok I am having trouble figuring this out...For some reason this is not updating my changes I have two sheets...the first is <?php $tournid = $_GET['id']; $con = mysql_connect("xxxxxxxx","xxxx", "xxxxx") or die('Sorry could not connect to database at this time'); mysql_select_db("srhino", $con)or die('Sorry, could not connect to database'); $query = "SELECT * from Contacts where tournid =$tournid"; $result = mysql_query($query) or die('Sorry, could not get tournaments at this time'); if (mysql_num_rows($result) ==0){ echo "<h3> Sorry, There are no tournaments at this time, please try back later.</h3>";} else { while($row=mysql_fetch_array($result, MYSQL_ASSOC)) { $tournid = $row['tournid']; $tourname = $row['tourname']; $location = $row['location']; $month = $row['month']; $day = $row['day']; $year = $row['year']; $days = $row['days']; $contact = $row['contact']; $phone = $row['phone']; $fax = $row['fax']; $cell = $row['cell']; $email = $row['email']; $address = $row['address']; $website = $row['website']; $notes = $row['notes']; $poster = $row['poster']; echo "<form action=\"dowork.php\" method=\"post\"> <table> <tr><td>Tournament Name:</td><td><input type=\"text\" size=\"40\" name=\"tourname\" value=\"$tourname\"></td></tr><br> <tr><td>Location:</td><td><input type=\"text\" size=\"40\" name=\"location\" value=\"$location\"></td></tr><br> <tr><td colspan=\"2\" align=\"center\">Month:<input type=\"text\" size=\"2\" name=\"month\" value=\"$month\"> Day:<input type=\"text\" size=\"2\" name=\"day\" value=\"$day\"> Year:<input type=\"text\" size\"4\" name=\"year\" value=\"$year\"> # of Days:<input type=\"text\" size=\"2\" name=\"days\" value=\"$days\"></td></tr><br> <tr><td>Contact:</td><td><input type=\"text\" size=\"40\" name=\"contact\" value=\"$contact\"></td></tr><br> <tr><td>Phone:</td><td><input type=\"text\" size=\"40\" name=\"phone\" value=\"$phone\"></td></tr><br> <tr><td>Fax:</td><td><input type=\"text\" size=\"40\" name=\"fax\" value=\"$fax\"></td></tr><br> <tr><td>Mobile:</td><td><input type=\"text\" size=\"40\" name=\"cell\" value=\"$cell\"></td></tr><br> <tr><td>E-mail:</td><td><input type=\"text\" size=\"40\" name=\"email\" value=\"$email\"></td></tr><br> <tr><td>Address:</td><td><input type=\"text\" size=\"40\" name=\"address\" value=\"$address\"></td></tr><br> <tr><td>Website:</td><td><input type=\"text\" size=\"40\" name=\"website\" value=\"$website\"></td></tr><br> <tr><td>Notes:</td><td><textarea rows=\"10\" cols=\"50\" name=\"notes\" value=\"$notes\"></textarea></td></tr><br> <tr><td>Posted By:</td><td><input type=\"text\" size=\"40\" name=\"poster\" value=\"$poster\"></td></tr><br> <TR><TD colspan=\"8\" align=\"center\"><input type=\"submit\" value=\"Submit\"> <input type=\"hidden\" name=\"content\" value=\"update\"></TD></TR> </table></form>"; }}?> This is really where I think the problem is...when I change the query and take out the "where tournid='$tournid'"; part the page updates all records...when I put it in it won't update anything... <?php $tournid = $_POST['tournid']; $tourname = $_POST['tourname']; $location = $_POST['location']; $month = $_POST['month']; $day = $_POST['day']; $year = $_POST['year']; $days = $_POST['days']; $contact = $_POST['contact']; $phone = $_POST['phone']; $fax = $_POST['fax']; $cell = $_POST['cell']; $email = $_POST['email']; $address = $_POST['address']; $website = $_POST['website']; $notes = $_POST['notes']; $poster = $_POST['poster']; if (trim($month == '')) { echo "<h2>Sorry, each tournament must have a month</h2>\n"; }else { $con = mysql_connect("xxxxxxx","xxxxx", "xxxx") or die('Could not connect to server'); mysql_select_db("srhino", $con) or die('Could not connect to database'); $query = "update Contacts set tourname ='$tourname', location='$location', month='$month', day='$day', year='$year', days='$days', contact='$contact', phone ='$phone', fax='$fax', cell='$cell', email='$email', address='$address', website='$website', notes='$notes', poster='$poster' where tournid = '$tournid'"; $result = mysql_query($query) or die('Sorry, we could not post your scoring to the database at this time'); if ($result) echo "<a href\"dowork.php\"><h2>Scoring posted</h2></a>\n"; else echo "<h2>Sorry, there was a problem posting your tournament</h2>\n"; } ?> Please help thanks
  7. I need help figuring this out. I have a site that on the main page events are listed in order by dates...when people upload an event the put in the month...day...year. I have them seperated in mysql database as $month $day $year. I want to create a link on my side nav bar for each month ex January February March...etc Is there a way when you click on January that it will pull all the tournaments from jan. The site is set up with an index page that includes maincontacts.inc page that the events display on. Thanks
  8. Sorry, I should have also told you that the dates are being put in by people to describe the dates of their event. It will not be generated automatically...will I still find my answer in that tutorial.
  9. Hi, I need help from you guys and gals. I am doing a basic database and when I display my results I want to display by dates. How can I change the way the dates will display on the website. In other words how can I have it display MM-DD-YYYY instead of YYYY-DD-MM. Thanks,
  10. Still trying to understand PHP fully. I am having a problem inserting values from a form into the database. I can't figure out where I am going wrong. I have and admin sheet where I click on the word doubles and it takes me to newdouble which is a form that passes to adddouble. here is the code: newdouble.inc.php <?php $schoolid=$_GET['id']; echo "<form action=\"index.php\" method=\"post\">\n"; echo "<h2>ENTER DOUBLES SCORES</H2>"; echo "SCHOOL<input type=\"text\" name=\"name\">\n"; echo "PLAYERS<input type=\"text\" name=\"players\">\n"; echo "SET<input type=\"text\" name=\"set\">\n"; echo "<input type=\"hidden\" name=\"schoolid\" value=\"$schoolid\">\n"; echo "<input type=\"hidden\" name=\"content\" value=\"adddouble\">\n"; echo "<br><input type=\"submit\" value=\"Submit\">\n"; echo "</form>\n"; ?> adddouble.inc.php <?php $schoolid =$_POST['schoolid']; $name =$_POST['name']; $players =$_POST['players']; $set =$_POST['set']; $con = mysql_connect("localhost", "xxx", "xxxx") or die('Could not connect to server'); mysql_select_db("bluegray", $con) or die('Could not connect to database'); $query= "INSERT INTO doubles (schoolid, name, players, set)"." VALUES ($schoolid, '$name', '$players', '$set')"; $result = mysql_query($query); if ($result) echo "<h2> SCORES POSTED </h2>\n"; else echo"There was a problemo"; echo "<a href=\"index.php?content=showfullscore&id=$schoolid\">Return to School Scores</a>\n"; ?> HELP PLEASE THANKS
  11. Thanks, I was close but not close enough I really appreciate your help.
  12. I am new to PHP and I figured out how to update my database using my form...Now I want my form to fill in the text boxes with the information thats already stored in the database. How can I do this? Here is my update form so far. AM I ON THE RIGHT TRACK? and what do I need to do? THANKS <?php $con = mysql_connect("localhost","xxx", "xxx") or die('Sorry could not connect to database at this time'); mysql_select_db("tennis", $con)or die('Sorry, could not connect to database'); $query = "SELECT matchid, playera, playerb, set1a, set1b, set2a, set2b, set3a, set3b, set4a, set4b, set5a, set5b from tennis1 order by matchid"; $result = mysql_query($query) or die('Sorry, could not get tournaments at this time'); if (mysql_num_rows($result) ==0){ echo "<h3> Sorry, There are no tournaments at this time, please try back later.</h3>";} else { while($row=mysql_fetch_array($result, MYSQL_ASSOC)) { $matchid = $row['matchid']; $playera = $row['playera']; $playerb = $row['playerb']; $set1a = $row['set1a']; $set1b = $row['set1b']; $set2a = $row['set2a']; $set2b = $row['set2b']; $set3a = $row['set3a']; $set3b = $row['set3b']; $set4a = $row['set4a']; $set4b = $row['set4b']; $set5a = $row['set5a']; $set5b = $row['set5b']; }}?> <form action="index.php" method="post"> <table width="100%" border="1"> <tr><td colspan="6"><h2>Enter New Scoring</h2></td></tr> <tr><td colspan="2" align="center">Matchid:<input type= "text" size="40" name="matchid"></td> <td colspan="2" align="center">Teama:<input type= "text" size="40" name="teama"></td> <td colspan="2" align="center">Teamb:<input type= "text" size="40" name="teamb"></td></tr> <tr><td>Playera:<input type="text" size="40" name="playera"></td> <td>set1a:<input type="text" size="5" name="set1a"></td> <td>set2a:<input type="text" size="5" name="set2a"></td> <td>set3a:<input type="text" size="5" name="set3a"></td> <td>set4a:<input type="text" size="5" name="set4a"></td> <td>set5a:<input type="text" size="5" name="set5a"></td></tr> <tr><td>Playerb:<input type="text" size="40" name="playerb"></td> <td>set1b:<input type="text" size="5" name="set1b"></td> <td>set2b:<input type="text" size="5" name="set2b"></td> <td>set3b:<input type="text" size="5" name="set3b"></td> <td>set4b:<input type="text" size="5" name="set4b"></td> <td>set5b:<input type="text" size="5" name="set5b"></td></tr> <TR><TD colspan="6" align="center"><input type="submit" value="Submit"> <input type="hidden" name="content" value="update"></TD></TR> </table></form>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.