22, November 2008

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

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ 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 1186 times)
OMG!I am geek
**
Posts: 57
394 credits
Members referred : 0


« on: May 16, 2007, 05: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, 08: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: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: May 16, 2007, 11: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


Last blog : Just a better Internet portal provided by Google
OMG!I am geek
**
Posts: 57
394 credits
Members referred : 0


« Reply #3 on: May 17, 2007, 12:14:18 PM »

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


It's time to use PHP5!


« Reply #4 on: May 17, 2007, 12:20:10 PM »

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


Last blog : Just a better Internet portal provided by Google
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: May 17, 2007, 12:20:29 PM »

and don't mess with the class files!


Last blog : Just a better Internet portal provided by Google
OMG!I am geek
**
Posts: 57
394 credits
Members referred : 0


« Reply #6 on: May 17, 2007, 01: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, 01: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....

Topic sponsors:
Get a permanent link here for $1.99!


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?
Nov 22, 2008, 04:03:13 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!


Forum Statistics
Total Posts: 37.736
Total Topics: 7.650
Total Members: 4.397
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: Janai

37 Guests, 4 Users online :

11 users online today:



Readers

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