Make your own PHP adoptables system

Need help with the site/forum/pets? Ask questions and get help from other members here.

Re: Make your own PHP adoptables system

Postby Turquoise » Thu Jul 29, 2010 1:52 pm

Nick wrote:Yes, you could use it for an account system, and yes, it's very difficult. The easiest way is to just get a ready-made accounts system like http://www.myadopts.com


Okay, I just wanted to know if it was pretty difficult. I'm basically just making the MySQL so that the pets grow a certain amount of days after they are adopted, instead of on a certain date. I won't use myadopts, since I already have my own website set up and running. I will do without an account system.

Thank You, though. :)
Image
User avatar
Turquoise
 
Posts: 2131
Joined: Sun Sep 21, 2008 9:12 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby starlord. » Mon Aug 09, 2010 8:18 am

Sorry but didnt get it at all! It just messed up my adopts site
♫ ѕearcнιng ғor ѕтarlord ♫

╔══════════════╗
Tᴜᴍʙʟʀ
DᴇᴠɪᴀɴᴛAʀᴛ
Aᴡᴇsᴏᴍᴇ Mɪx Vᴏʟ. 1
╚══════════════╝



Image

      Image
User avatar
starlord.
 
Posts: 11256
Joined: Wed Jul 21, 2010 3:04 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Turquoise » Sun Aug 22, 2010 12:09 pm

Hello again. ^_^

I have set up a system so that the adoptables will grow up after a certain amount of days, instead of on a certain date.
I keep getting a message that it can not connect to the database, but I have checked multiple times that I have the database and password correct. Maybe I am putting in the wrong information?

Here is where you can adopt a pet, and see the error message. [here]
Last edited by Turquoise on Sun Aug 29, 2010 3:24 am, edited 3 times in total.
Image
User avatar
Turquoise
 
Posts: 2131
Joined: Sun Sep 21, 2008 9:12 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Sun Aug 22, 2010 2:23 pm

The error message is "access denied" not "could not connect". It means your username or password is wrong. Click the MySQL button in your control panel, that's where the usernames and databases for your account are listed.

And when I click on the "MySQL" button in the control panel they say:
Important: MySQL Host for any database in this account is mysql8.000webhost.com , do not use localhost!

(the host name for your account will be different)
User avatar
Nick
Admin
 
Posts: 6349
Joined: Thu Jul 03, 2008 2:40 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Turquoise » Mon Aug 23, 2010 2:53 am

Thank You. :)

Okay, so now it works, but the only problem is that the picture of the pets aren't showing up from the site. It doens't show anything for the pet on adopt.php, and on the forum and off-site, the pets just show as the word "image".
Image
User avatar
Turquoise
 
Posts: 2131
Joined: Sun Sep 21, 2008 9:12 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Mon Aug 23, 2010 10:09 am

When you adopt a pet, the URL is wrong. idp is always zero in the URLs that you are showing. Did the INSERT statement fail in adopt.php maybe?

You can see the error message generated if you comment out the "header('Content-Type: ..." line in simple.php and go to the image URL directly in your browser instead:

PHP Error Message

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/a3459659/public_html/simple.php on line 20

Free Web Hosting

PHP Error Message

Warning: Invalid argument supplied for foreach() in /home/a3459659/public_html/adopttools.php on line 52

Free Web Hosting

PHP Error Message

Warning: Invalid argument supplied for foreach() in /home/a3459659/public_html/simple.php on line 33

Free Web Hosting

PHP Error Message

Warning: readfile() [function.readfile]: Filename cannot be empty in /home/a3459659/public_html/simple.php on line 42

Free Web Hosting

The first error indicates that the query failed. To find out why, add error checking too. Change simple.php's:

Code: Select all
$result2 = mysql_query($sql2);

Into:

Code: Select all
$result2 = mysql_query($sql2) or die(mysql_error());

And it will be able to print a useful error message for you.
User avatar
Nick
Admin
 
Posts: 6349
Joined: Thu Jul 03, 2008 2:40 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Turquoise » Mon Aug 23, 2010 12:35 pm

Alright, so I changed the coding above, and I am confused on what to do next. (Where to check for error message, and what to do?)
Image
User avatar
Turquoise
 
Posts: 2131
Joined: Sun Sep 21, 2008 9:12 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Mon Aug 23, 2010 6:49 pm

Right click the image that isn't displaying properly and copy the address of the image. Paste it into your address bar. That will show just the contents of the image.
User avatar
Nick
Admin
 
Posts: 6349
Joined: Thu Jul 03, 2008 2:40 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Turquoise » Tue Aug 24, 2010 1:01 am

All that comes up when I do that is "url of pet can not be displayed, because it contains errors."
Image
User avatar
Turquoise
 
Posts: 2131
Joined: Sun Sep 21, 2008 9:12 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Wed Aug 25, 2010 11:52 am

Did you remember to comment out the "header('Content-Type ..." line as I instructed? If you leave that line in, your browser will try to interpret the error message as an image instead of showing it as text.

The error I got printed (after saving the image and opening it in notepad):

Table 'a3459659_122195.adoptables' doesn't exist

What tables have you created in your database?
User avatar
Nick
Admin
 
Posts: 6349
Joined: Thu Jul 03, 2008 2:40 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Who is online

Users browsing this forum: OAI [Search] and 1 guest