php help, see example :)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amateurcanada
    Confirmed User
    • Jul 2001
    • 3766

    #1

    php help, see example :)

    Ok, what i want to do is have the sql load the page based on the modnum entered in the php line (text.php?modnum=1) - ive tried alot of == lines and get errors, how would u simplify this to work :D thanks alot guys! :d




    /** SQL QUERY
    */
    if(!isset($modnum)){
    $sql = "SELECT id,up_date, up_modelname, up_age, up_from, up_description, up_moviename, up_length, up_buyvideo, up_modelset, keywords FROM $upTable WHERE LOWER(keywords) LIKE '%".$modnum."%' ORDER BY up_date DESC";
    }


    $result = mysql_query($sql, $db_link);

    be our partner - join nichepartners today
    will.assum.producer @ AmateurCanada.com / icq: 30146166 / facebook.com/will.assum / #amateurcanada
  • jonblaze9481
    Registered User
    • Jun 2003
    • 22

    #2
    Originally posted by amateurcanada
    Ok, what i want to do is have the sql load the page based on the modnum entered in the php line (text.php?modnum=1) - ive tried alot of == lines and get errors, how would u simplify this to work :D thanks alot guys! :d




    /** SQL QUERY
    */
    if(!isset($modnum)){
    $sql = "SELECT id,up_date, up_modelname, up_age, up_from, up_description, up_moviename, up_length, up_buyvideo, up_modelset, keywords FROM $upTable WHERE LOWER(keywords) LIKE '%".$modnum."%' ORDER BY up_date DESC";
    }


    $result = mysql_query($sql, $db_link);
    Ok, my PHP is a bit rusty but try this and see if it works....

    ----Code----
    if(isset($modnum))
    {
    if($modnum==1)
    {
    $sql = "SELECT id,up_date, up_modelname, up_age, up_from, up_description, up_moviename, up_length, up_buyvideo, up_modelset, keywords FROM $upTable WHERE LOWER(keywords) LIKE '%".$modnum."%' ORDER BY up_date DESC";
    }
    }
    Else
    {
    echo 'Variable Not Set';
    }

    ----Code----

    You should check to see if the variable $modnum has a value assigned to it. If so, then check to see if that value = 1. If it is, run the sql statement.

    Hope it helps.

    Blaze

    Comment

    • chonis
      Confirmed User
      • Oct 2005
      • 143

      #3
      Originally posted by amateurcanada
      Ok, what i want to do is have the sql load the page based on the modnum entered in the php line (text.php?modnum=1) - ive tried alot of == lines and get errors, how would u simplify this to work :D thanks alot guys! :d




      /** SQL QUERY
      */
      if(!isset($modnum)){
      $sql = "SELECT id,up_date, up_modelname, up_age, up_from, up_description, up_moviename, up_length, up_buyvideo, up_modelset, keywords FROM $upTable WHERE LOWER(keywords) LIKE '%".$modnum."%' ORDER BY up_date DESC";
      }


      $result = mysql_query($sql, $db_link);
      Replace $modnum for $_GET['modnum'], I think that is your problem.
      Exclusive Content From Argentina
      ICQ - 272-213-644

      Comment

      • pornlounge
        Registered User
        • Dec 2006
        • 6

        #4
        consider the hint with the $_GET

        also try [...] FROM ".$upTable." WHERE [...]

        should work
        Pornlounge - Daily Porn Blog

        You have got a porn blog? Let's exchange links!

        Comment

        • amateurcanada
          Confirmed User
          • Jul 2001
          • 3766

          #5
          Originally posted by chonis
          Replace $modnum for $_GET['modnum'], I think that is your problem.
          Hi there and thanks for the help, actually the variable itself is fine.. I am trying to load up the value within the program to display the model itself with the field ID

          so modnum=1 would local database field with ID 1

          $sql = "SELECT id, up_date, up_modelname, up_age, up_from, up_description, up_moviename, up_length, up_buyvideo, up_modelset, keywords FROM $upTable WHERE $modname=id ORDER BY up_date DESC";

          now this would be the logical way, where modname=id but it doesnt load the value, just pulls the blank screen on me

          be our partner - join nichepartners today
          will.assum.producer @ AmateurCanada.com / icq: 30146166 / facebook.com/will.assum / #amateurcanada

          Comment

          • bl4h
            Confirmed User
            • Jul 2006
            • 1282

            #6
            well youre not showing us your code to read the result from mysql or anything. That may be where your problem is. ALso in your first example you use !isset, which means IF ITS NOT SET


            the correct way is to use $_GET. Yes, for now it works otherwise, but its the correct way nor is it safe to use variables like that.


            Also, dont you mean: id=$modname ? try putting id='$modname' (with the comas)

            Comment

            • Bro Media - BANNED FOR LIFE
              MOBILE PORN: IMOBILEPORN
              • Jan 2004
              • 16502

              #7
              WHERE id = '" . $modnum . "' LIMIT 1

              Comment

              • amateurcanada
                Confirmed User
                • Jul 2001
                • 3766

                #8
                Here is all the code, I hacked job a multipage tour file to attempt this...

                [QUOTE=bl4h;11583990]well youre not showing us your code to read the result from mysql or anything[QUOTE]









                ================================================== ======
                <?
                /** DATABASE CONNECTION
                */
                $DBHOST = "localhost";
                $DBLOGIN = "#####";
                $DBPASSWORD = "#####";
                $DB = "#####";

                $memTable = "models";

                $db_link = mysql_connect($DBHOST, $DBLOGIN, $DBPASSWORD);
                if(!mysql_select_db($DB, $db_link)) {
                echo "Unable to connect to the database server at this time.";
                exit();
                }

                //SQL Query Selected depending if ?modname=MODELNAME is set in URL
                if(isset($modname))
                {
                if($modname==1)
                {
                $sql = "SELECT id, up_date, up_modelname, up_age, up_from, up_description, up_moviename, up_length, up_buyvideo, up_modelset, keywords FROM $upTable WHERE id='$modname' LIMIT 1 ORDER BY up_date DESC";
                }
                }
                else
                {
                echo '<CENTER><BR><BR><BR><B>Model not selected. Please try again...</B><BR><BR><BR></CENTER>';
                }

                echo $modname;
                $result = mysql_query( $sql, $db_link );

                /** NAVIGATION
                */
                $perPage = 1; //set number of models per page to display

                //Evaluate current position of user
                if (!isset($srtCount) || $srtCount<=0){
                $srtCount = 1;
                }
                $num_rows = mysql_num_rows($result); //get number of rows in db

                $nextCount=$srtCount+$perPage;
                $prevCount=$srtCount-$perPage;

                /** BASIC LISTING
                */

                //Iterate through selections using $srtCount
                $count=0;
                while($count<$srtCount){
                $rowarray = @mysql_fetch_row($result);
                $count++;
                }

                $i=0;
                while ($i<$perPage && $rowarray!=FALSE) {
                $sid = $rowarray[0];
                $modelname = $rowarray[1];
                $previewname = $rowarray[2];
                $age = $rowarray[3];
                $location = $rowarray[4];
                $sexuality = $rowarray[5];
                $maritalstatus = $rowarray[6];
                $mycomments = $rowarray[7];
                $producerscomments = $rowarray[8];
                $turnons = $rowarray[9];
                $hobbiesfun = $rowarray[10];
                $sexual = $rowarray[11];
                $height = $rowarray[12];
                $weight = $rowarray[13];
                $busty = $rowarray[14];
                $food = $rowarray[15];
                $photoset1 = $rowarray[16];
                $photoset2 = $rowarray[17];
                $photoset3 = $rowarray[18];
                $photoset4 = $rowarray[19];
                $photoset5 = $rowarray[20];
                $photodir = $rowarray[21];
                $videoloc = $rowarray[22];
                $dvd1 = $rowarray[23];
                $dvd2 = $rowarray[24];
                $dvd3 = $rowarray[25];
                $dvd4 = $rowarray[26];
                $dvd5 = $rowarray[27];
                $dvd6 = $rowarray[28];
                $dvd7 = $rowarray[29];
                $dvd8 = $rowarray[30];
                $dvd9 = $rowarray[31];
                $dvd10 = $rowarray[32];
                ?>


                <!-- TEMPLATE -->
                where the output info goes<BR>
                <? echo $modelname; ?>
                <!-- END TEMPLATE -->


                <?php
                $i++;
                $rowarray = @mysql_fetch_row($result);
                }//end while


                @mysql_close($db_link);
                ?>
                ================================================== ======





                Sorry to bug you guys with this

                be our partner - join nichepartners today
                will.assum.producer @ AmateurCanada.com / icq: 30146166 / facebook.com/will.assum / #amateurcanada

                Comment

                Working...