Jump to content

php_nooby82

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Everything posted by php_nooby82

  1. Oh right, because I didn't realize I needed it. I had exactly what I showed and said I was using Zend. Told you it was a Zend model I was using. I am sorry, I assume to many things. I didn't mean to think you were a mind reader and just assumed you knew what I was talking about. I should have been a little more specific, but there was no Zend code before until I realized it was needed so I did not leave this out before. I showed you exactly what I had, which was obviously wrong. By the way, the code I showed you last (before the solution) was correct, it just was missing the php stuff. Thanks.
  2. Well, as I said before, I am very new to Zend so I am not sure but isn't this part of the code Zend specific? $authNamespace = new Zend_Session_Namespace('Zend_Auth'); Thanks again for all your help.
  3. I did it! For those who ever run into this problem, first I closed the php to soon. It should be after the url and the url should be echoed. Next, all the parts that were not code needed to be in quotation marks. I also removed the php part from the <p> (don't know if that was apart of the problem) and it worked! Thanks for all your help Thorpe! Here is finally code: <?php $dmp = new Default_Model_People(); ?> <p> Some stuff</p> <?php $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $result = $dmp->profile_data($authNamespace->uid); echo "<a href=/liarea/".$result["username"].">www.randomsite.com/profile/".$result["username"]."</a>"; ?> Keep in mind this is Zend so for those who is trying to do this in a different framework or just with php and mysql alone remember to use Session or whatever Session that works with your framework. Thanks again and tata for now!
  4. Well, then this code does not like me. What it does is shows the actually .$request as the link.
  5. Yes! That is what it does, well accept it being a number it is a username. The thing is, however, I have '/liarea/' already there and I need code to add the 13. Something like: $result = dmp->profile_data('username') <a href='/liarea/.$result['username'].'>www.randomesite.com/liarea/.$result['username']</a> Is this possible or would the enitre link need to be in the database for this to work? Thanks so much!
  6. Well, what I am trying to say is that it doesn't matter what it is. It could be any model and anything from the database. I just need to know how to add something from the database at the end of a hyperlink. I have seen it done with hyperlinks that do not use "/" like php?id= etc...but in my case I just want to know the code on how to add a field from the database to the end of a hyperlink. Is that more clear? If not then dmp is Default_Model_People and profile data is a function in that model that gets the id of the user from the People's table in the database. I've used the code I gave to retrieve information on the user for other things so I know it works fine, but like I said above, my problem is trying to get it to work in a hyperlink. I thought all I would need to do was concatenate the two, but since I have it in those semi-quotes it is just being read instead of the action being taken. Thanks again!
  7. Hi, What I am trying to do may be simple, I just can't get it to work. Ok... I am using Zend and so the database connect that I need for this is a simple call to it like data->profile_name('username'). Ok, now to my question...I am trying to add a hyperlink to the login area of my website so that it will show the logged in user's personal profile page. Example: www.randomsite.com/liarea/username Where it says username I am trying add code there to show the username of the user that is logged in. I have tried lots of things and nothing works. Here is the latest thing I have tried: <a href='/liarea/<?php echo $dmp->profile_data('username'); ?>'>www.randomsite.com</a> The randomsite is fictitious so sorry if it leads to something weird. Thanks for any help!
  8. Sorry, I thought this was an area just for Zend. This is the Zend Framework.
  9. Ok, here is the code, then I'll tell you what I am trying to do: Model People: public function create_by_array($data) { $profile = $this->profile_data($this->insert($data)); $dmc = new Default_Model_Cycle(); $dmt = new Default_Model_Tree(); $cid = $dmc->start_cycle($profile["id"], 1); $icycle = $dmc->get_newest_cycle($profile["inviter"]); $dmt->add_to_next_open_slot($icycle["id"], $cid); } Model Cycles: (I changed this one to just pid and made a new one for aid since I don't want it doing this both times, but that didn't work either) public function start_cycle($pid, $aid) { $data = array( 'pid' => $pid, 'aid' => $aid, ); $cid = $this->insert($data); $dmt = new Default_Model_Tree(); $dmt->create_tree($pid, $cid); return $cid; } Model Gift: public function count_gifts_in_cycle($cid) { $results = $this->fetchAll($this ->select() ->where('cid_from = ?', $cid) ->where('received_date is not ?', new Zend_Db_Expr('NULL'))); return sizeof($results); } ------------------------------ Ok, using the count_gifts_in_cycle function I am trying to put an if statement in the create_by_array function that will change the 1 in $cid = $dmc->start_cycle($profile["id"], 1); Here is what I tried (and I tried several other things) but I keep getting an error. If ($no_gifts == 1) { $cid = $dmc->start_cycle($profile["id"], ; } else { $cid = $dmc->start_cycle($profile["id"], 1); } I declared no_gifts and added dmg = Default_Model_Gift but it will not work. I think it is because $cid is declared for something else, but I tried changing it to $nid and made everything the same, but that didn't work either. Hopefully someone can see what I am doing wrong? Or tell me a better way of doing it. Oh, and I just found a function that uses the start_cycle too, so maybe I should change both for it to work? Not sure, but here is the code for that: Model People: public function create($u,$p) { $data = array( "username" => $u, "pass" => $p ); $pid = $this->insert($data); $dmc = new Default_Model_Cycle(); $dmc->start_cycle($pid, 1); } Thanks for any help!
  10. Ok, thanks. That may take a while, I'm looking through it now. The users login this way: $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace->uid = $acct['id']; return $this->_helper->redirector('my', ''); So, I need to include $authNamespace = new Zend_Session_Namespace('Zend_Auth'); in the action of the controller and that is as far as I've gotten. I am reading on how to manipulate this information to use. By the way, where it says $acct['id'] , that is what the '2' in the above code will be replaced with somehow.
  11. That is what he used. Thank you. :
  12. Don't know if I should put this here or in php code area, but I am in a delima. A programmer programmed my site for me using Zend Framework, but he was unable to finish and it is sooo close to being complete. I learned a little about how Zend Framework works, but not enough to program in it completely. Since this site is nearly done and its hard to find people at the last minute to program it at a decent price, I've decide to finish it myself, but just using basic php and mysql. So here is some code and then my question will follow: <?php $con = mysql_connect("localhost","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); $result = mysql_query("SELECT inviter FROM people where inviter= '2'"); echo "<table border='1'> <tr> <th>Firstname</th> <th>Lastname</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['inviter'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Where it says inviter= '2' how can I change this to show the specific user that is logged in's number? If it is easy to do this in Zend please show me that way, if not, basic php or sql will do. I tested code in the back office and it works great. Just need it to be user specific now. Thanks in advance for any help! php_nooby
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.