Jump to content

priti

Members
  • Posts

    461
  • Joined

  • Last visited

Posts posted by priti

  1. Hi Steve,

     

    <code>

    $total_results = @mysql_result(mysql_query("SELECT COUNT(*) as Num FROM uploads WHERE album_id = '".$_GET['galleryID']."'"),0);

    </code>

     

    It will result suppse 50 records

     

    <code>if($total_results > $max_results)</code> will always return 9

     

    hence the if condition will always be true. you need to keep LIMIT in your query to fetch the current total records.

     

    <code>

    $total_results = @mysql_result(mysql_query("SELECT COUNT(*) as Num FROM uploads WHERE album_id = '".$_GET['galleryID']."'") LIMIT $start_limit,$max_results,0);

     

    on every page $start_limit will update.

     

    Regards

    </code>

  2. One minor change, replace match with one space instead of nothing :)

    Its also worth noting that technically this replace carriage returns as well.  This will make everything appear on one line.  Is this what you are wanting or is it simply just space characters that need replacing?

     

    preg_replace("\s+", " ", $text);

     

    Damien

     

    thanks damien for correcting me

  3. hi,

     

    I have not correctly understands you but i think you can try something like

     

    $message=trim($_POST['message']);

      it will chop off the extra spaces...

     

    <tr><td colspan="2"><textarea cols="40" rows="6" name="message"><?php echo $message; ?>

              </textarea></td></tr>

     

    kindly revert back with steps what is happening exactly so one can help you in solving it.....

  4. hi taneya,

     

    well creating a url is not a tuff job once you are ready with your id from the database but it depends how you are expecting them to create.

     

    suppose

     

    you are turn with id 1,2,3,4,7,10

    If they all belong to same page them its simple

     

    $i=0;

    foreach($id_arr as $id)

    {

    $url_arr[$i]='path/to/page/category/product/id='.$id;

    $i++;

    }

     

    so $url_arr is a url array which you can use.

     

    but if these id belongs to different pages then the static part for the url has to be defined based on some criteria like categories etc....

     

    so kindly share how you are thinking about it.

     

     

    Regards

  5. my guess would be

     

    if($count==1){

    // Register $myusername, $mypassword and redirect to file "rms.php"

    $_SESSION['username']=$username;

     

    NOTE HERE YOU ARE POPULATING THE USERNAME IN SESSION ON CONDITION OF COUNT ONE AND ONCE THE SESSION GOT FILLED YOU ARE NOT RESETTING TO SOMETHING I MEAN UNSET IT .... SO NEXT CHANCE WHEN YOU WILL REFRESH IT WILL DO JUSTICE TO THE CODE.

     

    (uppercase is simply used to show my response in your code)

     

    $_SESSION['userpassword']=$userpassword;

    header("location:rms.php");

    }

     

    Regards

  6. SELECT ClientID, FirstName, LastName, CompanyName, HomePhone, WorkPhone

    FROM byrnjobdb.clients

    WHERE LastName=$lastname

     

    Kindly run this in your query interface i think you have error somewhere here.

     

    special in "FROM byrnjobdb.clients" i.e if you are keeping table aliases then byrnjobdb as clients i.e tablename as alias

     

    hope it help to solve your query.

     

    Gr8 day!!!

  7. Hi,

     

    login functionality is kept for security purpose on site so that only valid user get entry in the system.So when your system sees that they don't have matching username and password combination it means either he is new user or someone is trying to get entry without credentials to your site.

     

    Now technically on your first page

     

    what is happening is you are given a form to enter the login info then your hit submit and then this is been POST to other page.

     

    on second page validations are been done.

     

    1.If some one has not given any username you don't need to check wether this user belongs to your site right ????

    so if username is empty it is been redirected to your first page forcing user to give his/her correct username nad password.

     

    $_SESSION['invalid']='invalid';

    invalid is a flag to identify the invalid session.

     

    session keeps the variable live in one to other page .Kindly reset on first page once you show the message to user

    i.e

     

    if (isset($_SESSION['invalid'])) {

                                                    Print '<br><h2>The username or password you entered was incorrect<br>Please try again<br><br></h2>';

    $_SESSION['invalid']='';                                        }

     

    else it will keep on showing you this message :-)

     

    hope this much understanding will give you insight of what is going on in your code.

     

    Have a gr8 day.

     

  8. yes you can,define the general function only once and you can have two different vars.

     

    i.e

    xmlhttp=ajaxFunction();

    xmlrequest=ajaxFunction();

     

    because ajaxFunction() is responsible for creating the xmlhttprequest object then how you deal will depends on you.

     

    Regards

  9. hi,

     

    Lot of mistakes in the code.....

     

    var xmlHttp; ................define this above everything i.e in global space of your javascript

     

    the do

    xmlHttp=ajax();

     

     

    xmlHttp.open("POST","index.php","true");

    xmlHttp.send(null);

     

    when you do POST xmlHttp.send(null); is wrong you have to send the parameters too.

    i.e

     

    parameter="name=priti";

    xmlHttp.send(parameter);

     

    now when you have a form i.e form in javascript run the loop to all form element and create a parameter string and pass in send() function.

     

    Regards

  10. i hope you are aware of mysql function availabel in PHP.....

     

    $dbconnect=mysql_connect(username,password,host);

    mysql_select_db("database name");

     

    ...

    then use mysql_query() to execute the query and use mysql_fetch_row or mysql_fetch_array() to get the result in the php variables. regarding md5,md5 is one way encryption method. Hence you need to do md5("text value from form"); has to be used in your query

     

    something like

    select email from user_table where username=$_SESSION['username'] and password=md5($_POST['password']);

     

  11. hi

    http.abort();

    is aborting your request and what you are facing is the problem faced by many.I always prefer to make only one ajax request and then send it over the server and get the response in mean time you can show the waiting faiure too.If there is possibility of network cogestion then the validation will behvae very differently.

     

    so once user fills up the form create a signle ajax request and populate your error_string and show accordingly.

     

     

×
×
  • 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.