wright67uk Posted June 12, 2013 Share Posted June 12, 2013 Hi, im trying to echo mysqli results into my form fields, but nothing appears. Is this because my query is not returning any results (im expecting results), or I have I missed something here? $mysqli = new mysqli(''); if ($mysqli->connect_error) { die('Connect Error: ' . $mysqli->connect_error); } $query = "SELECT description, time, course, horse, odds1, odds2, place FROM toptips WHERE date='$newdate' AND horse='$horse'"; $result = $mysqli->query($query); while($row = mysqli_fetch_array($result)) { $description = $row['description']; $time = $row['time']; $course = $row['course']; $horse = $row['horse']; $odds1 = $row['odds1']; $odds2 = $row['odds2']; $place = $row['place']; } ?> <form action="edit_tip_action.php" method="post"><br/> <input type="hidden" value="<?php echo $id ?>" /> <div class="formtitle">Time<div/> <input name="time" type="text" value="<?php echo $time; ?>" /><br/> <div class="formtitle"><Br/>Course<div/><input name="course" type="text" value="<?php echo $course; ?>" /><br/> <div class="formtitle"><Br/>Horse<div/><input name="horse" type="text" value="<?php echo $horse ;?>" /><br/> <div class="formtitle"><br/>Odds<div/> <input name="odds1" type="text" size="1" value="<?php echo $odds1 ;?>" /> / <input name="odds2" type="text" size="1" value="<?php echo $odds2 ;?>" /><br/> <div class="formtitle"><br/>Place</div><input name="place" type="text" value="<?php echo $place ;?>" /><br/> Note: ew or Win (capital W)<br/><br/> Description<br/><textarea rows="4" cols="50"> <?php echo $description ?> </textarea> <input type="submit" value="Submit"> </form> Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted June 12, 2013 Share Posted June 12, 2013 what have you done to troubleshoot the problem? is the query running without any errors (you have no error checking logic so that you even know if the query ran or not)? when you echoed the query is it exactly what you expect it to be (i know of one thread of your's that i helped in where you had an extra space in the data your form submitted)? are you 100% sure you have matching data in your table (have you ran the echoed query directly against your database using your favorite database management tool)? you have several hundred posts on this forum. you should be able to troubleshoot what your code is doing at this point, rather than just posting it and expecting others to come up with suggestions to try or to see the reason why it is not working. Quote Link to comment 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.