Search the Community
Showing results for tags 'mysql database'.
-
Hey there. I have a website that has been "dumped" in my lap as my programmer has journeyed to greener pastures. We have a small form that collects a little data and supposedly inserts it into the database, but for some reason that data never makes it there. You can get the two pages that contain the code: http://dev.goshensparklingjewelry.com/page_1.txt is the page that the user goes to to insert the data, and http://dev.goshensparklingjewelry.com/page_2.txt is the magic page that makes it happen. Not sure what is going on. When you submit the data, you even get the success page as if it went through alright. There is also a place in there that reads and displays data that is already in there, and that part works as well. thanks!
-
I have recently installed PHP, MySQL [server version: 5.5.35-0ubuntu0.13.10.1 (Ubuntu)], Apache Server and phpMyAdmin on my Ubuntu 13.10 PC. I am used to using these to build and maintain websites and associated databases along with cPanel on web servers, but have decided that it would be useful to be able to build and test php pages/MySQL databases locally. The installation of the above went smothly and Apache amd phpMyadmin are working correctly. My document root folder is /var/www which I have chmod to 777. I have copied some files that I also have on a website and exported its associated database and imported it locally through phpMyadmin. The php files render correctly in my browser but I do not seem to be able to link to the database. The connection is controlled by a config file which lists hostname, database name, database user and database password. I am used to setting up databases online through cpanel which gives you all of these parameters. My question is, when setting up databases locally are the database user and database password the same as the user name and password for phpMyAdmin, which for me would be root and <an undiclosed password> ? I don't know of ways of setting up users and associated passwords as you would do through cPanel. Will these values be the same for all databases created or do/can seperate users be created? Many thanks.
-
I am trying to save images in my database from HTML form. I have written PHP code to accomplish this task. Its giving me the following error message,and not inserting data in the database. Kindly check it. Here i am sharing a excerpt from my code. I am using BLOB for image. /*------------------- IMAGE QUERY ---------------*/ $file =$_FILES['image']['tmp_name']; if(!isset($file)) { echo 'Please select an Image'; } else { $image_check= getimagesize($_FILES['image']['tmp_name']); if($image_check==false) { echo 'Not a Valid Image'; } else { $image =file_get_contents ($_FILES['image']['tmp_name'] ); $image_name =$_FILES['image']['name']; if ($image_query =mysql_query ("insert into product_images values (1,'$image_name',$image )")) { echo $current_id; //echo 'Successfull'; } else { echo mysql_error(); } } } /*----------------- IMAGE QUERY END ---------------------*/ <form action='insert_product.php' method='POST' enctype='multipart/form-data' ></br> File : <input type='file' name= 'image' > </form> Error Message
- 4 replies
-
- mysql database
- uploading image
-
(and 2 more)
Tagged with:
-
Hello, I need help with a design of MySQL table. This is for a MLM script that has one matrix table that describes the actual matrix itself. I now need to create a table that would have the userid's of every user in different matrices and their relationship to each other. The problem I am encountering is that a depth of 10 levels could be 1000's of users in the matrix.... So, with that being said, what would be the best design for this? Thanks for any help!
- 4 replies
-
- database design
- mysql database
-
(and 1 more)
Tagged with:
-
Hi Everyone, I just had a few questions about the encryption function crypt(). If I was to do crypt($_POST['password'],CRYPT_BLOWFISH) , assuming I had just sent through a password from the form on the previous page it would return an Blowfish encrypted string. If I then used mysql to write it to my database, how, when the user logs in, would I compare the password that they have entered in the login form to the password in the database. If I compared password to the query result from the database I assume it would return that the strings do not match. My question is how would I go about comparing these two values? Is there a decrypt function that I could use to unencrypt the information from the database so that I could compare the given password with the password in the database? Thanks in advance for any help, advice or ideas! Timothy
- 10 replies
-
- crypt()
- encryption
-
(and 3 more)
Tagged with:
-
I have the following code to retrieve the password of a user from the database and email to him. I am successfully able to send a user his password if his email is present in the database. But in the event that the email doesn't exist, I want the code to echo that the email for the particular user doesn't exist in the database. My code gives me the below result if an invalid email is entered in the form: Failed to add recipient: @localhost [sMTP: Invalid response code received from server (code: 555, response: 5.5.2 Syntax error. v9sm2318990paz.6)] I have tried using the if-else statement for this purpose. Here's the code I wrote: <?php //Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect to server"); mysql_select_db("$db_name")or die("cannot select DB"); // email value sent from HTML form $email_to=$_POST['email']; // table name $tbl_name="registration"; if($mysql1 = "SELECT ID,Email,Password FROM $tbl_name WHERE Email='$email_to' ORDER BY ID DESC ") { $selectemail = mysql_query($mysql1); $shah = mysql_fetch_array($selectemail); $EMAIL = $shah['Email']; $UID = $shah['ID']; $password = $shah['Password']; require_once "/home/computat/php/Mail.php"; $from = "abhishekagrawal.988@gmail.com"; $to = $EMAIL; $subject = "Your password for www.computationalphotography.in"; $body = "Your password for logging on to our website www.computationalphotography.in is:\n$password\r\nIf you have any additional queries, kindly write to us at abhishekagrawal.988@gmail.com\r\n\nThanks & Regards\nThe Computational Photography Team\n"; $host = "ssl://smtp.gmail.com"; $port = "465"; $username = "abhishekagrawal.988@gmail.com"; // $password = "*********"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p></p>"); } } else{ echo "<b><center>Email not found in the database</center></b>"; } /*
- 2 replies
-
- php
- mysql database
-
(and 3 more)
Tagged with: