Devlopment Some great tutorials regarding devloping a software. Some tutorials on C++,Java and Visual basic. This section also includes Web Development.


Reply
 
LinkBack Thread Tools
Old 10-10-08, 06:58 PM   #1
cokacola
Newbie
 
Join Date: October 2008
Posts: 26
tSCash: 2291
cokacola is on a distinguished road
Default [php]mulitple pages + mysql tutorials(few posts from the top)

hey, how many of you want to make pages.php?page=1
well...why shouldn't I make a tutorial for it :P

pages.php
PHP Code:
<?php
switch($_GET['page']) {
//page 1
case 1:
echo 
"page1";
break;
//page 2, loads a different file
case 2:
include(
"page2.php");
break;
//show this if nothing else is shown
default:
echo 
"<a href='pages.php?page=1'>Page 1</a> <a href='pages.php?page=2'>Page 2</a>";
}
as you can see, I'm not the best at explaining stuff, but it seems simple enough if you are moderate at php :P


Last edited by cokacola; 11-10-08 at 03:47 PM.
cokacola is offline   Reply With Quote
Old 10-10-08, 07:07 PM   #2
Hitterman Chopper Challenge Champion
TOTM Winner Feb
 
Hitterman's Avatar
 
Nick Name: Hitty
Join Date: April 2008
About Me: I like to play all the Sports.
Location: India
Posts: 1,533
tSCash: 362968
Hitterman is a splendid one to beholdHitterman is a splendid one to beholdHitterman is a splendid one to beholdHitterman is a splendid one to beholdHitterman is a splendid one to beholdHitterman is a splendid one to behold
Default

I always wanted to learn making webpages in PHP.
Thanks for it. If you can add more tutorials in this thread i'll nominate this for TOTM.
__________________
CricketGaming.net .
Hitterman is offline   Reply With Quote
Old 10-10-08, 07:12 PM   #3
cokacola
Newbie
 
Join Date: October 2008
Posts: 26
tSCash: 2291
cokacola is on a distinguished road
Default

this thread, or this forum?
because, php is my thing :P
i assume u ment thread lol
just trying to think of one..
by the way...
what happons if you win totm?

Last edited by cokacola; 10-10-08 at 07:14 PM.
cokacola is offline   Reply With Quote
Old 10-10-08, 07:22 PM   #4
Hitterman Chopper Challenge Champion
TOTM Winner Feb
 
Hitterman's Avatar
 
Nick Name: Hitty
Join Date: April 2008
About Me: I like to play all the Sports.
Location: India
Posts: 1,533
tSCash: 362968
Hitterman is a splendid one to beholdHitterman is a splendid one to beholdHitterman is a splendid one to beholdHitterman is a splendid one to beholdHitterman is a splendid one to beholdHitterman is a splendid one to behold
Default

If you'll post more PHP tutorials i'll nominate you for Tutorial of the Month. And who knows, you may get a high post at tutorialistic.
__________________
CricketGaming.net .
Hitterman is offline   Reply With Quote
Old 10-10-08, 07:46 PM   #5
cokacola
Newbie
 
Join Date: October 2008
Posts: 26
tSCash: 2291
cokacola is on a distinguished road
Default a few mysql tutorials

