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.
PHP Newby
Started by Whitey, Feb 16 2008 05:12 PM
11 replies to this topic
#1
Posted 16 February 2008 - 05:12 PM
|
|
|
#2
Guest_Jordan_*
Posted 16 February 2008 - 05:51 PM
Guest_Jordan_*
-> 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.
= 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
Posted 16 February 2008 - 06:35 PM
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
Posted 17 February 2008 - 05:44 PM
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?
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_*
Posted 18 February 2008 - 06:10 AM
Guest_Jaan_*
well.. first you must insert your info about that image and usernames and whatever into your database.. use this:
then you must do it like 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
Posted 18 February 2008 - 06:18 PM
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_*
Posted 19 February 2008 - 06:54 AM
Guest_Jaan_*
You're welcome :)
#8
Posted 20 February 2008 - 09:37 PM
okay date problem..
i put date
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
it shows 364 days... so its like its minus 1 or something???
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
Posted 20 February 2008 - 11:26 PM
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
Posted 27 September 2008 - 01:45 AM
Like < stands for lower than, and > stands for more than
[SIGPIC][/SIGPIC]
Http://www.ArtoStiloz.Dk
Http://www.ArtoStiloz.Dk
#11
Posted 27 September 2008 - 12:59 PM
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
Posted 27 September 2008 - 04:46 PM


Sign In
Create Account


Back to top









