
gw32
Members-
Posts
33 -
Joined
-
Last visited
-
Days Won
1
Everything posted by gw32
-
pass variables from PHP mysql form to PHP mysql select/ while On same page.
gw32 replied to gw32's topic in MySQL Help
ERROR "lock development host system" should read "local development host system". -
pass variables from PHP mysql form to PHP mysql select/ while On same page.
gw32 replied to gw32's topic in MySQL Help
I had someone from my web host send me an example of a php.ini file which he advised me where to locate it and it works. Thanks. I would like to use a lock development host system, but for the life of me I can't understand how to setup ECLIPSE or MySQL/Apache/PHP on OS X Yosemite. Either i am too dumb or the instructions are not meant for first timers. If you know of a web site that offers instructions for either of these for beginners, I'll be very grateful. I'm learning a lot from this forum, keep up the good work. Thanks -
pass variables from PHP mysql form to PHP mysql select/ while On same page.
gw32 replied to gw32's topic in MySQL Help
Thanks, I'll try all suggestions. My ISP says that E_ALL and display_errors are both ON. -
I can't seem to understand how to do this. Can someone help? I created a form to select members and hit submit. Then I wan to ON SAME PAGE display the selected members information. {CODE} //This works echo "Select Player - "; echo "<select name='players'>"; while ($row = $result->fetch_assoc()) { unset($playersid, $name); $playersid = $row['playersid']; $name = $row['name']; echo '<option value="'.$playersid.'">'.$playersid.' - '.$name.'</option>'; } echo "$playersid"; echo "</select>"; echo '<font color="White"><input type="submit" value="Submit">'; // End works // THIS IS WHERE I AM STUCK $name = $_POST['name']; $playersid = $_POST['playersid']; // VARIABLES NOT PASSED //THIS IS DISPLAYED echo '<h3 class="pos_right">Weekly Report for $name</h3>'; echo '<p class="pos_right"> <table border="1"> <thead> <tr> <td align="center" width="75">Week<br>Played</td> <td align="center" width="75">Did They <br>Attend</td> <td align="center" width="75">Points</td> <td align="center" width="75">Amount<br>Paid</td> <td align="center" width="75">High<br>Hand</td> <td align="center" width="50">Fifty<br>Fifty</td> <tr> </thead>'; // SELECT PLAYER INFO FROM DATABASE //NOT WORKING, HERE. WORKS WELL IN MYSQL SQL $query = mysqli_query($conn,"SELECT b.week, a.attend, a.points, a.payout, a.hh, a.ff FROM data a, dates b, players c WHERE a.playersid = c.playersid AND a.dateid = b.dateid AND a.playersid = 12"); $res = mysqli_query( $conn, $query ) or exit( mysqli_error($conn) ); // NOTHING DISPLAYED while($row = mysqli_fetch_array($query)) { echo "<tr> <td>" . $row['week'] . "</td> <td>" . $row['attend'] . "</td> <td>" . $row['points'] . "</td> <td>$" . $row['payout'] . "</td> <td>$" . $row['hh'] . "</td> <td>$" . $row['ff'] . "</td> </tr>"; } echo "</table>"; {END CODE} This is the last script I need help with, all other 5 scripts wor well. Thanks for your help.
-
All set, please mark as answered. Thanks
-
Great advice and nice and soft slap on the hands. Eclipse will not run on my mac, something about JVD versions, did what it said to do and still no run. Will try Netbeans. As far as spaghetti code, I just sat down last week to try to develop a web site from my spreadsheets. My spreadsheets have all the right formulas and put things where they belong. Will let you know how things progress. Thanks for your help.
-
scrapped that whole script. went to this one. <?PHP include "config.php"; //THIS SECTION WORKS $sqld = "INSERT data2 (attend, payout, total)\n" . " SELECT sumofattend,\n" . " sumofpayout,\n" . " (sumofpayout - sumofattend) AS net_total\n" . " FROM (Select (SUM(attend) * 20) AS sumofattend,\n" . " SUM(payout) AS sumofpayout\n" . " FROM data\n" . " GROUP BY playersid) AS u"; $res11 = mysqli_query( $conn, $sqld ) or exit( mysqli_error($conn) ); $sqle = "INSERT data3 (t7, att)\n" . " SELECT sum(points > 0) as t7, sum(attend) as att\n" . " FROM data\n" . " GROUP BY playersid"; $res12 = mysqli_query( $conn, $sqle ) or exit( mysqli_error($conn) ); $sqlf = "INSERT data4 (pt7)\n" . " SELECT round(sum(t7 / att) * 100,0)\n" . " FROM data3\n" . " GROUP BY data3id"; $res13 = mysqli_query( $conn, $sqlf ) or exit( mysqli_error($conn) ); $sqlg = "INSERT data1 (`tpts`, `name`, `winning`, `high`, `fty`, `total`, `weeks`, `t7`, `pt7`, `wl`) \n" . " SELECT sum( a.points ), b.name, sum( a.payout ), sum( a.hh ), sum( a.ff ), sum( a.payout + a.hh + a.ff ), sum( a.attend ), d.t7, ab.pt7, c.total \n" . " FROM data a, players b, data2 c, data3 d, data4 ab \n" . " WHERE a.playersid = b.playersid and a.playersid = c.data2id and a.playersid = d.data3id and a.playersid = ab.data4id \n" . " GROUP BY b.name"; $res11 = mysqli_query( $conn, $sqlg ) or exit( mysqli_error($conn) ); echo mysqli_error(); // END OF THIS SECTION WORKS2 //THIS SECTION DOES NOT WORK $query = "SELECT * FROM data1 order by tpts desc"; while($row = mysqli_fetch_array($query)) { echo "<tr> <td><font color='white'></td> <td><font color='white'>.$row['tpts'].</td> <td><font color='white'>.$row['name'].</td> <td><font color='white'>.$row['winning'].</td> <td><font color='white'>.$row['high'].</td> <td><font color='white'>.$row['fty'].</td> <td><font color='white'>.$row['total'].</td> <td><font color='white'>.$row['weeks']?></td> <td><font color='white'>.$row['t7'].</td> <td><font color='white'>.$row['pt7'].</td> <td><font color='white'>.$row['wl'].</td> </tr>"; } ?> Same problem no screen output.
-
Thanks, I'll try to fix what you have indicated.
-
Oh Great GURU's of the PHP Relm, please help! I have this script and when I run it I get a blank screen. Every thing looks correct don't know what's wrong. SCRIPT: <?php include "config.php"; echo '<html>'; echo '<head> <style> p.pos_right { position: relative; left: 250px; top: 100px; } h3.pos_right { position: relative; left: 450px; top: 100px; } </style> </head>'; echo '<body>'; echo '<h3 class="pos_right">Weekly Report for <script type="text/javascript"> var d=new Date(); var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday", "Saturday"); var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December"); document.write(weekday[d.getDay()] + " "); document.write(monthname[d.getMonth()] + " "); document.write(d.getDate() + ", "); document.write(d.getFullYear()); </script></h3>'; $result = mysqli_query("SELECT * FROM data1 order by tpts desc"); echo '<p class="pos_right"> <table border="1"> <thead> <tr> <td align="center" width="50">Rank</td> <td align="center" width="50">Total<br>Pts</td> <td align="center" width="100">Name</td> <td align="center" width="75">Winnings</td> <td align="center" width="75">High<br>Hand</td> <td align="center" width="75">50-50</td> <td align="center" width="75">Total</td> <td align="center" width="50">Wks<br>Plyd</td> <td align="center" width="50">In Top<br>7</td> <td align="center" width="75">% in Top 7</td> <td align="center" width="75">Won /<br>Loss</td> <tr> </thead>'; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" .['tpts']. "</td>"; echo "<td>" .['name']. "</td>"; echo "<td>" "$" .['winning']. "</td>"; echo "<td>" "$" .['high']. "</td>"; echo "<td>" "$" .['fty']. "</td>"; echo "<td>" "$" .['total']. "</td>"; echo "<td>" .['weeks']. "</td>"; echo "<td>" .['t7']. "</td>"; echo "<td>" .['pt7']."%" "</td>"; echo "<td>" "$" .['wl']. "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($conn); echo '</body>'; echo '</html>'; ?>
-
I have the following script which works well as it is, but I need to add a column that ranks each player and that column is missing from the output. Script: if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); // Truncate command $truncate = mysql_query("TRUNCATE TABLE $table"); if (!$truncate) { die("Query 1 to show fields from table failed"); } $sql = mysql_query("INSERT INTO $table(`Entry`, `Name`, `Points`, `Winnings`, `HH`, `Fty`, `Attend`) SELECT a.playersid as Entry, b.name as Name, sum(a.points) as Points, sum(a.payout) as Winnings, sum(a.high_hand) as HH, sum(a.fifty_fifty) as Fty, sum(attend) as Attend FROM data a, players b where a.playersid = b.playersid group by Entry"); if (!$sql) { die("Query 2 to show fields from table failed"); } // sending query $result = mysql_query("SELECT Name, Points, Winnings, HH, Fty, Attend FROM $table order by Points desc"); if (!$result) { die("Query to show fields from table failed"); } $fields_num = mysql_num_fields($result); echo "<h3>This Weeks Report: {$table}</h3>"; echo "<table border='1'><tr>"; echo "<tr><th>Rank</th><th>Name</th><th>Points</th><th>Winnings</th><th>High Hand</th><th>Fifty Fifty</th><th>Wks Pld</th></tr>"; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); } echo "</tr>\n"; // printing table rows while($row = mysql_fetch_row($result)) { echo "<tr>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "<td>$cell</td>"; echo "</tr>\n"; } mysql_free_result($result); ?> </body></html> I'm lost and the info I get from searching is confusing. Hope someone can help. Thanks