Skip to main content
added 44 characters in body
Source Link
Brandon
  • 88
  • 1
  • 7

Ok this is building on what I was previously working on in my last post:

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

So in this situation, I have to reference customer_id from a different table than the rest of this. How would I go about pointing just that one field that is located in this other table (rsticketspro_tickets)

Or am I going about this in the completely wrong way? I'm trying to place this code to pull an address from a users profile on a "View Ticket" screen. So the customer_id is what is referenced on that page I believe, so maybe its already a variable?

NEW CODE

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='rsticketspro_tickets.customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

NEW NEW CODE

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->qn('a.profile_value'))
  ->from($db->qn('#__user_profiles'), 'a')
  ->join('INNER', $db->quoteName('#__rsticketspro_tickets', 'b') . ' ON (' . $db->qn('a.user_id') . " = " . $db->q(b.customer_id) . ')')
->where($db->qn('a.profile_key') . " = " . $db->q('b.address1'));
$db->setQuery($query);
$result = $db->loadResult();

This might help, but I cant seem to see whats wrong in everything at the moment still.

TABLE: #__user_profiles

COLUMNS: user_id, profile_key, profile_value

PROFILE_KEY VALUE: profile.address1

TABLE: #__rsticketspro_tickets

COLUMNS: customer_id

Ok this is building on what I was previously working on in my last post:

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

So in this situation, I have to reference customer_id from a different table than the rest of this. How would I go about pointing just that one field that is located in this other table (rsticketspro_tickets)

Or am I going about this in the completely wrong way? I'm trying to place this code to pull an address from a users profile on a "View Ticket" screen. So the customer_id is what is referenced on that page I believe, so maybe its already a variable?

NEW CODE

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='rsticketspro_tickets.customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

NEW NEW CODE

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->qn('a.profile_value'))
  ->from($db->qn('#__user_profiles'), 'a')
  ->join('INNER', $db->quoteName('#__rsticketspro_tickets', 'b') . ' ON (' . $db->qn('a.user_id') . " = " . $db->q(b.customer_id) . ')')
->where($db->qn('a.profile_key') . " = " . $db->q('b.address1'));
$db->setQuery($query);
$result = $db->loadResult();

This might help, but I cant seem to see whats wrong in everything at the moment still.

TABLE: #__user_profiles

COLUMNS: user_id, profile_key, profile_value

TABLE: #__rsticketspro_tickets

COLUMNS: customer_id

Ok this is building on what I was previously working on in my last post:

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

So in this situation, I have to reference customer_id from a different table than the rest of this. How would I go about pointing just that one field that is located in this other table (rsticketspro_tickets)

Or am I going about this in the completely wrong way? I'm trying to place this code to pull an address from a users profile on a "View Ticket" screen. So the customer_id is what is referenced on that page I believe, so maybe its already a variable?

NEW CODE

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='rsticketspro_tickets.customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

NEW NEW CODE

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->qn('a.profile_value'))
  ->from($db->qn('#__user_profiles'), 'a')
  ->join('INNER', $db->quoteName('#__rsticketspro_tickets', 'b') . ' ON (' . $db->qn('a.user_id') . " = " . $db->q(b.customer_id) . ')')
->where($db->qn('a.profile_key') . " = " . $db->q('b.address1'));
$db->setQuery($query);
$result = $db->loadResult();

This might help, but I cant seem to see whats wrong in everything at the moment still.

TABLE: #__user_profiles

COLUMNS: user_id, profile_key, profile_value

PROFILE_KEY VALUE: profile.address1

TABLE: #__rsticketspro_tickets

COLUMNS: customer_id

added 266 characters in body
Source Link
Brandon
  • 88
  • 1
  • 7

Ok this is building on what I was previously working on in my last post:

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

So in this situation, I have to reference customer_id from a different table than the rest of this. How would I go about pointing just that one field that is located in this other table (rsticketspro_tickets)

Or am I going about this in the completely wrong way? I'm trying to place this code to pull an address from a users profile on a "View Ticket" screen. So the customer_id is what is referenced on that page I believe, so maybe its already a variable?

NEW CODE

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='rsticketspro_tickets.customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

NEW NEW CODE

<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);
 
