Jump to content

thara

Members
  • Posts

    604
  • Joined

Everything posted by thara

  1. My footer and some of from header is something similar to codecanyon. But entire site I coded 99% helping with professionals from here.
  2. In my main navigation bar there is a menu named category & item and it has two submenus which names are category and item respectively. I have only one page to display these two section. My page is category_item.php and it has two different tabs to display each sections. In this case it iscategory and item. So my problem is I need to open category and item tab when clicking on category and item links on the submenu. This is code from main navigation bar <li class="current"> <a>Category & Item</a> <div class="menu-container"> <div class="menu-link"> <a href="">Category</a> </div> <div class="menu-link current"> <a href="">Item</a> </div> </div> </li> This is from category_item.php page <div class="ui-widget-header ui-corner-top"> <ul> <li><a href="#tabs-1">My Category</a></li> <li><a href="#tabs-2">My Items</a></li> </ul> </div> <div id="tabs-1" class="tabs3"> my stuff... </div> <div id="tabs-21" class="tabs3"> my stuff... </div> Can I know is it possible to do? Thank you.
  3. try this // Check if the form has been submitted: if (isset($_POST['submitted'])) { $errors = array(); // Check for a first name: if (empty($_POST['title'])) { $errors[] = 'You forgot to enter the page Title.'; } else { $title = mysqli_real_escape_string($dbc, trim($_POST['title'])); } // Check for a last name: if (empty($_POST['intro'])) { $errors[] = 'You forgot to enter the page intro.'; } else { $intro = mysqli_real_escape_string($dbc, trim($_POST['intro'])); } // Check for entry text: if (empty($_POST['entry'])) { $errors[] = 'You forgot to enter the page Entry text.'; } else { $entry = mysqli_real_escape_string($dbc, ($_POST['entry'])); } // Check for a page description: if (empty($_POST['description'])) { $errors[] = 'You forgot to enter the page description text.'; } else { $entry = mysqli_real_escape_string($dbc, ($_POST['description'])); } if (empty($errors)) { // If everything's ok. echo '<pre>', print_r($_POST). '</pre>'; // Make the query $q = "UPDATE pages SET title='$title', intro='$intro', entry='$entry', description='$description' WHERE id=$id LIMIT 1"; $r = mysqli_query ($dbc, $q); if (mysqli_affected_rows($dbc) == 1) { // If it ran ok // Print a message echo '<p>The page has been edited.</p>'; } else { // If it did not run ok echo '<p class="error">The page could not be edited due to a system error. We appologise for any inconvenience.</p>'; // Public message. } } else { // Report the errors. echo '<p class="error">The following errors occurred:<br />'; foreach ($errors as $msg) { // Print each error. echo " - $msg<br />\n"; } echo '</p><p>Please try again.</p>'; } // End of if (empty($errors)) IF. } // End of submit conditional. // Always show the form... // Retrieve the page's information: $q = "SELECT title, intro, entry, description FROM pages WHERE id=$id"; $r = mysqli_query ($dbc, $q); if (mysqli_num_rows($r) == 1) { // Valid user ID, show the form. // Get the user's information: $row = mysqli_fetch_array ($r, MYSQLI_NUM); // Create the form: echo '<form action="edit_page.php" method="post"> <p>Title: <input type="text" name="title" size="20" maxlength="40" value="' . stripslashes($row[0]) . '" /></p> <p>Intro: <input type="text" name="intro" size="60" rows="10" value="' . stripslashes($row[1]) . '" /></p> <p>Entry: <textarea name="entry" rows="15" cols="80">' . stripslashes($row[2]) . '</textarea></p> <p>Meta Tag Description:<br/><input type="text" name="description" size="60" value="' . stripslashes($row[3]) . '" /></p> <p><input type="submit" name="submit" value="Submit" /></p> <input type="hidden" name="submitted" value="TRUE"" /> <input type="hidden" name="id" value="' . $id . '" /> </form>'; }
  4. Wow.. thanks SocialClod. It is greatly appreciated. I wonder how you found it. Tell me is there any software to check such a error or if not how did you find it... Anyway Thanks again for your guidance.
  5. Thanks for response. But I am confusing with your answer. 01. where this url http://www.lankainstitute.com/search.php?city= come from and how it effect to SQL injection... I am expecting some explanaiton. 02. I need to how XSS attack happen to this page - http://www.lankainstitute.com/contact.php 03. I am expecting some explanation with this link http://www.lankainstitute.com/student_registration.php? 04. What you mean 'autoscroll'? 05. If users like and have given the permission to display there contact details on the profile page, I display it on there profile page and if not so I don't Thank you.
  6. Hi.. all I have developed a website uing PHP & Mysql, www.lankainstitute.com is it's address. I would like to hear any feedback. Thanks.
  7. I am using this query to count user views for particular page. This is my query : INSERT INTO tutor_page_views ( tutor_id, views) VALUES ( $tutorId, 1) ON DUPLICATE KEY UPDATE views=views+1 This query is working. But when it is updating I need to update views something like this 01,02,03,04....10,11,12 etc.. At the moment, it works like this 1,2,3....10,11,12 etc. can anybody tell me how can I do this?
  8. Welcome to phpfreaks. I need to mention something about your coding. Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial. Now tell us whats your problems with your coding. Is there any errors?
  9. Replies 01. Yes 02. http://php.net/manual/en/mysqli-stmt.fetch.php
  10. My conditions are... $keyword is always should true. Other 3 may true or not. Only $keyword have a value return records should come matching with $keyword insubject_name or city_name. If $optional have a value then return records should come matching with $keyword and $option If $districtId have a value then result should come matching in 3 variable values. ($keyword,$option, $districtId) Finally if $cityId have a value along with others return result should come with matching all 4 variables' values. This conditions come from my search page. $keyword is text box value and its always need a keyword to start searching. That's why I said it is always true. Other 3 values come from select box that select the items when they needed. I tried to make the query, its ok. but really confusing in WHERE clause. Above code is from my WHERE clause so far. But It can not get my desired result.
  11. I am trying to run a query something like this: from WHERE clause : WHERE ( s.subject_name LIKE '%$keyword%' OR c.city_name LIKE '%$keyword%' OR o.option_name LIKE '%$option%' OR d.district_id = $districtId OR c.city_id = $cityId ) With this conditions, first two are compulsory ($keyword from subject_name or city_name) and other 3 are optional. The query not meet last three conditions result should comes with $keyword matching in subject_name or city_name. If $option have a value result should come with matching $keyword and $option. Further if $districtId have a value result should become from matching $keyword, $option and $districtId. Finally if $cityId have a value query should check all conditions to return records. My problem is when I create WHERE clause like above in my query it is not meeting my criteria. Can anybody help me to do this? Thank you.
  12. Do you make sure your db connection work for you? Try debugging your connection $mysqli = new mysqli($host, $user, $pwd, $db) or die ('Cannot open database');
  13. I used some codes to limit displaying characters from a paragraph in a while loop. This is my code: //mysqli_stmt_fetch ($stmt); while (mysqli_stmt_fetch($stmt)) { $position=70; // Define how many characters you want to display. // Find what is the last character. $subject = substr($subjects,$position,1); if($subject !=" "){ while($subject !=" "){ $i=1; $position=$position+$i; $subject = substr($subjects,$position,1); } } $subject = substr($subjects,0,$position); echo '<h4><span>Subjects / </span>'.$subject.'.....</h4>'; } My problem is when running this script it take long time to run. If I discrease $position's value then executing script quickly and if I increase $position's value it take long time to execute. if its $position=80 I can't get it to work. Actually its not executing at all. My windows Task Manager display it is using Physical Memory 100%. Can anybody tell me what is the reason for this? Thank you.
  14. Yes I know it. but my problem is how its behaving with the query to filter result...
  15. @Barand, can you tell how this two line work? $tutor = isset($_GET['institute']) ? '0' : '1'; $institute = isset($_GET['tutor']) ? '0' : '1';
  16. @Barand thanks for quick reply. But I need to display all result on the page. Although If user need to filter according to type I need to make it to filter. Thats why I have added 2 links to do it..
  17. Hello everyone. I am trying to filler a query result. This is my script // Require the configuration : require ('./includes/configuration.inc.php'); // Require the database connection: require (MYSQL); echo '<a href="">Tutor</a> | <a href="">Institute</a>'; $q = "SELECT 'tutor' AS Member_Type, tutor_code AS Member_Code, tutor_name AS Member_Name FROM tutors UNION SELECT 'institute', institute_code, institute_name FROM institutes"; $r = mysqli_query( $dbc, $q); echo '<table border="1"> <tr> <td>Member Type</td> <td>Member Code</td> <td>Member Name</td> </tr>'; while ( $row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { echo '<tr> <td>'.$row['Member_Type'].'</td> <td>'.$row['Member_Code'].'</td> <td>'.$row['Member_Name'].'</td> </tr>'; } echo '</table>'; My output is something similar to this.. +-------------+-------------+--------------------------------------+ | Member_Type | Member_Code | Member_Name | +-------------+-------------+--------------------------------------+ | tutor | 1250 | Edward | | tutor | 1251 | Sachin | | tutor | 1252 | Virath | | tutor | 1253 | Cris | | institute | 2500 | Montana | | institute | 2501 | Millanium | | institute | 2502 | Viswa | | institute | 2503 | Separd | | institute | 2504 | Madurasanga | +-------------+-------------+--------------------------------------+ Now I need to filter this result using my tutor and institute link. So can I know is this possible to do it? Hope someone will help me.. Thank you
  18. Any comments are highly appreciating? Thank you.
  19. I am trying to make a query for site searching. What I need to do with this query is I want to select four main columns according to search keyword (tutors, institutes, subjects, cities). when typing keyword the query must check this four tables and need to display search result under this four categories. when displaying search result I need to add some values to make meaningful search result. Eg: Think displaying tutors under tutors category as a search result I need to display his/her name, city, profile image etc. Its something like this. Tutors tutor's name city profile image institutes institute's name city profile image subjects subject name category name which belong this subject cities city name district name which city belong etc... I tried it something like this SELECT keyword, col, city_name, image_name, tutor_code FROM ( SELECT tutor_name AS keyword, 'Tutors' AS col, IFNULL(c1.city_name, '') city_name, IFNULL(ti.image_name, '') image_name, tutor_code FROM tutors AS t LEFT JOIN address a ON t.address_id = a.address_id LEFT JOIN city c1 ON a.city_id = c1.city_id LEFT JOIN tutor_images ti ON t.tutor_id = ti.tutor_id AND ti.image_type = 'profile' UNION SELECT subject_name AS keyword, 'Subject' AS col, '' city_name, '' image_name, '' tutor_code FROM subjects UNION SELECT city_name AS keyword, 'City' AS col, '' city_name, '' image_name, '' tutor_code FROM city UNION SELECT institute_name AS keyword, 'Institute' AS col, '' city_name, '' image_name, '' tutor_code FROM institutes AS i LEFT JOIN address a ON i.address_id = a.address_id LEFT JOIN city c2 ON a.city_id = c2.city_id LEFT JOIN institute_images ii ON i.institute_id = ii.institute_id AND ii.image_type = 'profile' ) s WHERE keyword LIKE '%$queryString%' LIMIT 10 this query work about 50% but cant get to work in 100%. Problem is it is not display city name and profile image under institutes category, cant display district name and category names under cities and subjects fields. And also I would like to this kind of query is ineffective and does it waste time and resources? Thank you.
  20. @pshcho. Thank you very much for your help. Now its solved. I greatly appreciated your answer and your ideas. I am little bit hard to understand above query reason is I am completely new to such a query. I have never used such a conditional queries before and need to make sense. And also I still confuse to understand how inner join and left join sometimes work. So If you have any free time don't forget to post some explanation. Thank you again.
  21. @Barand if you have time.. Please explain the difference between inner join and left join, still I confuse to understand it. Phycho also used left join in my previous post http://forums.phpfreaks.com/topic/274066-how-can-i-make-this-mysql-query/ But I dont have any idea why he did it so? Thank you.
  22. @Psycho Thank you for your query. Its working for me. But you have mentioned its better if I add date_expire column into login table. But I cant understand why it is. This information is not only used in login process. When tutors or institutes registering with the site they need to select their subscription period and using that period I make expiration date and add that column along with date_registered and subscription_period columns in my tutors and institutes tables. Its easy to managed me. And also you have mentioned login status. I have no idea about it and what do you mean it? I just checking expiration date when users login to system for limit to access their control panel. That mean if tutor or institute have expired their subscription period I need to stop some features they have got through their profile. So now I would like to know, do I need to store those values in database? if so which table. (is it login table?) So about this issue I am expecting some explanation form you. Because I think I should be something (with your idea) that I couldn't understand so far. your idea will be highly appreciated. Thank you.
  23. Can anyone tell me, can I use single query for this? Still I couldn't do it in single query. So I used an alternative method for do this with 3 queries. I added radio buttons along with username and password fields in form to select their login type (tutors, institutes, students). Then I checked login_type == 'tutors' and a query, login_type == 'institute' then another query and so on. Can I do this without adding any HTML for my form? 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.