The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
View As User
#11
So I'm guessing you're doing something like
Code:
$uid = Input::get('id');

Now you have to run a query on that.

Code:
$theUserQ = $db->query("SELECT * FROM users WHERE id = ?",array($uid));
Code:
$theUser = $theUserQ->first();

Now you can echo out
Code:
$theUser->fname
to get the first name etc.
  Reply
#12
And I'm having one more issue....currently, all of my pages that have direct scripts in them are using the following script for
Code:
$uid
capture:
<pre>
Code:
if(isset($_GET['uid']))
    {
        if(checkMenu(2,$user->data()->id))
        {
            $uid = $_GET['uid'];
        }
        else
        {
            $uid = $user->data()->id;
        }
    }
if (empty($_GET['uid']))
    {
    $uid = $user->data()->id;
    }
</pre>


However, a page has to perform a function the
Code:
$uid
is not passed along.

For example, on
Code:
functions.php
, there is two div's, one for
Code:
alerts
and one for
Code:
stats
. These divs are powered by the following JS:
<pre>
Code:
function autoRefresh_div() {
    $("#stats").load("/eldis/master/usersc/includes/stats.php");
    $("#alerts").load("/eldis/master/usersc/includes/alerts.php");
}
setInterval(autoRefresh_div, 1000); // every 5 seconds
autoRefresh_div(); // on load
</pre>


However, I run into the issue of the fact that when I am running these two URLs, I cannot push the
Code:
$uid
value. I was thinking that I could do something with the divs to enter the
Code:
$uid
which the
Code:
functions.php
figures out (based on the script above) but how do I pass this on to the JS? Once it's at the JS it'll be fine, but my issue is getting it to the JS.

Any help would be great!
  Reply
#13
I'm terrible at JavaScript. I think you might have better luck pasting that function on stack overflow. I'll bet someone will answer it within a few hours.

Tell them all how great userspice is. Free advertising while you're at it Smile
  Reply
#14
Mudmin,

Hopefully I will get someone good that won't yell at me about "situation specific" questions. Sometimes you get AMAZING people and sometimes you get really crappy people Sad I will post it there!

Thanks!
  Reply
#15
This was much easier than I thought it would be.


FYI, to pass PHP variables to Javascript, just add something such as the following:
Code:
var uid = "<?php echo $uid ?>";

to the top of your JavaScript, and modify the links your JavaScript pushes to.
  Reply
#16
I've seen that. I think as long as you state that you know the $uid, that takes userspice out of the equation...so not knowing why the variable isn't passing seems straightforward enough.
  Reply
#17
Oh. Nice. I really need to step up my js game.
  Reply
#18
That's okay, because I know crap about JS and CSS. I really only am good with PHP and mySQL. Give me a PDO and I'm fried lol. I'm still trying to learn PDO.
  Reply
#19
Well, userspice makes the whole PDO thing a lot easier. I'm sure there are more advanced things you need to know, but you can do 99{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d} of what you ever need to do by knowing the basic

$db, query, insert, delete, update that US has.
  Reply
#20
Well, userspice makes the whole PDO thing a lot easier. I'm sure there are more advanced things you need to know, but you can do 99{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d} of what you ever need to do by knowing the basic

$db, query, insert, delete, update that US has.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)