Jump to content

fugix

Members
  • Posts

    1,483
  • Joined

  • Last visited

Posts posted by fugix

  1. just use a simple if else statement

    $sql1 = "select * from table_name";
    $query1 = mysql_query($sql1) or die(mysql_error());
    while($row = mysql_fetch_assoc($query1))  {
         if($_POST['date'] == $row['date'])  {
    
              $date = $_POST['date'];
              $sql = "insert into table_name values ('', '$firstname', '$lastname', '$date')";
              $query = mysql_query($sql) or die(mysql_error());
         } else  {
    
              echo "Date already Exists";
         }
    }

    will  need tweaked but thats just to give you an idea

  2. you need to remove the $ , try this

    <?php
    $content = "<html><head><title>Your IP</title></head><body>Your IP Address: 63.1.142.154</body></html>";
    preg_match('/<body>(.*?)<\/body>/s', $content, $matches);
    print_r( $matches );
    ?>

  3. thats a good idea. Im going to try that. Again thanks so much for all the help. You have no idea how much i appreciate it. If anything else and hopefully there wont be, I'll save it for tomorrow. I think I need to take a break than look at everything again because its all become one big mess of code to me. I'll talk to you later. Thanks

    good idea..sometimes its good to step away and come back later..if you ever need help with anything else il be here..

  4. its not a huge deal, however it is a good practice to get into to use an auto-incrementing primary key field...for neatness. I normally set a field called "id" as my primary key, and make it auto-incrementing as well

  5. I think it may be time to stop. Either that or I'm going to smash my computer. BAD PHOTO ID. I have no idea what else to do. First it was the header changed that than it's back to Bad photo id.

     

    yeah im getting rather frustrated myself...but i will leave you with this....the way that you got the photo id's for the photos so when you click on a photo it shows correctly, you want to use that exact same method on everything that will be either redirecting to that page, or submitting to that page, so that you do not lose your $_GET['photoid']; since you have a dynamic url in (image_show?id=), it is crucial that you maintain the correct id on the end of the url, so that you do not lose the ability to get that id via $_GET['photoid'], that is whats hapening here. when you redirect to the image_show page again after deleting your comment, you are losing that id...i would actually advise that you write your "delete comment" code on your image_show.php page. That way there is no need to redirect and you wont lose your photoid

  6. make it this

    <?php

    require('connect.php');

    mysql_select_db($database_con, $con);

     

    $query= mysql_query( "SELECT id FROM photo");

    $row_id = mysql_fetch_assoc($query);

    header("Location: image_show.php?id={$row_id['id']}");

     

    $deleteid=$_GET['id'];

    mysql_query("DELETE FROM comment WHERE id='$deleteid'") or die(mysql_error());

    ?>

  7. for these two lines

    $instrList=mysql_query("select distinct instructorId from classOfferings order by instructorId asc");
    $instrNameList=mysql_query("select fName, lName from instructors where classOfferings.instructorId = instructors.instructorId order by lName asc");
    

     

    use a join query to get the correct results..look here

  8. try this

    $result = mysql_query("SELECT filename FROM p_headerimages ORDER BY ordernum") or die(mysql_error());
    $newcount = count($result) +1;
    $query2 = "INSERT INTO `psitez_wrdp12`.`p_headerimages` (`filename`, `ordernum`) VALUES ('$file_name', '$newcount')";
    $result2= mysql_query($query2) or die(mysql_error());

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