rex_2012 Posted January 20, 2015 Share Posted January 20, 2015 Hello (I think I could have posted this in the wrong PHP area! - so posting it here), I'm pretty new at building websites using php (and mysql) and was most recently given the task to create a database image gallery, which was to be accessed through a php website. I made a full site which allowed me to upload said images & it worked perfectly. However after doing my last checks I have been told that mysql is deprecated and that I need to use mysqli. I've had a look at some tutorials on websites to help direct me but it's simply confusing me more and more each time I look at it. Is it possible I am over thinking this and there is an easier way to approach it? Thank you kindly. This is my php code: <?php //This is the directory where images will be saved $target = "images/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $name= (isset($_POST['image_author'])); $description= ($_POST['image_description']); $pic=($_FILES['photo']['name']); // Connects to your Database mysql_connect("localhost", "root", "root") or die(mysql_error()) ; mysql_select_db("image_gallery") or die(mysql_error()) ; //Writes the information to the database mysql_query("INSERT INTO images (image_author, image_description, image_pathname) VALUES ('$name', '$description', '$pic'"); //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //Tells you if its all ok echo "The file has been uploaded, and your information has been added to the directory <p> <a href='upload.php'> Go back</a>"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?> Link to comment https://forums.phpfreaks.com/topic/294085-converting-mysql-to-mysqli/ Share on other sites More sharing options...
mac_gyver Posted January 20, 2015 Share Posted January 20, 2015 the issue is in the php code, not the mysql database. stick to the thread in the php coding forum section. Link to comment https://forums.phpfreaks.com/topic/294085-converting-mysql-to-mysqli/#findComment-1503520 Share on other sites More sharing options...
Recommended Posts