Jump to content

Reload function help (mysql/php)


Kaboom

Recommended Posts

I had another thread about a problem I was having where it's not loading from the DB right aways. My solution is to make an update function and then have the id's calling it on the page. So the thing I am wondering is how to make a working update function. I have this so far:

 

<?php
include blah....

$uid = $_SESSION["user"][0];
$avatarid = $_SESSION["user"][12];

function update($str)
{
global $db_id;
$query="select ".$str." from users where id=".$uid;
$result=mysql_query($query, $db_id);
$row=mysql_fetch_row($result);
return $row[0];
}
?>

 

and then it's being called on the profile page with <?php echo update($avatarid); ?>. I want the update() function to select avatar from users where id = userid and then return the value fresh so it's getting it new from the database every time they refresh the page. Then there won't be a problem with updating old avatar stuff.

 

Currently gives me the error:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/root/public_html/func.php on line 69

 

So what am I doing wrong here? :( thanks for anyone who can help

Link to comment
Share on other sites

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.