Jump to content

[SOLVED] User Profiles


DeanWhitehouse

Recommended Posts

i get this error

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/www/deanwhitehouse.awardspace.co.uk/test/user_profile.php on line 9

 

with this code

<?php
require_once 'db_connect.php';
require_once 'nav_bar.php';
require_once 'logged_in.php';

$user_id = addslashes($_GET['id']);
$sql = "SELECT * FROM `$user` WHERE `id`='{$user_id}' LIMIT 1;";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$username = $row['user_name']

?>

Link to comment
https://forums.phpfreaks.com/topic/102423-solved-user-profiles/#findComment-524516
Share on other sites

i get this error

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/www/deanwhitehouse.awardspace.co.uk/test/user_profile.php on line 9

 

with this code

<?php
require_once 'db_connect.php';
require_once 'nav_bar.php';
require_once 'logged_in.php';

$user_id = addslashes($_GET['id']);
$sql = "SELECT * FROM `$user` WHERE `id`='{$user_id}' LIMIT 1;";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$username = $row['user_name']

?>

That was sample code. is your DB set up that way?

Link to comment
https://forums.phpfreaks.com/topic/102423-solved-user-profiles/#findComment-524518
Share on other sites

this code is right but, it doesn't display anything from the database

<?php
require_once 'db_connect.php';
require_once 'nav_bar.php';
require_once 'logged_in.php';

$user_id = addslashes($_GET['id']);
$sql = "SELECT * FROM `$user` WHERE `user_id`='{$user_id}' LIMIT 1;";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$username = $row['user_name']

?>

i tried changing it to this but, it still isn't displaying anything

<?php
require_once 'db_connect.php';
require_once 'nav_bar.php';
require_once 'logged_in.php';

$user_id = $_SESSION['user_id'];
$sql = "SELECT * FROM $user WHERE `user_id`='{$user_id}' LIMIT 0,1;";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$username = $row['user_name']

?>

do i need to echo it?

Link to comment
https://forums.phpfreaks.com/topic/102423-solved-user-profiles/#findComment-524522
Share on other sites

no, db_connect.php has the session_start() on it also when i try to echo like this

<?php
require_once 'db_connect.php';
require_once 'nav_bar.php';
require_once 'logged_in.php';

$user_id = $_SESSION['user_id'];
$sql = "SELECT * FROM $user WHERE `user_id`='{$user_id}' LIMIT 0,1;";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$username = $row['user_name']

echo "$username";
?>

 

i get an "unexpected" error with this, it doesn't expect the echo

Link to comment
https://forums.phpfreaks.com/topic/102423-solved-user-profiles/#findComment-524531
Share on other sites

<?php
require_once 'db_connect.php';
require_once 'nav_bar.php';
require_once 'logged_in.php';

$user_id = $_SESSION['user_id'];
$sql = "SELECT * FROM $user WHERE `user_id`='{$user_id}' LIMIT 0,1;";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$username = $row['user_name'];

echo "$username";
?>

forgot a ";"

Link to comment
https://forums.phpfreaks.com/topic/102423-solved-user-profiles/#findComment-524535
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.