Jump to content

Birdmansplace

Members
  • Posts

    170
  • Joined

  • Last visited

Everything posted by Birdmansplace

  1. Thanks for your input. The first "page" of code was from someone else and its easier for me to follow making another db connection to get other data and display it differently. My ability to code is very basic and the ability to code both sets together is something i just cant wrap my head around. My code is a mess and spread out over many files but i break code up so i can follow it better. Late last night i read and re-read the code and i finally figured out why it wasn't displaying anything. The last <?php?> tag at the very end i change to <?php and should have just left it at <?. I deleted the php tag and it worked. This code is apart of a project i took on for my inlaws horse arena to make webpage based event log for competitions. Thankfully i am almost done changing the code that i wrote to mysqli. For anyone who wants to know/see more about this can check this out and once i am done i will update new files to https://sourceforge.net/projects/php-event-tracklog/
  2. Some one from here helped me create this and i have added to it. Since i have updated my server everything works now except this code. Any help would be great. <?php include("../../db_inc.php"); // define HOST, USERNAME etc $db = new mysqli(HOST,USERNAME,PASSWORD,'roundrobin'); $sql = "SELECT result_id , round_no , roper_id , roper , heeler_id , heeler , time FROM result t INNER JOIN RRroper r ON t.roper_id = r.sid INNER JOIN RRheeler h ON t.heeler_id = h.sid ORDER BY round_no, roper_id"; $output=''; $res = $db->query($sql); $currRound = 0; while (list($resid, $round, $rid, $roper, $hid, $heeler, $time) = $res->fetch_row()) { if ($round != $currRound) { if ($currRound) { // end previous form $output .= "</table></fieldset> <input type='submit' name='btnSub' value='Submit Round'></form></div>\n"; } // start new form for round $output .= "<div class='form'><form method='post' action='roundrobin_updt.php'> <fieldset><legend id='$round'>Round $round</legend> <table border='1'> <tr><th>#</th><th>Header</th><th>Heeler</th><th>Time</th></tr>\n"; $currRound = $round; } $output .= "<tr><td class='ctr'>$rid</td><td>$roper</td><td>$heeler</td> <td class='ctr'><input type='text' name='time[$resid]' value='$time' size='8'></td></tr>\n"; } $output .= "</table></fieldset> <input type='submit' name='btnSub' value='Submit Round'></form></div>\n"; ?> <html> <head> <script type="text/javascript"> jQuery(document).ready(function($) { // Hook up the current state to the nav bar $('.page-navigation').onePageNav(); }); </script> <?php ini_set("display_errors", "10"); error_reporting(E_ALL); include("../../dbinfo.php"); $con = mysqli_connect($host,$username,$password); mysqli_select_db($con, $database7) or die( "Unable to select database"); // Retrieve data from database $sql="SELECT * FROM $tbl_name13 ORDER BY sid DESC LIMIT 1 "; $result=mysqli_query($con, $sql); while($rows=mysqli_fetch_array($result)){ ?> <title>RR <?php echo $rows['d1header']; ?></title> <link rel='stylesheet' type='text/css' href='../../tracklog.css'> <style type="text/css"> body { font-family: sans-serif; font-size: 12pt; background-color:#666; } table { margin-left: auto; margin-right: auto; width: 90%; /* border-collapse: collapse; */ } th { color: black; background-color: #369; padding: 5px 3px; } td { background-color: white; font-family: sans-serif; font-size: 12pt; padding: 0 3px; color: black; t } td.ctr { background-color: #ccc; text-align: center; width: 100px; } div.form { background-color: #CCC; margin-bottom: 10px; margin-left: auto; margin-right: auto; padding: 5px; width: 900px; text-align: center; } legend { padding: 3px; background-color: #369; color: white; } fieldset { text-align: left; } input[type='text'] { text-align: right; } h1 { text-align: center; } </style> </head> <body> <div id="top"></div> <h1><?php echo $rows['d1header']; ?></h1> <?php } ?> <?php // close connection mysqli_close($con); ?> <scroll class="site-navigation page-navigation1"> Quick Scroll <ul class="menu"> <li><a href="#top">R1</a></li> <li><a href="#2">R2</a></li> <li><a href="#3">R3</a></li> <li><a href="#4">R4</a></li> <li><a href="#5">R5</a></li> <li><a href="#6">R6</a></li> <li><a href="#7">R7</a></li> <li><a href="#8">R8</a></li> <li><a href="#9">R9</a></li> <li><a href="#10">R10</a></li> </ul> </scroll> <h1>Round Robin Event</h1> <div> <?php =$output ?> </div> </body> </html>
  3. most of my site is now switched to mysqli but i am having issues with a page. its not giving me any errors and its fetching the info from the db. i have an edit function per entree that loads this page. when i click on it the edit and the page loads there is no info from db to edit and when i submit nothing changes. some one mind taking a look, thanks. <? ini_set("display_errors", "10"); error_reporting(E_ALL); include("../dbinfo.php"); $con = mysqli_connect($host,$username,$password); mysqli_select_db($con, "database") or die( "Unable to select database"); // get value of id that sent from address bar $sid=$_GET['sid']; // Retrieve data from database $sql="SELECT * FROM simple_search WHERE sid='$sid'"; $result=mysqli_query($con, $sql); $rows=mysqli_fetch_array($result); ?> <body bgcolor="#666666"> <br /> <table width="95%" border="0" cellspacing="1" cellpadding="0" align="center"> <tr> <form name="form1" method="post" action="crew_update_ac.php"> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0" align="center"> <tr> <td height="64">&nbsp;</td> <td colspan="3" align="center"><strong>Update Upcoming Event</strong> </td> </tr> <tr> <td align="center" width="9%"><strong>Event Name</strong></td> <td width="85%"><input name="stitle" type="text" id="stitle" value="<?php echo $rows['stitle']; ?>" size="50"></td> </tr> <tr> <td width="9%" height="54" align="center"><strong>Event Date</strong></td> <td width="85%"><input name="datepicker" type="text" id="datepicker" value="<?php echo $rows['datepicker']; ?>" size="50"></td> </tr> <tr> <td align="center" width="9%"><strong>Event Info</strong></td> <td width="85%"><textarea name="sbody" id="sbody" cols="150" rows="50"><?php echo $rows['sbody']; ?></textarea></td> </tr> <tr> <td align="center" width="9%"><strong>Picture</strong></td> <td width="85%"><input name="pic" id="pic" size="50" value="<?php echo $rows['pic']; ?>"></td> <td>Current Picture <br><img src="<?php echo $rows['pic']; ?>" width="173" height="137"/></td> </tr> <tr> <td align="center" width="9%"><strong>Flyer</strong></td> <td width="85%"><input name="file" id="file" size="50" value="<?php echo $rows['file']; ?>"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td align="center"><input name="id" type="hidden" id="id" value="<?php echo $rows['sid']; ?>"> <input type="submit" name="Submit" value="Submit" /></td> <td width="5%" align="center">&nbsp;</td> <td width="1%">&nbsp;</td> </tr> </table> </td> </form> </tr> </table> </body> <?php // close connection mysqli_close($con); ?>
  4. see what you mean by the echo tag.. its fetching data now.
  5. because none of the information is loading on the page that is stored in the db
  6. I wrote a website years ago and when i finally upgraded the system its was running on all my mysql commands are depreciated. So i started working on the small files to fix all the errors and now that i no longer have errors the code seams to not fetch the data from the db. its been years since i coded and now i have to re educate my self. Any help would be nice, thanks <?php ini_set("display_errors", "1"); error_reporting(E_ALL); include("dbinfo.php"); $con = mysqli_connect($host,$username,$password); // Connect to server and select database. mysqli_select_db($con, "databasename")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name3 ORDER BY date DESC LIMIT 3"; $result=mysqli_query($con, $sql); ?> <br /> <?php while($rows=mysqli_fetch_array($result)){ ?> <table width="85%"> <tr> <td width="50%" align="left"><p><a href="events/viewevent3.php?sid=<? echo $rows['sid']; ?>" class="link">&nbsp;<? echo $rows['stitle']; ?></a></p> <p class="clr-1"><? echo $rows['datepicker']; ?></p> <p class="p3">Click event name for more Details!</p></td> <td width="50%" align="right"><img src="<? echo $rows['pic']; ?>" width="171" height="137" />&nbsp;&nbsp;</td> </tr> </table> <?php } ?> <?php mysqli_close($con); ?>
  7. there will have to be even amount of ropers and healers to make it fair for everyone.
  8. couldn't save my edited post for some reason. so heres what i was adding: so not sure what to do with changing "10" to read the count of how many ropers are in the database. Once thats figured out i am also going to make a table to save the output to the db so i can save the times for each pair every round. I would like it to display the same way as well if possible. To sum it up: first step would be to enter names to database. step 2 the code you made to display and make sure everything is correct step 3 save displayed output to a table along with a column for time step 4 display saved output with the ability to save round time per pair per round step 5 when all rounds complete view it as your code does with saved times Thanks
  9. Barand I have been messing round with the code you posted and have been trying to do some stuff. I have setup a database called roundrobin in mysql. there is 2 tables RRroper, RRheeler. in each table there is 4 columns sid(auto increm), roper/healer. I am trying to figure out the code needed for $ropers and $heelers= to login and pull names from the database. include("dbinfo.php"); mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); // Retrieve data from database $sql="SELECT * FROM roper ORDER BY sid"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ echo $rows['roper']; } this will read the database but can't get it to word in your coding. I have changed $result to $ropers with no luck. removed while($rows.... and the next 2 lines with the same issue. The other issue will be once i pull info from the db if i have more than 10 pairs not all will display for ($round=1; $round<=10; $round++) { so not sure what to do with changing "10" to read the count of how many ropers are in the database. Thanks
  10. Yes to your first question requinix, and I like your idea because you say its more simple as long as your able to use mysql database. I need to register them in a table and the shuffle them from the table and save it to another table. From that other table i would need to be able to add a time to each pairing and save it back to the table so at the end we can find the winner.
  11. martin nicky and olivia heal for alice then bob and finally cindy. So there would be three rounds and never with the same partner. and for each round i need to be able to log a time per pair per round. Round1 Alice & Martin _time_ Bob & Nicky _time_ Cindy & Olivia _time_ Round2 Alice & Nicky _time_ Bob & Nicky _time_ Cindy & Martin _time_ Step one Enter roper and healer by name to a database Step two Use info from step one to make round robin list and save it. Step three Pull list from step two and be able to save a track time per pair and save again to database. Hope that helps
  12. Thanks for the in-put... The way i worded the opening topic was to be able to relate to alot of users to see what i should do. I am building a web based "arena log" for my father inlaws horse arena and they host a few different things. The round robin they do is team round robin and its a roper and a healer (car, driver as stated in opening topic). All healer's compete with one roper. I need to be able to enter into a mysql database these names, roper in one table and healer in another. Then once all the names are there make a round robin table. Once round robin table is made i also need to save a track time with that pair of people for each round. My skills with php are limited and looking for help to literally wright the code. Since I am doing this for him free of charge I am coming to you guys for help. Once everything for this is complete i plan on making it open source for download some where. Thanks
  13. What i am after is a round robin table that will sort lets say "cars", "drivers". so if i have 10 cars and 10 drivers i would end up with 10 different combos of cars and there driver. I am looking for ideas how to do this or if someone has code that does this aready. The end game for this round robin is to have all info registered into a mysql database along with it a lap time for around the track. So if car-6 and driver-2 have a lap time of 2 min i need to save this to a database. this would be for every slot in every round. Only idea i have come up with other than figuring out the code for the round robin is enter cars in one table, drivers in another. Use round robin code to generate the rounds and then have that saved to yet another table and from there display that info with functions to enter time. Ideas, code or links would be helpful Thanks
  14. Thanks for the help. Managed to get my form to write to different tables even though i am write the same info to each one. I just setup a html list menu to give option yes or no for the event field and used a if statement to not list the No people in a table.
  15. I think i understand what your saying but I have no clue how to go about it. The code i use i made for one thing and it just gets copied and pasted and changed for what i need. I don't know much about php other than to put basic forms into data base and pull it out. I am one of those i find the code make a test database and see how it works. Iike if/else php statement took me like 3 hours to figure it just the basic function to dispay info based on wheather or not any data was saved for that feild. I hate to ask but i would need to see the code to totally understand what your talking about and how it would work. I want to beable to click submit once and everything gets placed where it needs to. Thanks again.
  16. I am makeing a simple web page for my horse arena where when a rider registers there name and horse i can also select what event they are taking part in wheather is 1 type of event or every event. I have wording code that that submits there name and horse but i want to add checkboxs for the different events and once checked and submited not only will it enter name and horse in a main table but also in a table for that event. I am doing this so i can create lists for each event and have a master list and from those lists i plan on being able to edit entrys to add times and other info. heres my code so far. Thanks for taking the time to help me out <?php ini_set("display_errors", "10"); error_reporting(E_ALL); if (isset($_POST['submit'])) { { //YOU NEED TO HAVE AN EXTERNAL PHP FILE WITH YOUR DATABASE CONNECTION DETAILS. LET ME KNOW IF YOU DON'T KNOW HOW include("dbinfo.php"); mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to establish a connection to the relevant database."); $ename = mysql_real_escape_string($_POST['ename']); $ehorse = mysql_real_escape_string($_POST['ehorse']); $ipaddress = getenv('REMOTE_ADDR'); $now_datetime = date('Y-m-d h:i:s'); $msg = "$ename has been saved !"; $query = "INSERT INTO register VALUES ('','$ename','$ehorse','$ipaddress',NOW()) "; mysql_query($query); echo "<br />"; echo "<script langauge=\"javascript\">alert(\"".$msg."\");</script>"; echo "<br /><br /><br /><br />"; echo "<a href='register.php'><input name='' type='button' value='Add Another'/>"; echo "<br />"; echo "<br />"; echo "<a href='reglist.php'><input name='' type='button' value='View List'/>"; exit(); } } ?> <br /> <br /> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> Name:<input type="text" name="ename" value="<?php if (isset($_POST['ename'])) echo $_POST['ename']; ?>" size="50"/> <br /> <br /> Horse name: <input type="text" name="ehorse" value="<?php if (isset($_POST['ehorse'])) echo $_POST['ehorse']; ?>" size="45"> <br /> <br /> <-- here is where i would like checkboxs--> <input name"barrels" type="checkbox" value=""/> i want if check to add ename and ehorse to a table named barrels if not skip and go to next one <input name"roping" type="checkbox" value=""/> and this one if checked just like above, but to a table named roping <input type="submit" name="submit" id="submit" value="Submit Details"> <input type="reset" name="reset" id="reset" value="Reset Form"> </form>
  17. This is what code finally works for me. $sql="SELECT * FROM users Where sid !='session_start' ORDER BY username";
  18. I have a basic log in system setup for users to login. The users are admins and i want to be able to display all users but not there self. Basicly saying if tom, dick and my self are registered users when i see the list i dont want to see my name or if tom views the list he sees dick and my self. Because in this list i have a user delete fuction and don't want them to delete them self. Here is the code i have that displays it. <? session_start(); ?> <?php ini_set("display_errors", "1"); error_reporting(E_ALL); include("../dbinfo.php"); mysql_connect($host,$username,$password); // Connect to server and select database. mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM users ORDER BY username"; $result=mysql_query($sql) ?> <div align="center">Admin List</div> <br /> <table align="center" width="400" border="1" cellspacing="0" cellpadding="3" > <tr> <td align="center"><strong>Username</strong></td> <td align="center"><strong>Delete</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td><? echo $rows['username']; ?></td> <td align="center"><a href="deletereg.php?sid=<? echo $rows['sid']; ?>"><input name="" type="button" value="Delete" /></a> </tr> <?php } ?> </table> <?php mysql_close(); ?> I was thinking some sort of "if" statment that could do this and just cant think of how to do it. Thanks for your help
  19. thanks for the pointers. was having <select name showing up twice.
  20. viewing page source i see that it is right <SELECT NAME=id> <OPTION VALUE="ALICIA">ALICIA</option><OPTION VALUE="Randy">Randy</option><OPTION VALUE="ty">ty</option><OPTION VALUE="wendy">wendy</option> </SELECT> but all the names show up out side the dropdown and theres nothing inside it. the drop down shows up with nothing in it and all the names show up to the right out side of it.
  21. I have been trying to get a dropdown menu to load names from a db. all names are in one table in one field. this what i got so far. it shows the drop down and all the names out side of it. // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name ORDER BY stitle"; $result=mysql_query($sql); $options=""; while ($row=mysql_fetch_array($result)) { $id=$row["stitle"]; $options.="<OPTION VALUE=\"$id\">".$id.'</option>'; } ?> <SELECT NAME=id> <? echo $options ?> </SELECT>
  22. <?php ini_set("display_errors", "10"); error_reporting(E_ALL); $host="localhost"; // Host name $username="#"; // Mysql username $password="#"; // Mysql password $db_name="#"; // Database name $tbl_name="#"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $stitle = $_POST['stitle']; // get the value from the form field named "stitle" $datepicker = $_POST['datepicker']; // get the value from the form field named "datepicker" $sbody= $_POST['sbody']; $sid = $_POST['sid']; // update data in mysql database $sql="UPDATE $tbl_name SET stitle='$stitle', datepicker='$datepicker', sbody='$sbody' WHERE sid='$sid'"; $result=mysql_query($sql); // if successfully updated. if($result){ echo "Successful"; echo "<BR>"; echo "<a href='index.php'>View result</a>"; } else { echo "ERROR"; } ?>
  23. i added that above line 17 but at the end if the string and then i get this and for some reason its not passing it on. also all "id" have been changed to "sid" cause thats what its named in the db Parse error: syntax error, unexpected T_VARIABLE in update_ac.php on line 19
  24. wow not sure why i didnt think to put it there. lol. to much thinking going on and no sleep. $sql="UPDATE $tbl_name SET stitle='$stitle', datepicker='$datepicker', sbody='$sbody' WHERE sid='$sid'"; now i just need to figure out $sid. removed it from the code and it changed every entry to the same thing. code up date // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $stitle = $_POST['stitle']; // get the value from the form field named "stitle" $datepicker = $_POST['datepicker']; // get the value from the form field named "datepicker" $sbody= $_POST['sbody']; $sid=$_GET['sid']; // update data in mysql database $sql="UPDATE $tbl_name SET stitle='$stitle', datepicker='$datepicker', sbody='$sbody' WHERE sid='$sid'"; $result=mysql_query($sql);
  25. there is no "entry form" for this. i am using a db that is no longer used. just using the db for testing. i have tried defining them an all 3 pages and still get the same errors. there is a form setup for where the info is to be edited and thats it. I am half temped to try setting up the edit form as a new entry when you click submit. just cant figure it out. I want to learn this with help but you might just have to flat out code it for me so i can follow it and understand it. thanks
×
×
  • 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.