Jump to content

Recommended Posts

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>
Link to comment
https://forums.phpfreaks.com/topic/279089-no-mysqli-rows/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/279089-no-mysqli-rows/#findComment-1435623
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.