sql - PHP call to undefined function mysql_connect -


im getting error "php call undefined function" don't know cause of error can give me clue how solve this? im new html , css.

here error. enter image description here

here sql enter image description here

here php code.

<?php //for connecting db include('connect.php'); if (!isset($_files['image']['tmp_name'])) { echo ""; } else { $file=$_files['image']['tmp_name']; $image= addslashes(file_get_contents($_files['image']['tmp_name'])); $image_name= addslashes($_files['image']['name']); move_uploaded_file($_files["image"]["tmp_name"],"gallery/" . $_files["image"]["name"]); $photo="gallery/" . $_files["image"]["name"];  $query = "insert images (photo)values('$photo')"; $result = mysql_query($query);   echo '<script type="text/javascript">alert("image uploaded ");window.location=\'index.php\';</script>'; } ?> <!doctype html> <html>     <head>         <link href="css/style.css" rel="stylesheet" />         <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>         <script src="js/slider.js"></script>         <script>         $(document).ready(function () {         $('.flexslider').flexslider({         animation: 'fade',         controlscontainer: '.flexslider'         });         });         </script>     </head>     <body>     <div class="container">     <form class="form" action="" method="post" enctype="multipart/form-data">         <div class="image">             <p>upload images , try self </p>         <div class="col-sm-4">               <input class="form-control" id="image" name="image" type="file" onchange='alertfilesize();'/>               <input type="submit" value="image"/>             </div>         </div>         </form>         <div class="flexslider">             <ul class="slides">                 <?php                     // creating query fetch images database.                     $query = "select * images order id desc limit 5";                     $result = mysql_query($query);                     while($r = mysql_fetch_array($result)){                  ?>                     <li>                     <img src="<?php echo $r['photo'];?>" width="400px" height="300px"/>                     </li>                 <?php                  }                  ?>             </ul>         </div>     </div>     </body> </html> 

here sql code.

<?php // hostname or ip of server $servername='localhost'; // username , password log onto db server $dbusername='root'; $dbpassword=''; // name of database $dbname='pegasus';  ////////////// not  edit below///////// $link=mysql_connect("$servername","$dbusername","$dbpassword"); if(!$link){     die("could not connect mysql");     } mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());  ?> 

the date , best practice using mysql php object-oriented solution. here example:

define("host", "localhost"); define("user", "username "); define("pass", "password"); define("database", "pegasus");  $mysqli = new mysqli(host, user, pass, database); $q = "update products set amount_sold = 6"; $mysqli->query($q); 

here more info on coding practice:

http://codular.com/php-mysqli

hope helps.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -