Jump to content

thara

Members
  • Posts

    604
  • Joined

Everything posted by thara

  1. Can anybody describe this mysql query. These are created by my web sever when I click database backup button on my web server. -- -- Table structure for table `category_subject` -- DROP TABLE IF EXISTS `category_subject`; CREATE TABLE `category_subject` ( `cs_id` int(4) unsigned NOT NULL auto_increment, `category_id` int(2) unsigned NOT NULL, `subject_id` int(4) unsigned NOT NULL, PRIMARY KEY (`cs_id`) ) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1; -- -- Dumping data for table `category_subject` -- LOCK TABLES `category_subject` WRITE; /*!40000 ALTER TABLE `category_subject` DISABLE KEYS */; INSERT INTO `category_subject` VALUES (1,2,1),(2,2,2),(3,2,3),(4,2,4),(5,2,5),(6,3,1),(7,3,2),(8,3,3),(9,3,4),(10,3,5),(11,4,6),(12,4,7),(13,4,,(14,4,9),(15,4,10),(16,4,11),(17,4,12),(18,4,13),(19,4,14),(20,4,15),(21,4,16); /*!40000 ALTER TABLE `category_subject` ENABLE KEYS */; UNLOCK TABLES; When I created my database I only add this query only.. others have created by web server. any comments are greatly appreciated. thank You..
  2. Post code please that you are trying to debug.
  3. what you are trying to debug?
  4. code is not execute in this if loop.. 'if (mysqli_affected_rows($dbc) == 1) { // If it ran OK'. But this loop working properly in localhost.. if (mysqli_affected_rows($dbc) == 1) { // If it ran OK. $contactId = mysqli_insert_id($dbc); // Auto Generating the Institute Code $q3 = 'SELECT institute_code FROM institutes ORDER BY registration_date DESC LIMIT 1'; $r3 = @mysqli_query ($dbc, $q3); if ( mysqli_num_rows($r3) == 1 ) { // Valid login ID. $row = mysqli_fetch_array ($r3, MYSQLI_ASSOC); $instituteCode = $row['institute_code']; $instituteCode += 1; } else { $instituteCode = 1200; } // Create the activation code: $active = md5(uniqid(rand(), true)); $q4 = "INSERT INTO institutes ( login_id, address_id, contact_id, institute_code, institute_name, institute_slogan, introduction_note, institute_history, institute_present, active, registration_date ) VALUES ( '$loginId', '$addressId', '$contactId', '$instituteCode', '$insName', '$Slogan', '$instroduction', '$history', '$present', '$active', NOW() )"; $r4 = mysqli_query ($dbc, $q4); if (mysqli_affected_rows($dbc) == 1) { // If it ran OK. $instituteId = mysqli_insert_id($dbc); // Send the email: $body = "Thank you for registering at www.lankainstitute.com website. To activate your institute profile, please click on this link:\n\n"; $body .= BASE_URL . 'activate.php?x=' . urlencode($e) . "&y=$active"; mail( 'admin@lankainstitute.com', 'Institute Profile: Registration Confirmation', $body, 'From: ' . $email . ''); foreach( $medium as $value){ $q = "INSERT INTO institute_medium ( medium_id, institute_id ) VALUES ( '$value', '$instituteId' )"; $r = mysqli_query ($dbc, $q); } foreach( $group as $value){ $q = "INSERT INTO institute_option ( option_id, institute_id ) VALUES ( '$value', '$instituteId' )"; $r = mysqli_query ($dbc, $q); } foreach( $_SESSION['category'] as $value ) { $q = "INSERT INTO institute_category ( institute_id, category_id ) VALUES ( ?, ? )"; $stmt = mysqli_prepare( $dbc, $q ); mysqli_stmt_bind_param( $stmt, 'ii', $instituteId, $value ); mysqli_stmt_execute( $stmt ); } unset($_SESSION['category']); // Clear $_POST: $_POST = array(); $url = 'http://www.lankainstitute.com/centersignup/register_success.php'; // Define the URL: ob_end_clean(); // Delete the buffer. header("Location: $url"); exit(); // Quit the script. // Print a message: //echo '<span style="text-transform: uppercase; font-weight: bold;">Your Institute has been added to the Lanka Institute Web Site.</span>'; } } But data is inserting into contact table.
  5. yes.. I checked it.. it works properly.. Script also work in localhost but not work in live server..
  6. This is my php code... if (empty($reg_errors)) { // If everything's OK... // Make sure the email address and username are available: $qy = "SELECT email FROM login WHERE email='$email'"; $re = mysqli_query ($dbc, $qy); // Get the number of rows returned: $rows = mysqli_num_rows($re); if ($rows == 0) { // No problems! // Add the login details to the database... $qy1 = "INSERT INTO login (email, password, login_level, last_login) VALUES ('$email', SHA1('$pass'), 2, now() )"; $re1 = mysqli_query ($dbc, $qy1); if (mysqli_affected_rows($dbc) == 1) { // If it ran OK. $loginId = mysqli_insert_id($dbc); // Add the address details to the database... $q1 = "INSERT INTO address (address_one, address_two, city_id ) VALUES ('$address1', '$address2', '$cityId' )"; $r1 = mysqli_query ($dbc, $q1); if (mysqli_affected_rows($dbc) == 1) { // If it ran OK. $addressId = mysqli_insert_id($dbc); // Add the contact details to the database... $q2 = "INSERT INTO contact (telephone, mobile, email, web_address, fb_address, twitter_address, google_address, best_time_call, privacy_setting ) VALUES ('$tel', '$mobile', '$email', '$web', '$facebook', '$twitter', '$google', '$bestTime', '$privacy' )"; $r2 = mysqli_query ($dbc, $q2); if (mysqli_affected_rows($dbc) == 1) { // If it ran OK. $contactId = mysqli_insert_id($dbc); // Auto Generating the Institute Code $q3 = 'SELECT institute_code FROM institutes ORDER BY registration_date DESC LIMIT 1'; $r3 = @mysqli_query ($dbc, $q3); if ( mysqli_num_rows($r3) == 1 ) { // Valid login ID. $row = mysqli_fetch_array ($r3, MYSQLI_ASSOC); $instituteCode = $row['institute_code']; $instituteCode += 1; } else { $instituteCode = 1200; } // Create the activation code: $active = md5(uniqid(rand(), true)); $q4 = "INSERT INTO institutes ( login_id, address_id, contact_id, institute_code, institute_name, institute_slogan, introduction_note, institute_history, institute_present, active, registration_date ) VALUES ( '$loginId', '$addressId', '$contactId', '$instituteCode', '$insName', '$Slogan', '$instroduction', '$history', '$present', '$active', NOW() )"; $r4 = mysqli_query ($dbc, $q4); if (mysqli_affected_rows($dbc) == 1) { // If it ran OK. $instituteId = mysqli_insert_id($dbc); // Send the email: $body = "Thank you for registering at www.lankainstitute.com website. To activate your institute profile, please click on this link:\n\n"; $body .= BASE_URL . 'activate.php?x=' . urlencode($e) . "&y=$active"; mail( 'admin@lankainstitute.com', 'Institute Profile: Registration Confirmation', $body, 'From: ' . $email . ''); foreach( $medium as $value){ $q = "INSERT INTO institute_medium ( medium_id, institute_id ) VALUES ( '$value', '$instituteId' )"; $r = mysqli_query ($dbc, $q); } foreach( $group as $value){ $q = "INSERT INTO institute_option ( option_id, institute_id ) VALUES ( '$value', '$instituteId' )"; $r = mysqli_query ($dbc, $q); } foreach( $_SESSION['category'] as $value ) { $q = "INSERT INTO institute_category ( institute_id, category_id ) VALUES ( ?, ? )"; $stmt = mysqli_prepare( $dbc, $q ); mysqli_stmt_bind_param( $stmt, 'ii', $instituteId, $value ); mysqli_stmt_execute( $stmt ); } unset($_SESSION['category']); // Clear $_POST: $_POST = array(); $url = 'http://localhost/lanka_institute/centersignup/register_success.php'; // Define the URL: ob_end_clean(); // Delete the buffer. header("Location: $url"); exit(); // Quit the script. // Print a message: //echo '<span style="text-transform: uppercase; font-weight: bold;">Your Institute has been added to the Lanka Institute Web Site.</span>'; } } } } } else { // The email address or username is not available. $reg_errors['email'] = 'This email address has already been registered. Try again with a different email'; } // End of $rows == 0 IF. } // End of empty($reg_errors) IF Data insert to login, address, contact table very well. But data is not inserting to institute table. It works earlier but now it is not. Anybody can tell me where I have gone wrong.... Thank you.
  7. Hi.. everyone.. I have a problem in my php form now. Earlier it worked properly. It mean I registered 7 institutes and it was no problem the form worked very well. But when I try to register my 8 institute using same php script I cant register it. It is very confusing for me and I cant think actually what has happen. There is no error message as well. This is my form ]http://www.lankainstitute.com/centersignup/institute_registration_form.php[/b] can anybody tell me what has happen? any comments are greatly appreciated. Thank YOu.
  8. I have a login system in my website that enable users to register my website. So I need to send an email to that registered user telling their username, password etc when they are registering in my website.
  9. thanks for response.. Is there an alternative solution to get normal password from the database?
  10. Hi... Everyone. I have stored passwords in the database are encrypted using MySQL?s SHA1() function. So can I know is there a way to retrieve an unencrypted version of a password? Any comments are greatly appreciated. Thank You.
  11. Psycho's idea was very imported for me do my job. In common, Thanks for all 3 replies. Its greatly appreciated.
  12. hi.. everyone.. This is a sql query problem that I have uncounted and have been in the same script for hours. But Still I couldn't get it to work. I need to get a image from database and its type should be one of a value from my $designation array. The query should check $designation array's value with database and if its match with one of a value in database then query can retrieve one row. This is my designation array. its value I use for image type in my db. $designation = array ( 'Managing Director', 'Manager', 'Director', 'The Principal', 'Deputy Principal', 'Proprietor', 'Assistant Manager', 'Head Master'); My problem is how can I check these value exit in my table and how can I make a query for this. In query where condition is confusing to me... any comments are greatly appreciated. Thank you..
  13. Actually I need get a image from database and its type should be one of a value from my $designation array. The query should check $designation array's value with database table and if its match with one of a value in database then query can retrieve one row.
  14. hi.. every one. I have a problem with a logic. this is it..... I need select an one row from the database. when retrieving data sql query need to check some image type. That mean, I have these values 'Director, Manager, Principal etc.' and those value I used as image type in my database. Actually I need to get a image from db after matching its type. I try to do it like this... $q = "SELECT image_id FROM institute_images WHERE institute_id = $instituteId AND image_type = " . // Make the designaton array for check Image Type: $desig = array ( 'Managing Director', 'Manager', 'Director', 'The Principal', 'Deputy Principal', 'Proprietor', 'Assistant Manager', 'Head Master'); $imageType = false; // check that file is of an permitted MIME type foreach ($desig as $type) { if ($type ) { $imageType = true; break; } } $r = mysqli_query ( $dbc, $q ); $numRows = mysqli_num_rows($r); if ( $numRows == 0) { it is little bit confusing me.. can anybody help me to fix this problem... thank you
  15. You need to execute 1st query too using mysql_query() function. You have done it for your 2nd query only.
  16. Can I rewrite URL in localhost? for 3 days I am trying to rewrite my URL in localhost.. still I cant get it works.. any comments are greatly appreciated. Thank You.
  17. Thanks for it.. [A-Za-z_]+ I change it like this [A-Za-z_-+]+ But still my browser URL is same. it is not changing as I expect.
  18. i have only used notepad++ yet... it seems good enough for me..
  19. Your answer is completely not clear for me. No idea about IMO.. Can you elaborate this more, actually It will help me to clear this problem... Thank you.
  20. this is my original URL http://localhost/tutor_institute/profiles/tutors/index.php?tutorCode=1255&tutorName=Jhon Amarathunga&city=Perth I need to rewrite it like this http://localhost/tutor_institute/profiles/tutors/1255/Perth/Jhon Amarathunga.html here tutor_insitute, profiles and tutors are sub directories in my root directory. index.php page exist in tutors directory and also my htaccess file placed there. I did in my htaccess file like this RewriteEngine on RewriteRule ^/tutor_institute/profiles/tutors/([0-9]+)/([A-Za-z_]+)/([A-Za-z_]+)$ index.php?tutorCode=$1&tutorName=$2&city=$3 [NC] but it is not working.. anybody tell me where I have gone wrong? Thank you.
  21. At first I showed this from your code. Strings in the square brackets need to be within single quotes. $title = $array['title']; $hlink = $array['hlink']; $desc = $array['description'];
  22. Yes. I need to display 2 images like this If day is even display image1 in 1st div and image2 in 2nd div..... If day is odd diaplay image1 in 2nd div and image2 in 1st div..... Is there a way to accomplish this task???? any comments are greatly appreciated. Thank You
  23. It mean. I want print above selected 2 images in div with randomly changing. Eg. if div 1 has image1 and div 2 has image2 in particular day and other day I need to change it vise versa
  24. thanks for your reply... now its works for me. further I would like to know. is there a way to exchange images between 2 div in particular time period and displaying 2 image with changing? any comments are greatly appreciated. thank you.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.