Jump to content

How to? manga.php?pid=43


Strike

Recommended Posts

Hello, I am Strike.

 

Me and some off my friends enjoy reading manga and watching anime. ^^

So we decided to make a site which will allow members to read there favorite manga for free. In any case we where thinking off getting some help with PHP+MySQL Driven manga reader but after reading some articles we decided not to because it will put a strain on how fast the image will be loaded and on the server CPU.

 

In any case we still are thinking off using dynamic URL's. But for this we require help, as I am the only one who can really do any minor HTML and CSS coding I also had to take the role off doing PHP coding, but I have no idea where to even start.

 

Okay lets say we go into our database "crave" what should we do next? Should we make a new table for each manga title? Like here

Tables
-------
Air Gear
Bleach
Naruto
Gantz

 

or is there an alternative way? Like putting all off this into one table called say Mangas?

 

And how can we make this work? If a member clicks on a link and the link is pointing to manga.php?pid=43 how can they be send to a real page instead of main URL just changing?  And if there is no such page id (pid) then they get and error displayed in manga.php saying say "We are sorry! The request page can not be found!" ?

 

All of this is confusing for me so if some one can explain the steps I need to go truth to make this work then thank you 1000* times

 

P.S.

 

* = to Infinity ^^

 

-----Strike (^.^)

 

 

Link to comment
Share on other sites

If you really want to do this well, I strongly suggest you read a php/mysql tutorial, and use php.net ALOT. a good tutorial site can be reached at http://www.tizag.com/phpT/

 

Now for your questions, First lets start off on your database structure. You are going to want to be able to have users click and go to a certain page (say manga.php) and based on a get variable (the ?var=something part . var is the get variable, and something is the value) the page loads up dynamic content. So you are going to want to make the get variable something unique for each row in your database table, (for example, an id column)

 

So for your database, you are probably going to want a row that has a unique identifier, IE id, which is different for each entry. You are also going to want the manga name (IE inuyasha, bleach, naruto, etc. etc.) After that, it depends on your application. You may want to have the URL where all the images are in that specific row. You may also want a column that has number of views, etc. All the extra cool stuff can be added later though once you have a basic working app. FYI, you are going to want to put all your manga information into this one table, that you can call mangas (well for now. you can add more tables later once you are more comfortable with how tables, mysql and php interact)

 

Now as for how it works. Again you are going to want to read php tutorials so you know exactly why it works, but I'll give you an example. say a user clicks a link called manga.php?id=14. manga.php could look something like this

 

$id = $_GET['id'];//this gets the value of the get variable you passed. in this case its the get variable id, with a value of 14

$query = mysql_query("SELECT * FROM manga WHERE id='$id'");//this queries the database.
//it selects everything from the table manga where the column id is equal to the value of the $id variable
//in our case its 14. Remember, the id column should be a unique identifier column where each entry is different!

$num = mysql_num_rows($query);//this gets the number of rows returned from the query. it should only be 1
if ($num < 1){
echo "Sorry your query returned no results";
exit();
}//this checks if there was any result. if not then say "nothing was returned' and exit the script

$row = mysql_fetch_assoc($query);//this gets an array with all the information from the query. It would have all the information
//for each specific column, and the keys of the arrays are the specific column names in the table. 
//say we wanted to output the name of the manga that the user is trying to access, and the name
//is stored under the column 'name' then we would do the following

$name = $row['name'];
echo "You are accessing the Mana $name!";

 

This isn't all you would need to do tho. You still have to connect to the database, and create the table, among a few other fairly simple steps, but I'm not gonna write you a whole tutorial to do that =P

 

So yeah, Just look up some php/mysql tutorials (all you need is a basic understanding really to do what you want) and you can have a basic application that does what you want it to do in no time.

 

good luck! I hope this helped!

 

 

Link to comment
Share on other sites

I really think you should stop now and read some of the stuff mikesta707 gave you in his post. Don't look at his code it will probably just confuse you.

If you want to create a website in php you have to know php and some basics of web programming and by web programming I mean the redirecting and error pages.

 

Please do yourself a favor and try and learn some of that stuff first before you attempt to create your site. If you don't your site will be a mess and you will be rewriting it every time you learn how to do something the proper way.

 

Good luck!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

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.