I have a fan of this thread now don't I hitty :P
thought I might make a few mysql tutorials
---
1.connect to mysql server
here we go..
PHP Code:
<?php
mysql_connect
("mysql_server""mysql_username""mysql_password") or die("<p>mysql_error: ".mysql_error()."</p>");
//replace mysql_server with your server, mysql_username with your mysql username, and mysql_password with your mysql password...if it fails, it will say error: then state the mysql error.
//select a database
mysql_select_db("mysql_database");
//just replace mysql_database with your database name.
?>
wow, you just connected to a database :P
2.select data from a database and display it
PHP Code:
<?php
//connect to server
mysql_connect("mysql_server""mysql_username""mysql_password") or die ("<p>Mysql_Errro: ".mysql_error()."</p>");
//select database
mysql_select_db("mysql_database") or die("<p>Failed to select database, error: ".mysql_error()."</p>");
//set sql query, replacing `table` with your `table`(must have the ``)
$sql="SELECT * FROM `table`";
//run sql query
$s=mysql_query($sql) or die("<p>Error selecting data from db: ".mysql_error()."</p>");
//put data into an array
$row=mysql_fetch_assoc($s);
//display data, data 1 and data 2 must be in your table, and must have something inserted(showing you how to insert later...)
echo "<p>Data1: $row[data1]</p><p>data2: $row[data2]";
//thats about it for that :P
?>
wow, you can connect and display data from a database now :P
3.insert data into a database
PHP Code:
<?php
//connect to DB
mysql_connect("server""user""pass") or die("<p>".mysql_error()."</p>");
//select a DB
mysql_select_db("database") or die("<p>".mysql_error()."</p>");
//set sql query
$sql="INSERT INTO `table` (`data1`, `data2`) VALUES (`text1`, `text2`)";
//run query
mysql_query($sql) or die("<p>".mysql_error()."</p>");
echo 
"Insert text1, and text2 into data1, and data2 successfully.";
?>
and, you can insert data aswell now :P
plus my neck herts aswell, so I hope someone enjoys this...
4.display certin data
PHP Code:
<?php
//connect to server
mysql_connect("server""user""pass") or die("<p>".mysql_error()."</p>");
//select db
mysql_select_db("database") or die("<p>".mysql_error()."</p>");
//select sql
$sql="SELECT * FROM `table` WHERE `type`='data'";
//run query
$s=mysql_query($sql) or die("<p>".mysql_error()."</p>");
//display every thing that has a field called `type` that is set to 'data'
while($row=mysql_fetch_assoc($s)) {
echo 
"<p>$row[data1]</p><p>$row[data2]</p>";
}
?>
wow, my shoulders are starting to hert now, so you better like it
1 more..
5.checking if data exists
PHP Code:
<?php
//connect
mysql_connect("server""user""pass") or die("<p>".mysql_error()."</p>");
//db selection
mysql_select_db("database") or die("<p>".mysql_error()."</p>");
//sql query data
$sql="SELECT * FROM `table` WHERE `data1`='text1'";
//sql query
$s=mysql_query($sql) or die("<p>".mysql_error()."</p>");
//see if any exist
$count=mysql_num_rows($s);
if(
$count !=0) {
echo 
"<p>$row[data1]</p>";
} else {
echo 
"<p>Sorry, the data doesnt exist.</p>";
}
?>
ok, done, now, i wasn't sitting strait...cuz I am an idiot(lol) so I have sore shoulders and a sore neck..and when i started I had a headache, and I still do...please, oh, PLEAE enjoy it!
p.s I sat here, and wrote this all, I did not copy and paste, and took no brakes. you just wait till I write a php user system tutorial...you will like :P(includes profile editing, comments, signitures for comments, admins being able to edit and delete users.....big big big...lol, may be a while before thats ready though)
enjoy anyways, for now, cya later!
cokacola is offline   Reply With Quote
Old 11-10-08, 02:22 PM   #6
Motorokr
Novice
 
Motorokr's Avatar
 
Join Date: June 2008
Location: Gujrat
Posts: 118
tSCash: 1467
Motorokr is on a distinguished road
Default

nics and simple explaination
__________________
Motorokr is offline   Reply With Quote
Old 11-10-08, 03:30 PM   #7
cokacola
Newbie
 
Join Date: October 2008
Posts: 26
tSCash: 2291
cokacola is on a distinguished road
Default

well, thankyou there!
I was kinda hoping it was :P
cokacola is offline   Reply With Quote
Old 10-11-08, 06:52 PM   #8
RoMusik
Newbie
 
Join Date: November 2008
Posts: 12
tSCash: 713
RoMusik is on a distinguished road
Default

Thnks for this helpfully tutorial. I was searching for some time for this tutorial. Thnks again
RoMusik is offline   Reply With Quote
Old 14-11-08, 05:39 PM   #9
Hitterman Chopper Challenge Champion
TOTM Winner Feb
 
Hitterman's Avatar
 
Nick Name: Hitty
Join Date: April 2008
About Me: I like to play all the Sports.
Location: India
Posts: 1,533
tSCash: 362968
Hitterman is a splendid one to beholdHitterman is a splendid one to beholdHitterman is a splendid one to beholdHitterman is a splendid one to beholdHitterman is a splendid one to beholdHitterman is a splendid one to behold
Default

"Thnks" to you too. There are many available on Internet but Coke has really explained well.
__________________
CricketGaming.net .
Hitterman is offline   Reply With Quote
Old 16-11-08, 08:59 PM   #10
SrijanK
Newbie
 
Join Date: November 2008
Posts: 8
tSCash: 710
SrijanK is on a distinguished road
Default

really nice tutorials for starters like me.
SrijanK is offline   Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump




All times are GMT +5.5. The time now is 11:25 AM.


Network: Tutorialistic.net | CricketGaming.net | Down The Wicket | CricketGaming.org | AshesGaming | Wrestle Gaming

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright © 2008 - 10, Tutorialistic.net