Looking for php coder - small job.

Status
Not open for further replies.

vps9Ryan

Active Member
803
2010
26
10
Hello guys,


I currently have this (http://codecanyon.net/item/simple-website-comments/46483) script on dynamic pages of my site.

It gives the user 2 input fields, name and comment box.

Also it has gravatar support (as avatar).

What I need doing, is since we are running;

PHP:
(mysql_query('select id,username,password,email,avatar from users where username="'.$_SESSION['username'].'"'));

is that instead of user inputs his name, it can be gotten from that query and automatically inserted, and the avatar should also be imported from the mysql.

---------------

The script is one file.

If your interested let me know.

Cheers,
Ryan
 
10 comments
basically

assigning $avatar (which is from the db)

into the code of the comments script.

stuff like that :P
you already have select avatar in the query

Make sure you have the table for it too in mysql db

You need to use row['avatar'] to grab the details from db
 
it's difficult to help you without having a idea about your code and your DB, exposing them publicly is dangerous too, so pm a dev here and he should help you :)
 
I want to help you but I don't understand what you want of your post, can by my English not good.

Your mean is you want get avatar from db after use submit name? Same bellow

Code:
$username = mysql_real_escape_string($_POST['username']);
$avatar = "";
$q = mysql_query("SELECT id,username,password,email,avatar FROM users WHERE username='$username' LIMIT 1");
$t = mysql_num_rows($q);
if ($t == 1) {
    $r = mysql_fetch_array($q);
    $avatar = $r['avatar'];
}
 
Last edited:
Code:
        $SQL = mysql_query("SELECT * users WHERE Table='something'");
        echo mysql_error();

        while ($db_field = mysql_fetch_assoc($SQL)) {
        $name = $db_field['name'];
        $avatar = $db_field['avatar'];

        echo "$name $avatar";
I know this isnt exactly what you wanted but all im showing you is how to output information already in the table... So if you use those 2 functions in your insert table you should be able to get the name and avatar from the database..
 
Yes, it works like u say (theoretically) and even works on other scripts that way.

But it just doesnt want to work on this script XD

Its doing my head in


XD
 
If not then include a function where you can call the username and avatar from anywhere like a class.. then just add the function to the mysql code
 
Yes, it works like u say (theoretically) and even works on other scripts that way.

But it just doesnt want to work on this script XD

Its doing my head in


XD
When you say it is not working that doesn't help.

What is the error shown if any? Or what is the output shown if any?

And where is the code you added it to or at least that function?
 
Status
Not open for further replies.
Back
Top