SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help viewing a variable $_GET['id']

    Can someone tell me an easy way that I could see the value that is being returned from . intval($_GET['id']) . I am not sure my MySQL query is returning the correct value. I've bolded the places where it is used.

    Also, can someone explain the use of //echo before the final URL.

    Thanks.

    Code:
    <?php
    require_once('include/config.php');
    
    // include classes and initiate new classes
    require_once('include/class_template.php');
    require_once('include/class_database.php');
    
    $db = new database();
    
    // update views
    mysql_query("UPDATE videos SET views = views + 1, last_ip = '" . $_SERVER['REMOTE_ADDR'] . "', last_view = '" . time() . "' WHERE identifier = '". intval($_GET['id']) . "' AND site_id = 1 AND (last_ip != '" . $_SERVER['REMOTE_ADDR'] . "' OR last_view < '" . (time() - 10) . "')") or die(mysql_error());
    
    
    $uid = 1516004866;
    $uid = 1850294476;
    $uid = rand (1850294475, 1850294500);
    
    //echo 'http://today.launch.yahoo.com/player/medialog.asp?vid='.intval($_GET['id']).'&bw=310&mf=1&pid=621&ps=27&p1=2&p2=58&p3=1&rpid=35&pv=11&bp=Windows%2520NT&csid=396501336&uid=1434300406&pguid=yWH6ZkBGLeClaQase_p1pw&etid=0&uguid=4o7smuh2ctl7s&fcv=9&mh=e7d80ebaedd527ec9e421633762a7433||1164418835640&z=ms.asx';
    ?>

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $sql = "update blah.....";

    echo $sql;

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Understood, just assign the update to a variable and echo the variable.

    However, I am really new at this and the file in which this code is in is called 'play.php'

    How do I run play.php to see the result of my echo?

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use your browser.
    something like one of the following urls
    http://example.com/play.php
    http://example.com/some_dir/play.php

    or if youre running php locally on your computer
    http://localhost/play.php

    btw, // comments out a line of php code. everything to the right of // on the same line will not be executed.

  5. #5
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks clamcrusher--that's what I thought but sometimes the commented out lines are blue and sometimes not--I thought there was a difference


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •