This is the archive of the old Colorless! Go to the new Colorless →

Website Designing (Thread)

Hi guys.

I wanted to start a thread similar to the C thread, but with website design/code instead! So, if you're a website designer or are simply just interested in it, post here and let's talk about awesome website designs ;o)

Okay, so let me start.

I recently made a website with @AsianLucas for our IT exam... I'm pretty happy with it, but it's far from done. I decided to buy a domain, where I'll be able to put up my designs and projects. As of now you have to add these extensions to the URL, but I've already made some changes and stuff, I just can't upload via FTP from my school ^.^

http://www.ranglegoose.dk/php/index.php

There's one problem though. It's incredibly slow. REAL slow... I'm not entirely sure what's going on, but it seems like there's problems with connecting to the MySQL database... It just waits for 10 seconds without doing anything at all...

http://thecolorless.net/uploads/2hz_medium.png

It'd be awesome if someone could help me with this problem ;o)

Lusty approves!
though I have really no Idea what goes inside web designing O:

/edit
neat design btw <3

Wow yeah, the website takes a while to load. I can't really tell without looking at the php myself, but it could be a while loop ending in the wrong place, or going on for too long, resulting in it executing thousands of times. I dare say that would slow it down.

Also, I tried to register and login. Seems that the registration was working, but it wasn't letting me login

There shouldn't be any problems with loops. It works well on localhost on my machine... I did a test and it takes around 10 seconds for it to connect to the database for some reason...

I also checked the database, you don't seem to have registered properly, since you're not in it. It should work though. Some people from my class registered properly. (Don't worry, I hash'ed the passwords)

I signed in btw, what do I get? O:

Nothing yet ^.^

I still need to write it so that everyone gets their own profile ;o)

I was expecting for free hugs in return xD
but a profile in your site will do 8D

  
<?php  
    session_start();  
    $host="localhost";          // Host name   
    $username="root";           // Mysql username   
    $password="";               // Mysql password   
    $db_name="awesomeblog";     // Database name   
    $tbl_name="members";        // Table name  
    $tbl_name2="blog_post";     // Table name  
    $tbl_name3="image_gallery"; // Table name  
      
    // Connect to server and select database.  
    mysql_connect("$host", "$username", "$password")or die("cannot connect");   
    mysql_select_db("$db_name")or die("cannot select DB");  
?>  

That's the file, database_connect.php, which contains.. Well, yea you can see what. (that's not the database name nor username/password for the actual site xD)

I include this file on all pages that needs connection to the database.

P.S.
This is the lines fetching the images from the database:

  
    $id = $_GET['id'];  
    $query = "SELECT * FROM $tbl_name3 WHERE id = " . $id;  

Aight.

  
<?php  
    include("database_connect.php");  
  
    $id = $_GET['id'];  
    $query = "SELECT * FROM $tbl_name3 WHERE id = " . $id;  
  
    $result = mysql_query($query);  
    if($row = mysql_fetch_array($result))  
    {  
         $imageData = $row['image'];  
         $imageType = $row['imagetype'];  
    }  
    header("Content-type: ". $imageType);  
    echo $imageData;  
?>  

That's the script that's just waiting for 10 seconds (from the first screenshot)

EDIT:

http://thecolorless.net/uploads/2hB_medium.png

That's the loop, but I don't think that's giving me a hard time

Hmm. It doesn't seem to load the pictures with your code :S

It was my cousin who told me to upload the pictures to the database (He went to school to learn making websites (though he used asp not php)
I'll make sure to bonk him for it xD

Nothing seems to work.

What's the reason for using fetch_array instead of using

$result = mysql_query($query);    
if($row = mysql_fetch_array($result))  
{  

}  

Like I did?

The images aren't loading.

I tried merging your code with mine:


$id = (int) $_GET['id'];
$query = "SELECT * FROM $tbl_name3 WHERE id = " . $id;

$result = mysql_query($query);   
$row = mysql_fetch_array($result)  
if(!empty($row))    
{    
     $imageData = $row['image'];    
     $imageType = $row['imagetype'];    
}  
else  
{  
    header("HTTP/1.0 404 Not Found");    
    die("Image not found, sorry bro");   
}  
header("Content-type: ". $imageType);    
echo $imageData;    

It works fine if I don't check if $row is !empty.

Hmm. I was wrong. It only works if I define the variable in the if clause.

Echoing text probably won't work though, since the image is echoed into an html tag like so:

<img src="<?php echo "images.php?id=" . $rows['id']; ?>" />  

Okay, I made a new file to test this out:

<?php  
include("database_connect.php");  

$id = $_GET['id'];  

$query = "select * from $tbl_name3 where id = `" . intval($id) . "`";    
$query = mysql_query($query);    
$fetch = mysql_fetch_array($query);  
header("Content-type: text/plain");    
print_r($fetch);    
?>  

It gives me this error:

  

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\php\test.php on line 8

Aight.

I'm getting

  
  select * from image_gallery where id = 23  

now.

However. I think I'm gonna make it so images are uploaded to the server instead of the database, if you recon that's better ;o)

So, I'm gonna google some way to do that and post later ;o)

Dang databases seem daunting. I was given the task of designing some sort of site this summer, but I'm not sure where to begin in terms of that. I can do the HTML, CSS, and design easily enough, but that's not the hard part at all. It's for this irl game (Humans Versus Zombies if you know about it) Basically what I'd need to program is something that:

  • Allows users to log in, minimal profile settings (a picture and name is about it beyond login information)
  • Returns to user a unique ID number that is private unless you are logged in, ID number is a mix of capital letters and numbers.
  • Allows users to input ID numbers of other players when game is set to start, which would render that player a "zombie" and would restart a countdown timer for the original user, showing they "fed"
  • Keep track on the countdown timers for all users if they are "zombies"
  • Expire any user who fails to "feed" within the allocated time if they are "zombies"
  • No forums so there's that

So basically I'm not too sure how to go about with making that since I know literally nothing on MySQL and very very little on PHP. I'm not asking you to build it for me at all, just point me to the resources I need please.

It's actually not as hard as you might think. Because you're not really writing a database, you just create it with an interface (Or you can write a tiny script that creates one)

I suggest downloading WampServer. It'll set up a localhost, which you can use to run your php scripts and it'll have an interface (PhpMyAdmin) that'll allow you to easily setup a database.

After that it's rather easy setting up a connection to the server with php script. It'll look something like this:

session_start();  

// Connect to server and select database.  
mysql_connect("$host", "$username", "$password")or die("cannot connect");   

mysql_select_db("$db_name")or die("cannot select DB");  

But you should take a look at this script. It has a login- & register script. I downloaded this and from that learned rather quickly how to use php and not just use the code I was given.

P.S. You HAVE to close skype completely in order to get WampServer working. AFTER WampServer is running you are free to open skype again. It's stupid, I know...

/RAISE HAND
SORRY FOR INTERRUPT GARGRON-SAMA AND RANGLEGOOSE-SAMA!

but I have a request ;____;
the thing is i have a Uni project to make a website but i've been lazy all year -> haven't done it + haven't turn up for the Dreamweaver session so i know NADA about coding/using dreamweaver ;___; and next week is the deadline for that project
So now I'm here shamelessly asking for help ;___; if any of you guys can help me ? :( i can produce visual elements but as i said i know NADA about coding and actually make the website :( if you can help me, i promise to be your slave for eternity!! you guys probably know me, i'm an illustrator, i can give you free-of-charge illustrations all year long if you help me ;___; please! it supposed to be an ultra simple website! literally just home page, info page, contact page etc , stuff like that ;_;

I used to be pretty good a designing websites. Made my highschool sports team sites not as good as you guys yet, although taking an Cram-Course for PHP and mySQL now so i can get back into it. Still I do find designing sites pretty fun, and will come here for some tips when i'm lost!

@Jin_sama So your just looking for Basic HTTP right?

You are on the old site. New site is here:

The site has been updated on the 24th December 2011. Please go there when you are finished with the archives.

  • 481,435 posts
  • 2,075 threads
  • 23,121 users