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
https://forums.phpfreaks.com/topic/221882-reload-function-help-mysqlphp/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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