User Profile

Collapse

Profile Sidebar

Collapse
harman30
harman30
Last Activity: Nov 12 '15, 11:38 AM
Joined: Sep 16 '15
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • harman30
    started a topic Rewrite profile URL with username.
    in PHP

    Rewrite profile URL with username.

    In this code with mod_rewrite I can visit the profile of any user by typing his username after domain like example.com/john this will take us to john's profile. This works well however if I type any name which is not a username for existing user in my database like example.com/notauser I still get redirected to a empty profile page, though it has no profile pic or other info but all other buttons and links like followers, friends etc are still available....
    See more | Go to post

  • harman30
    started a topic Styling web pages using flex.

    Styling web pages using flex.

    I am using flexbox for styling my pages, I am using three columns in container, second and third columns are just for text and they look great but First column has images, buttons, links,text etc and everything is messed up here nothing is in order, some elements are overlaying each other. I want every new element in new line but that's not so, text and links appear on same line tried <br /> but it just adds little space and doesn't break line....
    See more | Go to post

  • thanks you are right, but when I placed it inside loop it grabs first three posts, on clicking show more no posts are loaded and show more goes away. Now I placed it inside loop

    Code:
     <?php do { //horizontal looper?>
    <td>
    <div><h2><?php echo $row['title']; ?></h2></div>          
    <div><p><?php echo $row['body']; ?></p></div>
    <img src='<?php
    ...
    See more | Go to post

    Leave a comment:


  • Loading more content in table view using ajax, php.

    Here are two samples of main page where posts are shown, first page is simple code where 3 posts are shown and below them is a load more button which loads next three posts.

    Second code is bit complex it displays three posts in table, means three posts in single row with load more button at their bottom now problem here is when I click show more the next row should have next three posts, but the first post of next row is second post...
    See more | Go to post

  • Show 'no more posts' when loading posts using ajax php.

    Below is the javascript part and load more button which I am using to load more posts from database it works fine I want to show a 'no more posts' message when all posts have been loaded but do not know how to do that exactly. Hope you guys can help.

    Code:
    <script type="text/javascript">
    $(document).ready(function(){
        $(document).on('click','.show_more',function(){
            var ID = $(this).attr('id');
    ...
    See more | Go to post

  • Call the div displaying error message only when error occurs

    In this code I am displaying errors with javascript and in case javascript is disabled php will work, error messages are displayed by div at the bottom so whether error occurs or not, div will always be there, though message is displayed only when there is error. I want that the div should be called only when error occurs because it is causing problems to style error message.

    Code:
    <script type="text/javascript">
    ...
    See more | Go to post

  • harman30
    replied to Load more data using ajax
    I have updated my question may be now you can help.
    See more | Go to post

    Leave a comment:


  • harman30
    started a topic Load more data using ajax

    Load more data using ajax

    Here in my code below I display posts in table that has 3 columns i am limiting posts so initially only two rows are visible now I want to add load more button which shows few more posts and then few more untill all posts are viewed I tried many ajax and javascript codes but couldn't find a way.
    This is my full code with two files here problem is once I click load more same six posts appear again so how to call next six posts by id and another...
    See more | Go to post

  • harman30
    started a topic Limiting rows of table and appending rows.
    in PHP

    Limiting rows of table and appending rows.

    In this code I am getting posts from database in table, table displays posts in three columns, now I want to add some jQuery to limit the number of rows and add a button which on clicking appends few rows to table I am not a professional programmer may be something like slice should be used to limit number of rows.

    Code:
    $sql = "SELECT * FROM posts";
    $query = $db->prepare($sql);
    $query->execute();
    ...
    See more | Go to post

  • harman30
    started a topic Registration form using javascript and php
    in PHP

    Registration form using javascript and php

    In my code below I am using javascript and php for building registration form. There are two files register.php that contains html code for form, javascript library and javascript code. Second file reghand.php handles php code for validation and inserting data. Data is inserted correctly into database after form validation but problem appears when validation fails. It's like no javascript comes into action, when validation fails I get redirected...
    See more | Go to post

  • harman30
    started a topic Make the title of post it's link.
    in PHP

    Make the title of post it's link.

    Below is a code in which title of post is displayed as link for opening the whole post, it works fine when using this way
    Code:
    <?php 
     // some code to get title and other stuff from db
    
     echo "<h2><a href='blog.php?blogId=" . $row['blogs_id'] . "'>$title</a></h2>";
    ?>
    but now I have made some changes in my code and for that changes to take effect...
    See more | Go to post

  • Use jQuery to show errors while submitting registration form.

    In the code below I want to show error messages using jQuery for registration form errors. Problem is this code is simply inserting data into database without checking any errors or showing error message and redirects to login page. So where I am going wrong or what I am missing? I have included jQuery library in original code.
    Code:
    if(isset($_POST['reg'])){
      $fn = ucfirst($_POST['fname']);
      $ln = ucfirst($_POST['lname']);
    ...
    See more | Go to post

  • harman30
    started a topic Display blogs in mulitple columns.
    in PHP

    Display blogs in mulitple columns.

    Below is a code which gets blogs from database and displays it in single column on screen, I want to display blogs in multiple columns may be three,with each column displaying 10 blogs ordered by their id, so how to do that. If it is too long to answer here maybe mentioning any method that is easy to use can help me.

    this is how I call posts from db:

    Code:
     $query = ("SELECT blogs_id, title, body, posted_by,  category
    ...
    See more | Go to post

  • harman30
    started a topic Code for login gone wrong.
    in PHP

    Code for login gone wrong.

    I am having problem logging in, below is a login code. When I submit login info it says Incorrect Information, I have gone wrong somewhere in code and can't figure it out. I have used password_hash() function, checked my database and it works well. Surely somethings wrong with login code. I tried echoing $pass_db and on submitting info I see the password is echoed correctly but incorrect information is also displayed and I am not redirected to main.php...
    See more | Go to post

  • harman30
    started a topic Problem setting cookies to recognize logged in user.
    in PHP

    Problem setting cookies to recognize logged in user.

    I am trying to set cookies in two different scenarios:
    1. When users sign up.
    2. When users login.


    and then they will be directed to main.php where main.php includes header.php. Now all the problem is with header.php when users login they are redirected to main.php where header menu should be home, profile, logout etc but when users who are not logged in visit main.php. header menus should be sign up and login.
    register.php...
    See more | Go to post

  • harman30
    started a topic follow user system
    in PHP

    follow user system

    Here I made a another attempt to create a follow user system. I used a table follow_user which has fid as primary key set to Auto_increment and two more columns user_id for id of user to be followed and id_fk for id of user following.

    Follow/unfollow button works fine and data gets stored in db but problem is both id_fk and user_id display 0 where they should display id's of user following and user followed instead.

    ...
    See more | Go to post

  • harman30
    started a topic Changing follow to unfollow on click
    in PHP

    Changing follow to unfollow on click

    I am trying a create a follow system, with this code but the follow button doesn't change to unfollow on click. I manually tried inserting values in database through phpmyadmin (so that one user now follows another). I should now see Unfollow but still shows as Follow. My db connection is in header file so I am using include header file.

    Code on profile.php
    Code:
       <?php include ( "./inc/header.inc.php" ); ?>
    ...
    See more | Go to post

  • harman30
    started a topic protecting from sql injections

    protecting from sql injections

    I am using the code below for search function but it is not protected from injections and I am not programming expert so can anyone help me on this my code is


    Code:
    <?php include ( "./inc/header.inc.php" );  ?>
    <?php
    if(!isset($_POST['search'])) {
    	header("Location: main.php");
    }
    $search_sql="SELECT * FROM blogs WHERE title LIKE '%".$_POST['search']."%'
    ...
    See more | Go to post

  • harman30
    started a topic Making search box function.

    Making search box function.

    I have created a search box now want to add search function to it that searches for text entered only in my site. I want to know how things are put together for search to work. I know we need to call data from tables we want to search, but do i need to create a table for this search function just read it somewhere, if it is so what is the purpose of creating such table?
    See more | Go to post
No activity results to display
Show More
Working...