emediastudios Posted November 11, 2007 Share Posted November 11, 2007 My site recently had its controll panel upgraded, beforhand i was able to update delete and insert records, now i cant insert? Has anyone heard of this or is it just a coincidence ? Link to comment https://forums.phpfreaks.com/topic/76838-solved-server-upgrade-php-problems/ Share on other sites More sharing options...
MadTechie Posted November 11, 2007 Share Posted November 11, 2007 is this "cPanel"..? upgraded from what version to what version ? insert SQL records ? via ? phpmyadmin ? version ? Link to comment https://forums.phpfreaks.com/topic/76838-solved-server-upgrade-php-problems/#findComment-389012 Share on other sites More sharing options...
emediastudios Posted November 11, 2007 Author Share Posted November 11, 2007 is this "cPanel"..? upgraded from what version to what version ? insert SQL records ? via ? phpmyadmin ? version ? cPanel 11 and my php version phpMyAdmin - 2.11.0 MySQL client version: 4.1.22 dont know what was before hand. Link to comment https://forums.phpfreaks.com/topic/76838-solved-server-upgrade-php-problems/#findComment-389019 Share on other sites More sharing options...
emediastudios Posted November 11, 2007 Author Share Posted November 11, 2007 i cant seem to insert anymore, get the reported error, database not selected Link to comment https://forums.phpfreaks.com/topic/76838-solved-server-upgrade-php-problems/#findComment-389021 Share on other sites More sharing options...
MadTechie Posted November 11, 2007 Share Posted November 11, 2007 you haven't selected a database on the left then! Link to comment https://forums.phpfreaks.com/topic/76838-solved-server-upgrade-php-problems/#findComment-389029 Share on other sites More sharing options...
emediastudios Posted November 11, 2007 Author Share Posted November 11, 2007 i have a connection file included but that insnt working for some reason, i get the reported error, database not selected, but only online not on local host. all my connection settings are right, i have checked many times is a real strange problem as my delete record and update records work fine, you have helped me before, i thankyou for everything, you helped me on this same file im working on now so you may recognise it. here is the full code <?php require_once('../Connections/gcproperty.php'); ?> <?php //***FUNCTIONS //filter extensions function valid_ext($file_name) { $valid = array("jpeg","jpg","png","gif"); $extension = strtolower(substr($file_name,-3,3)); return (in_array($extension, $valid)); } //filter by size, function valid_size($size) { return ($size <= 1048576); } //This is the directory where images will be saved $path = '../images/'; //This gets all the other information from the form $name=$_POST['name']; $rank=$_POST['rank']; $suburb=$_POST['suburb']; $price=$_POST['price']; $content=$_POST['content']; $content2=$_POST['content2']; $agentmobile=$_POST['agentmobile']; $agentemail=$_POST['agentemail']; $uploadFile0=($_FILES['uploadFile0']['name']); $uploadFile1=($_FILES['uploadFile1']['name']); $uploadFile2=($_FILES['uploadFile2']['name']); $uploadFile3=($_FILES['uploadFile3']['name']); $uploadFile4=($_FILES['uploadFile4']['name']); $uploadFile5=($_FILES['uploadFile5']['name']); $uploadFile6=($_FILES['uploadFile6']['name']); $uploadFile7=($_FILES['uploadFile7']['name']); $uploadFile8=($_FILES['uploadFile8']['name']); // Uploads Images $uploadNeed = $_POST['uploadNeed']; // start for loop $copied = 0;//the number of files successfully uploaded for($x=0;$x<$uploadNeed;$x++) { $file_name = $_FILES['uploadFile'. $x]['name']; //test $Size = $_FILES['uploadFile'. $x]['size']; //Test Check $Valid = false; if(valid_ext($file_name)) { echo " {$file_name} valid ext"; $Valid = true; }else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=invalid_extension.php\">"; exit(); } echo "</br>"; if(valid_size($Size)) { echo " {$file_name} valid size</br>"; }else{ $Valid = false; print "<meta http-equiv=\"refresh\" content=\"0;URL=invalid_size.php\">"; exit(); } if($Valid) { // strip file_name of slashes $file_name = stripslashes($file_name); $file_name = str_replace("'","",$file_name); if(file_exists($path . $file_name) ) { print "<meta http-equiv=\"refresh\" content=\"0;URL=file_exists.php\">"; exit(); }else { $copy = move_uploaded_file($_FILES['uploadFile'. $x]['tmp_name'], $path . $file_name); $copied++;//increment our counter } } } if($copied > 0) { //do your insert stuff if($copied != $uploadNeed) { $not_uploaded = $uploadNeed - $copied; print "<meta http-equiv=\"refresh\" content=\"0;URL=upload_error.php\">"; exit(); } } // check if successfully copied if($copied == $uploadNeed) { //Writes the information to the database mysql_connect("localhost","root","5050888202"); mysql_select_db("gcpropery"); mysql_query("INSERT INTO `employees` VALUES (NULL,'$name', '$rank', '$suburb', '$price', '$content', '$content2','$agentmobile', '$agentemail','$uploadFile0','$uploadFile1', '$uploadFile2', '$uploadFile3', '$uploadFile4', '$uploadFile5', '$uploadFile6', '$uploadFile7', '$uploadFile8')")or die (mysql_error()); print "<meta http-equiv=\"refresh\" content=\"0;URL=property_added_successfully.php\">"; }else{ echo "<br>$file_name The File(s) could not be uploaded!<br>The file must be under 1 meg and be of a valid extension type, jpeg, jpg, png or gif!<br /> <br /> Please go <a href=\"property_add.php\">back</a> and try again"; } // end of loop ?> Link to comment https://forums.phpfreaks.com/topic/76838-solved-server-upgrade-php-problems/#findComment-389035 Share on other sites More sharing options...
MadTechie Posted November 11, 2007 Share Posted November 11, 2007 check the table name mysql_select_db("gcpropery");<-- is this correct ? (double check) check via phpmyadmin also is the user account setup correctly check privileges Link to comment https://forums.phpfreaks.com/topic/76838-solved-server-upgrade-php-problems/#findComment-389037 Share on other sites More sharing options...
emediastudios Posted November 11, 2007 Author Share Posted November 11, 2007 Solved the problem. just added all this <?php // check if successfully copied if($copied == $uploadNeed) { //Writes the information to the database $host="localhost"; // Host name $username="gcp13916"; // Mysql username $password="5emstudio23"; // Mysql password $db_name="gcp13916_gcproperty"; // Database name $tbl_name="employees"; // Table name mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); mysql_query("INSERT INTO `employees` VALUES (NULL,'$name', '$rank', '$suburb', '$price', '$content', '$content2','$agentmobile', '$agentemail','$uploadFile0','$uploadFile1', '$uploadFile2', '$uploadFile3', '$uploadFile4', '$uploadFile5', '$uploadFile6', '$uploadFile7', '$uploadFile8')")or die (mysql_error()); print "<meta http-equiv=\"refresh\" content=\"0;URL=property_added_successfully.php\">"; }?> Didnt need this code to work on my local host though. never the less im stoked. Link to comment https://forums.phpfreaks.com/topic/76838-solved-server-upgrade-php-problems/#findComment-389042 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.