Re: resource id#2 - ????

From: Date: Wed, 12 Jun 2002 17:53:00 +0000
Subject: Re: resource id#2 - ????
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-19759@lists.php.net to get a copy of this message
At 11:42 -0600 6/12/02, Jas wrote:
Not sure how to over come this, the result of a database query keeps giving me this: <?php /* Get Ip address, where they came from, and stamp the time */ if (getenv(HTTP_X_FORWARDED_FOR)){
    $ipaddy = getenv(HTTP_X_FORWARDED_FOR);
} else {
    $ipaddy = getenv(REMOTE_ADDR); }
$referrer = $HTTP_REFERER; $date_stamp = date("Y-m-d H:i:s"); /* Start session, and check registered variables */ session_start(); if (isset($HTTP_SESSION_VARS['ipaddy']) || isset($HTTP_SESSION_VARS['referrer']) || isset($HTTP_SESSION_VARS['date_stamp'])) { $main = "Video clips stored in Database"; /* Insert client info to database table */ require('/path/to/connection/class/con.inc');
      $table_sessions = "dev_sessions";
      $sql_insert = "INSERT INTO $table_sessions
(ipaddy,referrer,date_stamp) VALUES ('$ipaddy','$referrer','$date_stamp')";
      $result = @mysql_query($sql_insert,$dbh) or die("Couldn't execute
insert to database!"); /* Pull video info from database table into an array */ $table_content = "dev_videos"; $sql_content = @mysql_query("SELECT * FROM $table_content",$dbh);
     while ($row = @mysql_fetch_array($record)) {
$record isn't defined anywhere. Do you mean $sql_content?
        $id = $row['id'];
        $file_name = $row['file_name'];
        $file_size = $row['file_size'];
        $file_properties = $row['file_properties'];
        $file_codec = $row['file_codec'];
        $file_author = $row['file_author'];
     $result = @mysql_query($sql_content,$dbh) or die("Couldn't execute
query on database!"); /* loop through records and print results of array into table */
      $current .=
"<tr><td>$id</td><td>$file_name</td><td>$file_size</td><td>$file_properties< /td><td>$file_codec</td><td>$file_author</td></tr>"; } } else { /* Start a new session and register variables */ session_start(); session_register('ipaddy'); session_register('referrer'); session_register('date_stamp'); } ?> Just to make sure everything is working correctly I have echoed every statement to the screen so I may see what's going on like so: <?php echo $main; ?> <table width="75%" border="1"> <?php echo $current; ?> // my results should be here but instead I get Resource ID #2 printed???? wtf? </table><br> <?php echo $ipaddy; ?><br> <?php echo $referrer; ?><br> <?php echo $date_stamp; ?><br> <?php echo $sql_insert; ?><br> <?php echo $sql_content; ?><br> <?php echo $id; ?><br> <?php echo $file_name; ?><br> <?php echo $file_size; ?><br> Any help would be great! Jas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.db (#19759) next »