Jump to content

displaying mysql data to a html page after submit


OGBugsy

Recommended Posts

Hi all,  I have a form that submits data to a mysql db. It's working fine. What I am trying to do is output an html page (or possibly 2) that is propagated with the data that I just sent to the db.

 

example: when I submit a new workorder, a page comes up with all the data i just submitted. so that can be printed as a "customer copy". and in a perfect world, another page comes up that is a material order form. That can be faxed to my vendor to order the materials for that job.

 

Not looking to auto print or fax anything. I am just having trouble getting the data into my html page. Here is what I have, but sadly is not working.

<?php	

    $link = mysqli_connect("xxxx", "xxxx", "xxxx", "xxxx");

    $sql = "SELECT customer FROM jobs WHERE id=6487";
		
        echo $sql;
		 
    mysqli_close($link);
?>

I would like to use the data from the last id submitted and have tried several things like: WHERE  id=mysqli::$insert_id     and   WHERE  id=$insert_id   with no luck.

 

Here is a pic of the html form and the output i'm getting.

pic.jpg

 

Any help would be greatly appreciated. Thanks in advance.

 

OGBugsy

Link to comment
Share on other sites

You've got the first part correct. The next part should be the result.
 
Here's your code, with the missing stuff put into it:
 
<?php    
 
$link = mysqli_connect("xxxx", "xxxx", "xxxx", "xxxx");
 
$sql = "SELECT customer FROM jobs WHERE id=6487";
        
#the missing stuff:
$result = $mysqli->query($sql) or die();
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo stripslashes($row['customer']);
}
}
        
mysqli_close($link);

 

?>
Link to comment
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.