Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/179751-run-a-query-based-on-user/
Share on other sites

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.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.