$query->select($db->qn(`a'a.profile_value`profile_value'))
  ->
from>from($db->qn('#__user_profiles'), 'a')
  ->
join>join('INNER', $db->quoteName('#__rsticketspro_tickets', 'b') . ' 
 ON (' . $db->qn(`a'a.user_id`user_id') . " = " . $db->q(b.customer_id) . ')') ->
where->where($db->qn(`a'a.profile_key`profile_key') . " = " . $db->q(b'b.address1address1'));
 
$db->setQuery($query);
 
$result = $db->loadResult();
?>

This might help, but I cant seem to see whats wrong in everything at the moment still.

TABLE: #__user_profiles

COLUMNS: user_id, profile_key, profile_value

TABLE: #__rsticketspro_tickets

COLUMNS: customer_id

Ok this is building on what I was previously working on in my last post:

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

So in this situation, I have to reference customer_id from a different table than the rest of this. How would I go about pointing just that one field that is located in this other table (rsticketspro_tickets)

Or am I going about this in the completely wrong way? I'm trying to place this code to pull an address from a users profile on a "View Ticket" screen. So the customer_id is what is referenced on that page I believe, so maybe its already a variable?

NEW CODE

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='rsticketspro_tickets.customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

NEW NEW CODE

<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);
 
$query->select($db->qn(`a.profile_value`)) ->
from($db->qn('#__user_profiles'), 'a') ->
join('INNER', $db->quoteName('#__rsticketspro_tickets', 'b') . ' 
 ON (' . $db->qn(`a.user_id`) . " = " . $db->q(b.customer_id) . ')') ->
where($db->qn(`a.profile_key`) . " = " . $db->q(b.address1));
 
$db->setQuery($query);
 
$result = $db->loadResult();
?>

Ok this is building on what I was previously working on in my last post:

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

So in this situation, I have to reference customer_id from a different table than the rest of this. How would I go about pointing just that one field that is located in this other table (rsticketspro_tickets)

Or am I going about this in the completely wrong way? I'm trying to place this code to pull an address from a users profile on a "View Ticket" screen. So the customer_id is what is referenced on that page I believe, so maybe its already a variable?

NEW CODE

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='rsticketspro_tickets.customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

NEW NEW CODE

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->qn('a.profile_value'))
  ->from($db->qn('#__user_profiles'), 'a')
  ->join('INNER', $db->quoteName('#__rsticketspro_tickets', 'b') . ' ON (' . $db->qn('a.user_id') . " = " . $db->q(b.customer_id) . ')')
->where($db->qn('a.profile_key') . " = " . $db->q('b.address1'));
$db->setQuery($query);
$result = $db->loadResult();

This might help, but I cant seem to see whats wrong in everything at the moment still.

TABLE: #__user_profiles

COLUMNS: user_id, profile_key, profile_value

TABLE: #__rsticketspro_tickets

COLUMNS: customer_id

added 1 character in body; added 4 characters in body
Source Link
Brandon
  • 88
  • 1
  • 7

Ok this is building on what I was previously working on in my last post:

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

So in this situation, I have to reference customer_id from a different table than the rest of this. How would I go about pointing just that one field that is located in this other table (rsticketspro_tickets)

Or am I going about this in the completely wrong way? I'm trying to place this code to pull an address from a users profile on a "View Ticket" screen. So the customer_id is what is referenced on that page I believe, so maybe its already a variable?

NEW CODE

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='rsticketspro_tickets.customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

NEW NEW CODE

<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);

$query->select($db->qn(`a.profile_value`)) ->
from($db->qn('#__user_profiles'), 'a') ->join>
join('INNER', $db->quoteName('#__rsticketspro_tickets', 'b') . ' 
ON (' . $db->qn(`a.user_id`) . " = " . $db->q(b.customer_id) . ')') ->
where($db->qn(`a.profile_key`) . " = " . $db->q(b.address1));

$db->setQuery($query);

$result = $db->loadResult();
?>

Ok this is building on what I was previously working on in my last post:

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

So in this situation, I have to reference customer_id from a different table than the rest of this. How would I go about pointing just that one field that is located in this other table (rsticketspro_tickets)

Or am I going about this in the completely wrong way? I'm trying to place this code to pull an address from a users profile on a "View Ticket" screen. So the customer_id is what is referenced on that page I believe, so maybe its already a variable?

NEW CODE

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='rsticketspro_tickets.customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

NEW NEW CODE

<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);

$query->select($db->qn(`a.profile_value`)) ->
from($db->qn('#__user_profiles'), 'a') ->join('INNER', $db->quoteName('#__rsticketspro_tickets', 'b') . ' 
ON (' . $db->qn(`a.user_id`) . " = " . $db->q(b.customer_id) . ')') ->
where($db->qn(`a.profile_key`) . " = " . $db->q(b.address1));

$db->setQuery($query);

$result = $db->loadResult();
?>

Ok this is building on what I was previously working on in my last post:

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

So in this situation, I have to reference customer_id from a different table than the rest of this. How would I go about pointing just that one field that is located in this other table (rsticketspro_tickets)

Or am I going about this in the completely wrong way? I'm trying to place this code to pull an address from a users profile on a "View Ticket" screen. So the customer_id is what is referenced on that page I believe, so maybe its already a variable?

NEW CODE

<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT `profile_value` FROM #__user_profiles WHERE `user_id`='rsticketspro_tickets.customer_id' AND `profile_key`='profile.address1'");
$result = $db->loadResult();
echo $db->loadResult();
?>

NEW NEW CODE

<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);

$query->select($db->qn(`a.profile_value`)) ->
from($db->qn('#__user_profiles'), 'a') ->
join('INNER', $db->quoteName('#__rsticketspro_tickets', 'b') . ' 
ON (' . $db->qn(`a.user_id`) . " = " . $db->q(b.customer_id) . ')') ->
where($db->qn(`a.profile_key`) . " = " . $db->q(b.address1));

$db->setQuery($query);

$result = $db->loadResult();
?>
added 477 characters in body
Source Link
Brandon
  • 88
  • 1
  • 7
Loading
Added new iteration of code.
Source Link
Brandon
  • 88
  • 1
  • 7
Loading
Source Link
Brandon
  • 88
  • 1
  • 7
Loading