php_nooby82 Posted October 31, 2009 Share Posted October 31, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/179751-run-a-query-based-on-user/ Share on other sites More sharing options...
trq Posted November 1, 2009 Share Posted November 1, 2009 If your programmer used Zend_Auth to login your users you will also need to do it that way. Take a look here. Quote Link to comment https://forums.phpfreaks.com/topic/179751-run-a-query-based-on-user/#findComment-948514 Share on other sites More sharing options...
php_nooby82 Posted November 1, 2009 Author Share Posted November 1, 2009 That is what he used. Thank you. : Quote Link to comment https://forums.phpfreaks.com/topic/179751-run-a-query-based-on-user/#findComment-948635 Share on other sites More sharing options...
trq Posted November 1, 2009 Share Posted November 1, 2009 Then you will need to take a look at the documentation. Find where he logged the users in and what data is persisted, from here you can can access to this information and use it within your query. Quote Link to comment https://forums.phpfreaks.com/topic/179751-run-a-query-based-on-user/#findComment-948648 Share on other sites More sharing options...
php_nooby82 Posted November 1, 2009 Author Share Posted November 1, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/179751-run-a-query-based-on-user/#findComment-948650 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.