Jump to content

PHP Newby

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
11 replies to this topic

#1
Whitey

Whitey

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 255 posts
Okay i just wanted some basic info i could use for php.
Like what does -> mean
What does =, ==, or === mean and when should i use them.
How to do sessions for a login script.
I will post on this topic everytime i have a question. Thanks guys.

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
-> is a pointer (to a PHP Class)
= assigns a value to a variable ($name = "jordan")
== is a conditional statement (if $name == "jordan") (1==2 returns false)
=== Not sure, I never used this. Possibly the same as above.
Sessions: PHP: Sessions - Manual

Ask as much as you like, we are more than happy to help.

#3
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Triple equals operator test whether two variables are the same and the same type.

$i = 4;        //assignment operator
$j = 4.0;     //assignment operator

echo $i == $j;  //will echo 1;
echo $i === $j //will echo 0;    int != double


#4
Whitey

Whitey

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 255 posts
Well since i am new to coding i am going to try to make a Clan Scripts. My friend did this when he was new and it worked out good for him. Teaching him alot. So.. i was wondering how do i set images to a mysql table form. Like Inside my table is Members and in members is ID USERNAME PASSWORD RAN
Then i have a table that is called RANK and inside RANK is ID and NAME
Then it goes from 1-25 for ranks and a name for these. Now how do i set an image for each rank?

#5
Guest_Jaan_*

Guest_Jaan_*
  • Guests
well.. first you must insert your info about that image and usernames and whatever into your database.. use this:

//This will add image's path and rank's name to your databas
//I'm using Major for current rank
mysql_query("INSERT INTO ranks (rankimage, rankname) VALUES ('images/major.jpg', 'Major')");

then you must do it like this:

//Get user ID
$id = "1";

//Get this user's info
$query = mysql_query("SELECT * FROM members WHERE id='".$id."'");
$row = mysql_fetch_array($query);
$username = $row['uname'];
$rank = $row['rank'];

//Find his/her rank
$query2 = mysql_query("SELECT * FROM ranks WHERE rankname='".$rank."'");
$row2 = mysql_fetch_array($query2);
$rankimg = $row2['rankimg'];

//Show his/her info
echo "<table>"
	."<tr>"
	."<td>ID</td>"
	."<td><b>Username</b></td>"
	."<td>Rank</td>"
	."</tr>"
	."<tr>"
	."<td>".$id."</td>"
	."<td>".$username."</td>"
	."<td><img src='".$rankimg."'></td>"
	."</tr>"
	."</table>";


#6
Whitey

Whitey

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 255 posts
Alright thanks alot i will see where i get from here. By the way. if you want to see my progress on all of this it will be under Corps Clan Manager

#7
Guest_Jaan_*

Guest_Jaan_*
  • Guests
You're welcome :)

#8
Whitey

Whitey

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 255 posts
okay date problem..
i put date
echo "<b>Date Joined:</b>" . date("d/m/Y", $req_user_info['joined']) . "<br>";

But it comes up null (ex: 12/31/1969)

Help please?

Pretty much i want to make the date joined thats in the table shown up in days.
so i can go Currentdate - DateJoined = Days in clan

wait now when i do

echo(date('z', $req_user_info['joined']));

it shows 364 days... so its like its minus 1 or something???

#9
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Is $req_user_info['joined'] a unix timestamp? Also note: you should create a new thread for each new question - it makes it a lot easier for everyone.

#10
ArtoStiloz

ArtoStiloz

    Programmer

  • Members
  • PipPipPipPip
  • 175 posts
Like < stands for lower than, and > stands for more than
[SIGPIC][/SIGPIC]
Http://www.ArtoStiloz.Dk

#11
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts

ArtoStiloz said:

Like < stands for lower than, and > stands for more than

why open a 7 month old thread??

I find you do this alot...

#12
ArtoStiloz

ArtoStiloz

    Programmer

  • Members
  • PipPipPipPip
  • 175 posts
Well it was located at the frontpage.
[SIGPIC][/SIGPIC]
Http://www.ArtoStiloz.Dk