Jump to content

marcus

Members
  • Posts

    1,842
  • Joined

  • Last visited

Posts posted by marcus

  1. If you want it as a string value you need to wrap it in quotes. The variable change is irrelevant, I like camel case.

     

    $query = "INSERT INTO `Want` (`id_version`,`id_customer`,`id_have`,`havewant`,`date_created`) VALUES('".$id_version."','".$_SESSION['id_customer']."','".$id_have."','".$havewant."','".$created."')";

  2. You need to call session_start() on the check login script, that's where you would initialize those session variables.

     

    edit: On the top of the file, not in the if statements.

    2nd edit: You're redefining the variables on each page setting the session variables to variables that have no initialization.

     

    Get rid of

     

    $_SESSION['login'];
    $_SESSION['rank'];
    $_SESSION['loggedinusername'] = $loggedinusername;
    $_SESSION['loggedinuseremail'] = $loggedinuseremail;

     

    On the top of each file, it does nothing but set the sessions to blank values.

     

    And as a suggestion, there's no reason to sanitize passwords if they're being encrypted. Somebody's password could be "\\\\/a/s\asnc//" and using stripslashes on it would cause it to be "\/a/sasnc//" before encryption.

  3. The second query on the page is overwriting your query. Just comment out this patch of code:

     

    <?php
    //$query_selectAllItems = "SELECT *, DATE_FORMAT(workshop_date, '%e-%m-%Y') as 'my_date' FROM tbl_workshops"; 
    $query_selectAllItems = "SELECT * FROM tbl_registration"; 
    $result_all = mysql_query($query_selectAllItems);
    $numRows_all = mysql_num_rows($result_all);
    ?>

     

    You would obviously be getting the same data because:

     

    while ($c_row = mysql_fetch_array($result_all)){

     

    is going to be corresponding to the latest data stores in the $result_all variable.

  4. $links = array ('http://www.php.net/styles/site.css', 'http://www.example.com/styles/some.js', 'http://www.domain.net/styles/hey.php');
    $results = array();
    
    foreach($links AS $link){
        if(strpos($link, '.css') !== false){
            $results[] = $link;
        }
    }

  5. It really depends on how you want your data to be viewed. You can have a fancy layout or just a simple table.

     

    echo '<table border="0" cellspacing="3" cellpadding="3">';
    echo "\n<tr><td>First Name</td>Last Name</td><td>etc...</td></tr>\n";
    while($row = mysql_fetch_array($result)){
        echo "<tr><td>".$row['first_name']."</td><td>".$row['last_name']."</td><td>".$row['etc']."</td></tr>\n";
    }
    echo "</table>\n";

  6. $input = mysql_real_escape_string($_POST['event_time']);
    
    if($input){ // check if submitted
        $sql = "SELECT * FROM `events` WHERE `event_time`='".$input."'";
        $res = mysql_query($sql) or die(mysql_error());
        if(mysql_num_rows($res) > 0){
            echo "Time slot has been previously filled. Try again.\n";
        }else {
            echo "Time slot is vacant.\n";
        }
    }else {
        echo "Please provide a time slot.\n";
    }

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