Jump to content

whiteboikyle

Members
  • Posts

    286
  • Joined

  • Last visited

Posts posted by whiteboikyle

  1. Okay well i am trying to make a "image" blog able to be viewed

     

    here is my code

    <?php
    include("header.php");
    $AwardCat = $config->query("SELECT * FROM `award_cat`");
    while( $AwardRow = mysql_fetch_array($AwardCat) ){
    $name = $AwardRow['name'];
    $ID = $AwardRow['ID'];
    echo("<div align='center'><b>$name</b><br />");
    $AwardCatSearch = $config->query("SELECT * FROM `awards` WHERE `cat` = '$ID'");
    while( $AwardText = mysql_fetch_array($AwardCatSearch) ){
    	$image = $AwardText['image'];
    	$award_name = $AwardText['award_name'];
    	$description = $AwardText['description'];
    	$content = $AwardText['image'];
    	header('Content-type: image/jpg');
    	echo $content;
    	echo("$award_name<br />$description</div>");
    }
    echo("<br /><br />");
    }
    include("footer.php");
    ?>

     

     

    The output is just

     

  2. Okay well here is my long php query..

     

    select username, image, ranks.rName, members.ID, timestamp, aim, categories.ID, categories.name
    				from members, ranks, ranklookup, categories
    				where members.rank = ranks.id
    				and ranks.id = ranklookup.rid
    				and categories.id = ranklookup.cid
    				and categories.id = ' . $cid . '
    				and disabled = 0
    				ORDER BY ranks.ID desc;

     

    now there is 2 ID's that come up in this situation..

     

    1 ID is for the ranks.. and the other ID is the members.. So would i echo either 1 using $row = mysql_fetch_array($result);

    if i put $row['ID'] it could get confused?

  3. okay well i am trying to make a mysql get the users rank and -3.. is there a way to do it using mysql?

     

    like i tried

    `rank`=`rank`-3  but it didn't work..

    also how do i make it SET 2 different things.. Here is my full mysql

    UPDATE `members` SET `disabled` = '0' and `rank` = `rank-3 WHERE username = 'test'

     

    but the `rank` never updates?

     

    anyways.. thanks in advanced

  4. No, dont take it rude at all.. I know i cant put my questions together.. I am a bad write. I usually explain stuff by pictures.. But, its a lack of creativity haha..

     

    but, what i ment was i posted that on another forum with like less people then here, (300 members) and they found it first post.

    Thats what i ment by that..

  5. Sorry doesn't necessarily work "better" but i have found it to be more useful if javascript is "enabled"

    header(); functions seem to give alot of grief.. and you always have to put the header function in the head.. and not all the time it is..

  6. The way i logically wrote it, is wrong.. but they way i want it to work is correct.. Dont look at my code.. i know what i want it to do.. i was just using to show what i want it to do..

     

     

    but i want to PRINT PHP CODE TO THE PHP DOCUMENT! that is all

  7. Use this function.. it works better

     

    function header_sent($url){
    echo "<script language=JavaScript>self.location.href='./$url'</script>";
    }

     

    then do this

     

    header_sent("./profile.php?id=$profileID");

  8. "INSERT into fyp (Name, AdminNumber, Gender, Address, Hometelephone, MobilePhone, Email, AcadCourse, Year, Path ,Projecttitle, ProjectSupervisor) VALUES ("name", "admin", "gender", "address", "hometel", "hp", "email", "course", "year", "path", "title", "supervisor");"

     

    make that to

     

    "INSERT into fyp (Name, AdminNumber, Gender, Address, Hometelephone, MobilePhone, Email, AcadCourse, Year, Path ,Projecttitle, ProjectSupervisor) VALUES ('$name', '$admin', '$gender', '$address', '$hometel', '$hp', '$email', '$course', '$year', '$path', '$title', '$supervisor');"

  9. I was having alot of those problems to..

     

    but i made a function using javascript and php

     

    function header_sent($url){
    echo "<script language=JavaScript>self.location.href='./$url'</script>";
    }

     

    then where you use your header(location) files do this

     

    header_sent("URL.php");

     

    bam it works ;)

  10. if($function == ""){

    header("location: main.php");

    }

    $result = $config->query("SELECT * FROM pages");

    for ($i = 0; $i < mysql_num_rows($result); $i = $i + 1)

    {

    $page = mysql_result($result, $i, "pages");

    elseif($function == "$page")

    {

    include("functions/".$page.".php");

    }

    }

    else{

    echo("<center> You entered an invalid function line! </center>");

    }

     

    see the if statement and the else at the end..

     

     

    i want the elseif statements in the middle to be generated!

    like so it looks like

     

    if(){

    }

    elseif(){

    }

    elseif(){

    }

    elseif(){

    }

    else(){

    }

     

    of course there will be way more elseif statments then that but i am trying to explain this to you guys :)

     

     

    Now i am pretty sure there is a way to do this!

     

    I know the way i wrote it wont work... lol thats why i am asking for help..

     

     

    now if someone could help me i would be of so much appreciation !

  11. Look at my last 1.. i am trying to do alot of elseif's.. but i need it to ECHO the php so to speak.. but not really echo.. It needs to print the actual PHP code through a loop into the PHP! not into the website!

     

    EDIT:

     

     

    okay well here is another way to explain it.. i dono how else to..

     

    if you do an if statement with some elseifs  and else at the end liek so

     

    if(){

    }

    elseif(){

    }

    elseif(){

    }

    elseif(){

    }

    else{

    }

     

    well.. the 3 elseif i want to make them generated.. but i just dono how to make it print php code to the php document..

  12. What i am trying to say.. its kinda hard to explain.. but like here is an example..

     

    lets say i have a table that had a column called name..

     

    well

     

    what the name is, its a name of a php file..

     

    and lets say you wanted to loop out the php files.. using php laungage..

     

    so instead of doing something with a loop and echoing something..

     

    i wan it to loop and print some php code.. but not just display it.. i want it to run that php code..

     

     

    so what i want this code to do is

     

    loop the actual php code

     

    so

     

    $page = banip

     

    would echo this.. (but not really echo.. just show the code)

    elseif($function == "banip")

    {

    include("functions/banip.php");

    }

  13. okay i am making something where people can add a function.. Well each function is viewed by a $_GET['view'] well... For the function to work it has to be allowed through the view.php page.. So i want it to add an elseif{ the include function } and loop it through..

     

    here is the full page..

     

     

    <?php
    include("header.php");
    session_start();
    $myusername = $_SESSION['myusername'];
    $function = $_GET['function'];
    if(isset($myusername)){
    if(isset($function)){
    	if($function == ""){
    	header("location: main.php");
    	}
    	$result = $config->query("SELECT * FROM pages");
    	for ($i = 0; $i < mysql_num_rows($result); $i = $i + 1)
    	{
    		$page = mysql_result($result, $i, "pages");
    		elseif($function == "$page")
    		{
    		include("functions/".$page.".php");
    		}
    	}
    	else{
    	echo("<center> You entered an invalid function line! </center>");
    	}
    }else{
    header_sent("main.php");
    }
    }
    else{
    header_sent("main.php");
    }
    include("footer.php");
    ?>
    

  14. $result = $config->query("SELECT * FROM pages");
    	for ($i = 0; $i < mysql_num_rows($result); $i = $i + 1)
    	{
    		$page = mysql_result($result, $i, "pages");
    		elseif($function == "$page")
    		{
    		include("functions/".$page.".php");
    		}
    	}
    

     

    i need it to add an elseif to the actual if equation.. so pretty much when they add a function it does it all for them..

  15. Maybe:

    function function_userlevel($userlevel){
    global $config;
    return $result = $config->query("SELECT * FROM userlevel where userlevel = '$userlevel'");
    }

    Then loop through the array.

     

    how come dont user global? how else would i get data from my config file.. lol

  16. Okay well i am going to do a function that looks in the database.. like so

     

    function function_userlevel($userlevel){
    global $config;
    $result = $config->query("SELECT * FROM userlevel where userlevel = '$userlevel'");
    
    }

     

    Now see how i did select * from userlevel.. Well the query will come up with with somewhere between 5-10 results..

     

    so how do i do a return $results.. but i need all the results..

     

    so when i use this function it will list all of them.

  17. Okay well i am making logs. Where it log's the person's ip who logs in. Well everytime they click Main.php it log's their ip. so when you go to view the logs it shows alot of that 1 user with the same ip..

    What i want it to do is when you view the logs i want it to check and see if the user has the same ip. if not it will show both ip's.

     

    Like for example:

    whitey (username)

    127.126.0.0 (IP)

     

    and it has multiple of those i just want it to display it once..

     

    but if it has a different ip display both of those..

    like for example:

    whitey

    127.126.0.0

    127.121.1.0

     

    if you could just help me start this i can finish it. Thanks :)

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