Jump to content
MakeWebGames

Recommended Posts

Posted

Hey guys

I'm adding a link to users profile in the header.php, but for some reason it isn't getting the userid, it just takes you to a profile page that says incorrect use of file.

Heres the code that I've got and i don't think the problems in here, so im guessin its somewhere else on the page, e.g. not calling in the info from the db, but unsure where to put the query?!

<a href='viewuser.php?u={$ir['userid']}'><img src='profilebutton.jpg' align='left'></a>
Posted

thanks lucky but that didnt work either, i think i'm not defining something correctly but not sure what or where it should be. heres the code for the menu bar I've made

function menubar(){
global $ir;

print "<table width='932px' border='0'  cellpadding='0' cellspacing='0' class='table3'> 
<tr><td bgcolor='#FFFFFF'>
<a href='forums.php'><img src='forumsbutton.jpg' align='left'></a>
<a href='inventory.php'><img src='inventorybutton.jpg' align='left'></a>
<a href='newspaper6.php?action=add'><img src='newspaperbutton.jpg' align='left'></a>
<a href='viewuser.php?u={$ir['userid']}'><img src='profilebutton.jpg' align='left'></a>
<a href='preferences.php'><img src='settingsbutton.jpg' align='left'></a>
<a href='search.php'><img src='searchbutton.jpg' align='left'></a>
</td></tr></table>";

}

 

If theres a lot wrong there, take it easy....im new!

thanks guys!

Posted

when clicking the profile link, it takes the user to

http://murdercountry.com/viewuser.php?u=

so it's obviously failing to call in the user id, but i'm not too sure how to call it in as every method i've tried just creates errors or doesnt work?!

Posted

I think $hc is set inside the menu file, check it's value (I believe it's from a query inside globals.php), if not you will need to add a quick query to count the users in hospital.

Posted

if $hc is not working and it shows $hc=$set['hospital_count']; in your code then that would not be the problem look at your query, and see if it is selecting hospital_count field the query should be the one above that part of your code. Should be the query that starts as $set=

Posted (edited)

they keep alot in settings, im curious what version of MC are you using?

   global $set;
  echo '
<a href="hospital.php" alt="hospital">Hospital ('.$set['hospital_count'].')</a> | <a href="jail.php" alt="jail">Jail ('.$set['jail_count'].')</a>
  ';
Edited by Paul Evans
Posted

So I've had a look and tried a few things but still a little confused as now I'm getting a value appear now....but it's just the letter S.

 

<?php

///code for menu bar
function menubar(){
global $db,$userid,$set,$ir,$hc,$c;
$set="SELECT * hospital_count, jail_count FROM users";
$hc=$set['hospital_count'];
$jc=$set['jail_count'];

print "<table width='932px' border='0' bgcolor='#FFFFFF' cellpadding='0' cellspacing='0' >*
<tr><td '>
<a href='forums.php'><img src='forumsbutton.jpg' align='left'></a>
<a href='inventory.php'><img src='inventorybutton.jpg' align='left'></a>
<a href='newspaper6.php?action=add'><img src='newspaperbutton.jpg' align='left'></a>
<a href='viewuser.php?u=$userid'><img src='profilebutton.jpg' align='left'></a>
<a href='preferences.php'><img src='settingsbutton.jpg' align='left'></a>
<a href='search.php'><img src='searchbutton.jpg' align='left'></a>
</td></tr>
<tr><td><center><img src='hospitalbuttonsmall.jpg'>($hc)<img src='jailbuttonsmall.jpg'> ($jc)</center></table>";

}

?><?php
print menubar()
?>

What am I doing wrong with my query??

Posted (edited)
if i delete that line illusion i go back to seeing nothing?! any ideas why thats happening?

cheers

You're not even running the query, but as said above you don't need to run it. Remove the line.

$set['jail_count'] and $set['hospital_count']; are set inside globals.php, therefore would only work if that page is included or is set by yourself which as said is not happening here since the query is not running.

On a side note - What version is this (v2.0.3 or 2.5) ? Sorry if you've answered already. Not looked at the whole thread.

Edited by Dominion
Posted (edited)

remove line 15 and overwrite with

<a href='viewuser.php?u={$ir['userid']}'><img src='profilebutton.jpg' align='left'></a><br />

 

see if that helps

Edited by illusions
Posted

the codes im using are 2.0.2.

I cant include globals.php in the header as this returns an error. Plus i cant seem to find the code within globals that defines $hc and $jc?! any ideas what the code starts with in globals?

thanks very much

Posted

you really should have got the free upgrade to v2.0.3 (assuming you hold a valid license) as many of the issues were fixed from 2.0.2. to get the update/patch, log into your mccodes.com account and download it from there

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.   Paste as plain text instead

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