28, May 2012

what does this line of ext_user_profile.php? - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: what does this line of ext_user_profile.php?
« previous next »
Pages: [1] Print

Author Topic: what does this line of ext_user_profile.php?  (Read 2513 times)
OMG!I am geek
**
Posts: 57
394 credits
Members referred : 0


« on: May 16, 2007, 04:59:15 pm »

$this->profile_id = (empty($_SESSION['is_rec'])) ? mysql_insert_id() : $ident; 

Coult you explain  detaily  what this line does?

thanks,
tom
OMG!I am geek
**
Posts: 57
394 credits
Members referred : 0


« Reply #1 on: May 16, 2007, 07:34:28 pm »

ok, it must be the same as:
x <x1 ? y : z
and it's the same as
if (x < x1 )
y
else
z

:-)

Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: May 16, 2007, 10:49:58 pm »

$this->profile_id = (empty($_SESSION['is_rec'])) ? mysql_insert_id() : $ident; 

Coult you explain  detaily  what this line does?

thanks,
tom

thats short for if then else

OMG!I am geek
**
Posts: 57
394 credits
Members referred : 0


« Reply #3 on: May 17, 2007, 11:14:18 am »

ok, and what for a new iprofile_id needs to be set?
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #4 on: May 17, 2007, 11:20:10 am »

ok, and what for a new iprofile_id needs to be set?

sorry Tom, I can't follow you, please provide clear questions and code examples here

Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: May 17, 2007, 11:20:29 am »

and don't mess with the class files!

OMG!I am geek
**
Posts: 57
394 credits
Members referred : 0


« Reply #6 on: May 17, 2007, 12:50:14 pm »

sorry Tom, I can't follow you, please provide clear questions and code examples here
I would like to understand the concept of how the user and the user row is identified. It seems to me that all this vars (id, users_id, session id, ident) are responsible for that but I have'nt got it until now.

Here is some code:
   function save_profile_date($ident = "", $lang = "", ...) {

      if (!empty($ident)) {

         $sql = sprintf("UPDATE ...  $this->ins_string($ident, "int"), $_SESSION['user_id']);

      } else {

         $sql = sprintf("INSERT INTO %s (id, users_id, language, ..., NOW())",

            ..., $_SESSION['user_id'], $this->ins_string($lang), ...));

      }

      if (mysql_query($sql) or die (mysql_error())) {

         $this->profile_id = (empty($_SESSION['is_rec'])) ? mysql_insert_id() : $ident;

...

      }

   }

   function get_profile_data() {

      $this->get_user_info();

      $sql = sprintf("SELECT id, language, ... FROM %s WHERE users_id = %d", ... PROFILE_TABLE, $this->id);

      $result = mysql_query($sql) or die (mysql_error());

      if (mysql_num_rows($result) == 0) {

         $this->the_msg = $this->extra_text(1);

         return false;

      } else {

         $_SESSION['is_rec'] = true;

         while ($obj = mysql_fetch_object($result)) {

            $this->profile_id = $obj->id;

The var $ident seems to decide if an update or an insert record is processed, right?

But how is the user and the responsible table row identified?
« Last Edit: May 17, 2007, 12:58:33 pm by tomz »
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6576
Tags : $_SESSION['is_rec'] Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: what does this line of ext_user_profile.php?
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 10:32:58 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.