Jump to content

topflight

Members
  • Posts

    402
  • Joined

  • Last visited

    Never

Posts posted by topflight

  1. I am trying to write a mysql query that will get either information take a look

     

    $opm2 = mysql_query("SELECT * FROM `o` WHERE id='$id' AND a='AL OR a=EG'");

     

    When I run that query it gets the wrong information, it dosen't even get the ID, it get some random ID.

     

    The main question is how do you write an OR statement in a mysql_query

     

     

     

  2. I am currently using sessions, and I would like to create a remember me function in my login.php file so when the user logout it will destroy/unset the session, however when they return to the site their login info will automatically be in the box. I know you have to use session may some please give me an example with a form and php code thanks.

  3. Hello I have a PHP script that needs to be ran like every 1min is their away to do this withour doing an cron job? Because my hosting company doesn't allow cron jobs to be ran under a 15 min interval. And If their is no other way may someone please tell me how to set up a cron job a php script every 15mins. I currently have it set up to run every 15mins however it dosent for some reason. So please help.

     

     

    Thanks in advanced.

  4. I am trying to create a script that import user registration into PHPbb3.

     

    i.e: I have a main site and when the user register on the main site I also want my main site registration script to create them a PHPbb3 Forum account may somebody please explain/show how to do that.

     

    Thanks in advanced.

  5. This is my code and nothing isn't happening.

     

    $get = mysql_query("SELECT * FROM members");
    while($row = mysql_fetch_assoc($get)){
    
    $id = $row['login'];
    $od = str_replace('.', '-', strrev($row['last_pirep']));
    
    mysql_query("UPDATE members SET last_report_n = STR_TO_DATE(last_pirep,'%m.%d.%Y')");
    
    }
    
    echo'UPDATED Sucessfully!'
    
    ?>

  6. Kind of depends of where the data is now and where you want to get it to. Do you want to do this when you import CSV data or is it already in a column in a table and you want to set an actual column to the converted valued?

     

    it already in a column in a table and I want to update an actual column to the converted valued?

  7. To begin with Facebook dosen't create each profile one by one :)lol.

     

    Also what you are trying to do it common. It is called the get method. Let me give you a breakdown:

     

    Database:

    Your database will store all your member info (i.e Name,Email,Age,and Etc...). However the main important thing in the database is the ID, you will be using that to call members information out.

     

    Table name members

     

    ID

    Name

    Email

    Age

    1

    John Doe

    johndoe@johndoe.com

    25

    2

    Jane Doe

    janedoe@janedoe.com

    25

     

    Code:

    Now that a little kind of sloppy database design. Next you start coding:

    
    //Gets the Members ID
    $id = $_GET['id'];
    
    //Locate the member's info with the ID given
    $query = mysql_query("SELECT * FROM `member` WHERE id='$id'");
    
    //See does the member exist
    $num = mysql_num_rows($query);
    
    //If the member does not exist shoot an error message out
    if($num == 0){echo'Member does not exist';}else{
    
    //Member exist lets pull their info out the database
    
    $row = mysql_fetch_assoc($query);
    
    //Assigning Variables to info that is given
    $name = $row["name"];
    $email = $row["email"];
    $age = $row["age"];
    

     

    Next just create a nice HTML table a display the information i.e:

     

    
    echo"Hello $name <br>
    You are $age years old<br>
    Your email address is $email<br>
    "
    

     

    The code above may have some errors but you should get the general idea.

     

    So now lets say you have a roster page and when the use click on their username you should have the link look like the following yoursite.com/profile.php?id=1

     

    Since that ID is 1 it will then pull John Doe's information.

     

     

  8. With the following code the row is still the same:

     

    mysql_query("UPDATE members SET last_report_n = CONCAT_WS('-', RIGHT(last_pirep, 4), LEFT(last_pirep, 2), RIGHT(LEFT(last_pirep, LOCATE('.', last_pirep, 3), 2))");

  9. I have tried to do it however I created another column called last_report_n with a date value. And I ranned the following  code and it makes the new table say 2010-05-03. However I have 63 rows and they all have the same value which they all should be different because the last report date is different.

     

    <?php
    
    $get = mysql_query("SELECT `last_pirep` FROM members");
    while($row = mysql_fetch_assoc($get)){
    
    
    $od = $row["last_pirep"];
    
    mysql_query("UPDATE members SET last_report_n='$od'WHERE last_report_n='0000-00-00'");
    
    }
    
    echo'UPDATED Sucessfully!'
    
    ?>

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