Can't get an image to load to a webpage using PHP with MySQl -



Can't get an image to load to a webpage using PHP with MySQl -

there's couple questions need answered. first can't o images mysql populate when log loggedin.php page. i'm getting broken link. i've seen people asking question, i've done page in such way when seek way i've seen, can't work correctly.

second, in $updatequery, not succeed alter image @ all. i've looked around , found youtube video didn't help me.

thanks in advanced.

<!doctype html> <head> <html> <meta charset="utf-8"> <title>untitled document</title> <!-- latest compiled , minified css pulled bootstrap--> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <!-- optional theme pulled bootstrap--> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"> <!-- personal sylesheet--> <link href="mandelscss.css" rel="stylesheet" type="text/css"> </head> <body> <!-- form add together new images database --> <div class="wrapper"> <h1 align="center">add images</h1> <form class="form-signin" action ="loggedin.php" method = "post"> image name: <input class="form-control" type="text" name ="name"><br /> image description: <input class="form-control" type="text" name="description"><br /> picture: <input class="btn btn-lg btn-default btn-block" type="file" name="image"><br /> <input class="btn btn-lg btn-default btn-block" type="submit" name ="submit" value="insert new image"> </form> <br> <br> <br> <h1 align="center">update images</h1> <!--php add together new images db --> <?php require("connect1.php"); ob_start(); session_start(); $select = "select * images"; $mydata = mysqli_query($connect, $select); if (isset($_post['submit'])) { $sql = "insert images (image,image_name,description) values('$_post[image]','$_post[name]','$_post[description]')"; mysqli_query($connect, $sql); }; ?> <?php $select = "select * images"; $mydata = mysqli_query($connect, $select); while($record = mysqli_fetch_array($mydata)) { ?> <form class="form-signin" action ="loggedin.php" method = "post"> image name: <input class="form-control" type="text" name ="name" value= <?php echo $record['image_name'] ?> > <br /> image description: <input class="form-control" type="text" name ="description" value= <?php echo $record['description'] ?> > <br /> picture: <input class="form-control" type="file" name ="image" <?php echo $record['image'] ?>> <img name = "image" src = <?php echo $record['image'] ?> > <input class="form-control" type="hidden" name ="hidden" value= <?php echo $record['image_name'] ?> > <input class="btn btn-lg btn-default btn-bloc" type="submit" name ="update" value ="update information"> <input class="btn btn-lg btn-default btn-bloc" type="submit" name ="delete" value ="delete"> </form> <br /> <br /> <?php if (isset($_post['update'])) { $imagename = mysqli_real_escape_string($connect, $_files["image"]["name"]); $imagedata = mysqli_real_escape_string($connect, file_get_contents($_files["image"]["tmp_name"])); echo $imagedata; $updatequery = "update images set image_name ='$_post[name]', image = '$_files[image]', description='$_post[description]' image_name='$_post[hidden]'"; mysqli_query($connect, $updatequery); } if (isset($_post['delete'])) { $deletequery = "delete images image_name='$_post[hidden]'"; mysqli_query($connect, $deletequery); } } mysqli_close($connect); ?> </div> </body> </html>

you cannot add together image image = '$_files[image]' ! seek moving image move_uploaded_file($file , $targetpath) in folder , save name of image in db!

php mysql

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -