Jump to content

monkeypaw201

Members
  • Posts

    376
  • Joined

  • Last visited

Posts posted by monkeypaw201

  1. Put the query in a string, echo the query to make sure it is reading your id, and use mysql_error() after your query to see if there are any errors.

     

    Query in string outputs: UPDATE private_messages SET read = 'Yes'

    WHERE id = '1'

     

    mysql_error after query outputs:

     

    (nothing)

     

    Soooo Lost...

  2. Here is the code:

     

    <?php
    
    $con = mysql_connect("localhost","user","pass");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }mysql_select_db("database", $con);
    
    mysql_query("UPDATE private_messages SET read = 'Yes'
    WHERE id = '$_GET[id]'");mysql_close($con);
    ?>

     

    Its not working... no errors, the page loads fine, it just doesnt update

  3. FIXED

     

    Ok, i kept messing with it and came out with this (Yes, It WORKS)

     

    <?php 
    $con = mysql_connect("localhost","user","pass");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
      mysql_select_db("database", $con);
      $result = mysql_query("SELECT * FROM domiciles WHERE id = '$row_Pilot[hub]'");
      while($row_con = mysql_fetch_array($result))
      {
      $airport = $row_con['airport'];
      }
      mysql_close($con);
    ?>
    <?php 
    $con = mysql_connect("localhost","user","pass");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
      mysql_select_db("database", $con);
      $result = mysql_query("SELECT * FROM airports WHERE id = '$airport'");
      while($row_con = mysql_fetch_array($result))
      {
      $city = $row_con['city'];
      echo $city;
      }
      mysql_close($con);
    ?>

  4. rhodesa, my mistake, there should be an echo here:

    $airport = $row_con['airport']; echo $airport;

    i forgot to copy/paste it..

     

    ---------

     

    craygo , the $row_Pilot[hub] is coming from a previous query higher up on the page..

     

    ---------

     

    revraz, just because i'm more comfortable troubleshooting it.. i have had little experience merging them together, and more the more complex ones, i go back to the basics.. :P

     

    -------

    EDIT:: Would it help if i provide the whole page source?

  5. if it helps when i do this, i works (it echos the right ID)

     

    <?php 
    $con = mysql_connect("localhost","user","pass");
    if (!$con)
     {
     die('Could not connect: ' . mysql_error());
     }
     mysql_select_db("database", $con);
     $result = mysql_query("SELECT * FROM domiciles WHERE id = '$row_Pilot[hub]'");
     while($row = mysql_fetch_array($result))
     {
     $airport = $row_con['airport'];
     }
     /**
    $air = mysql_connect("localhost","user","pass");
    if (!$air)
     {
     die('Could not connect: ' . mysql_error());
     }mysql_select_db("database", $air);
     $result = mysql_query("SELECT * FROM airports WHERE id = '$airport'");
     while($row = mysql_fetch_array($result))
     {
     echo = $row_air['city'];
     }
    mysql_close($air);  */
    mysql_close($con);
     
    		 ?>

     

    Turn on error reporting.

     

    :/ Never learned how...

  6. So, i have this code again, and i have a previous query that pulls soething from the database and provides an ID relative to another database, and then i need to query again from the database WHERE that ID matches the table. THEN i need to take THAT ID and re-query for a final match.

     

    <?php 
    $con = mysql_connect("localhost","user","pass");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }mysql_select_db("database", $con);
      $result = mysql_query("SELECT * FROM domiciles WHERE id = '$row_Pilot[hub]'");
      while($row = mysql_fetch_array($result))
      {
      $airport = $row['airport'];
      }
      
      $air = mysql_connect("localhost","user","pass");
    if (!$air)
      {
      die('Could not connect: ' . mysql_error());
      }mysql_select_db("database", $air);
      $result = mysql_query("SELECT * FROM airs WHERE id = '$airport'");
      while($row = mysql_fetch_array($result))
      {
      echo = $row_air['city'];
      }mysql_close($air);
    mysql_close($con);
      
    		 ?>

  7. So, i have a page with the following code on it, and it just spits at me a blank page. No errors, no echos no nothing. When i view the source code, its empty... Im lost  ???

     

    <?php
    if($_POST['password'] == $_POST['password2'])
    { //If Passwords Match
    
    //Query for the latest Callsign
    mysql_select_db($database_caliregional, $caliregional);
    $query_PID = "SELECT * FROM users ORDER BY pilot_id DESC";
    $PID = mysql_query($query_PID, $caliregional) or die(mysql_error());
    $row_PID = mysql_fetch_assoc($PID);
    $totalRows_PID = mysql_num_rows($PID);
    
    //Create un-posted variables
    $pilot_id = $row_PID['pilot_id']+1;
    $date_hired = date("now");
    $password = md5($_POST['password']);
    $first_initial = substr($_POST['first_name'];
    $forum_name = $first_initial . $_POST['last_name'];
    $full_name = $_POST['first_name'] . $_POST['last_name'];
    $IP = $_SERVER['REMOTE_ADDR'];
    $password_salt = substr(str_shuffle("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"),0,4);
    $fpassword = sha1($_POST['password'] . $password_salt);
    
    //Insert Basic User Information
    $user = mysql_connect("localhost","user","pass");
    if (!$user)
      {
      die('Could not connect: ' . mysql_error());
      }mysql_select_db("database", $user);
      $sql="INSERT INTO users (pilot_id, first_name, last_name, email, password, date_hired, hub)
    VALUES
    ('$pilot_id','$_POST[first_name]','$_POST[last_name]','$_POST[email]','$password','$date_hired','$_POST[hub]')";
    if (!mysql_query($sql,$user))
      {
      die('Error: ' . mysql_error());
      }
      
    if($_POST['forumacc'] == 'No')
    { //If No Forum Account
    //Create Forum Account
    $forum = mysql_connect("localhost","user","pass");
    if (!$forum)
      {
      die('Could not forumnect: ' . mysql_error());
      }mysql_select_db("database", $forum);
      $sqll="INSERT INTO smf_members (memberName, dateRegistered, realName, passwd, emailAddress, memberIP, memberIP2, ID_POST_GROUP, passwordSalt)
    VALUES
    ('$forum_name','$date_hired','$full_name','$fpassword','$_POST[email]','$IP','$IP','4','$password_salt')";
    if (!mysql_query($sqll,$forum))
      {
      die('Error: ' . mysql_error());
      }
    } //If No Forum Account
    
    echo "Thank you for registering with California Regional. A confirmation e-mail has been sent to the address provided.";
    
    } //If Passwords Match
    else
    { //If Passwords DONT Match
    echo "Oops! Looks like the passwords you entered don't match. Please go back and try again.";
    } //If Passwords DONT Match
    ?>
    

  8. here it is:

     

    <?php
    $pilot_id = mysql_connect("localhost","user","pass");
    if (!$pilot_id)
     {
     die('Could not connect: ' . mysql_error());
     }
     mysql_select_db("cerulean_site", $pilot_id);
     $result = mysql_query("SELECT * FROM pilots ORDER BY pilot_id DESC");
     $row = mysql_fetch_assoc($result); // add this line
     
    $pilot_id = $row['pilot_id']+1;
    //--------------------------
    $first_name=$_POST['first_name'];
    $last_name=$_POST['last_name'];
    $email=$_POST['email'];
    $password=md5($_POST['password']);
    $dob=$_POST['dob'];
    $personal_location=$_POST['personal_location'];
    $personal_country=$_POST['personal_country'];
    $public_msn=$_POST['public_msn'];
    $public_yim=$_POST['public_yim'];
    $public_aim=$_POST['public_aim'];
    $public_skype=$_POST['public_skype'];
    $public_icq=$_POST['public_icq'];
    $public_website=$_POST['public_website'];
    $public_avatar=$_POST['public_avatar'];
    $public_biography=$_POST['public_biography'];
    $public_sagtv=$_POST['public_sagtv'];
    $public_real_world_pilot=$_POST['public_real_world_pilot'];
    $public_vatsim_controller=$_POST['public_vatsim_controller'];
    $public_vatsim=$_POST['public_vatsim'];
    $activation_code=substr(str_shuffle("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),0,35);
    $hire_date=date("F j, Y");
    //-------------------------
    $transfer_airline=$_POST['transfer_airline'];
    $transfer_proof_link=$_POST['transfer_proof_link'];
    $transfer_hours_requested=$_POST['transfer_hours_requested'];
    
    $pilot = mysql_connect("localhost","user","pass");
    if (!$pilot)
     {
     die('Could not connect: ' . mysql_error());
     }mysql_select_db("cerulean_site", $pilot);
     $sql="INSERT INTO pilots (pilot_id, first_name, last_name, email, password, date_of_birth, personal_location, personal_country, activation_code, hire_date, public_msn, public_yim, public_aim, public_skype, public_icq, public_website, public_avatar, public_biography, public_sagtv, public_real_world_pilot, public_vatsim_controller, public_vatsim)
    VALUES
    ('$pilot_id','$first_name','$last_name','$email','$password','$dob','$personal_location','$personal_country','$activation_code','$hire_date','$public_msn','$public_yim','$public_aim','$public_skype','$public_icq','$public_website','$public_avatar','$public_biography','$public_sagtv','$public_real_world_pilot','$public_vatsim_controller','$public_vatsim')";
    
    if (!mysql_query($sql,$pilot))
     {
     die('Error: ' . mysql_error());
     }
    mysql_close($pilot)
    
    $hour = mysql_connect("localhost","user","pass");
    if (!$hour)
     {
     die('Could not connect: ' . mysql_error());
     }mysql_select_db("cerulean_site", $hour);
     $sql="INSERT INTO pilot_hour_transfer (pilot_id, transfer_airline, transfer_proof_link, transfer_hours_requested)
    VALUES
    ('$pilot_id','$transfer_airline','$transfer_proof_link','$transfer_hours_requested')";
    
    if (!mysql_query($sql,$hour))
     {
     die('Error: ' . mysql_error());
     }
    mysql_close($hour)
    
    ?>

     

    I get the following error:

     

    Parse error: parse error, unexpected T_VARIABLE on line 173

     

    Line 173 is:

     

    $hour = mysql_connect("localhost","user","pass");
    

     

    it works fine without the second mysql insert...

     

    Thanks in advance

  9. rcorlew, i do not want a loop, i want only the 1st record displayed

     

    Full Code:

     

    <?php
    $pilot_id = mysql_connect("localhost","username","password");
    if (!$pilot_id)
      {
      die('Could not connect: ' . mysql_error());
      }
      mysql_select_db("cerulean_site", $pilot_id);
      $result = mysql_query("SELECT * FROM pilots ORDER BY pilot_id DESC");
      
    $pilot_id = $row['pilot_id'];
    echo $pilot_id;
    

  10. so, i have this

     

    if (!$pilot_id)

      {

      die('Could not connect: ' . mysql_error());

      }

      mysql_select_db("cerulean_site", $pilot_id);

      $result = mysql_query("SELECT * FROM pilots ORDER BY pilot_id DESC");

     

      $row = mysql_fetch_array($result);

    $pilot_id=$row;

    echo $-pilot_id;

     

    and its displaying

     

    Array
  11. but this is giving me the same error:

     

    $pilot_id = mysql_connect("localhost","cerulean","bluesky1701");

    if (!$pilot_id)

      {

      die('Could not connect: ' . mysql_error());

      }

      mysql_select_db("cerulean_site", $pilot_id);

      $result = mysql_query("SELECT * FROM pilots ORDER BY pilot_id DESC");

     

    $pilot_id=$row_pilot_id['pilot_id'];

  12. so, i am trying to run the following code:

     

    $pilot_id = mysql_connect("localhost","cerulean","bluesky1701");

    if (!$pilot_id)

      {

      die('Could not connect: ' . mysql_error());

      }

      mysql_select_db("cerulean_site", $pilot_id);

      $result = mysql_query("SELECT * FROM pilots ORDER BY pilot_id DESC");

     

    $pilot_id=$row['pilot_id'];

     

    and its throwing a weird error about an undefined variable

     

    Notice: Undefined variable: row
×
×
  • 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.