Database - CPanel

Thread Solved

Join Date: Jul 2006
Posts: 849
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 138
Sponsor
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Practically a Posting Shark

Re: Database - CPanel

 
0
  #31
Jul 30th, 2009
These are smarty template files. (smarty.net). Iirc I put smarty in the zipfile.

The one other thing it needs is a database, which I put in test.sql
You will need to change the username and password in the mysqlConnect function in includes/functions.inc.php

If there is anything else, just let me know.
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 34
Reputation: Spunky is an unknown quantity at this point 
Solved Threads: 0
Spunky Spunky is offline Offline
Light Poster

Re: Database - CPanel

 
0
  #32
Jul 30th, 2009
Where is test.sql? I cannot find it.

I changed the username and password to the one I use for my database but I'm not sure if thats correct. Even if I did find the test.sql how does it connect to that? I've only ever connected to the database on CPanel, I've never done it from a file on my own computer.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 849
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 138
Sponsor
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Practically a Posting Shark

Re: Database - CPanel

 
0
  #33
Jul 31st, 2009
Look back in this thread, there's a link to it.

It's an sql file you need to execute to create the tables you need for the example.

If you've created the tables on your server and you uploaded my test files, it should run.
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 34
Reputation: Spunky is an unknown quantity at this point 
Solved Threads: 0
Spunky Spunky is offline Offline
Light Poster

Re: Database - CPanel

 
0
  #34
Jul 31st, 2009
Yea it still just brings me to my host page telling me that wowtah.com has been registered.

The way I am trying to test it is having a random link on my site that just goes to 'index.php' thats ok right?
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 849
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 138
Sponsor
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Practically a Posting Shark

Re: Database - CPanel

 
0
  #35
Jul 31st, 2009
Yes. That should be all.
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 34
Reputation: Spunky is an unknown quantity at this point 
Solved Threads: 0
Spunky Spunky is offline Offline
Light Poster

Re: Database - CPanel

 
0
  #36
Aug 18th, 2009
Ok. Well, I been fustrated with all this I haven't even felt like working on my website lol. But I am calmed down and back for more. Thing is though, I wanna give up on trying to get that PhP you gave me to work and instead ask if perhaps there is another way I can learn how to do what I want.

To refresh. What I want to do is use php to I guess generate a page for my database data to go on depending on what link is clicked on. Remember my example website was http://www.wowhead.com, and the page I personally am trying to function like this is http://www.wowtah.com/achievements where when you click on the links on the side the info on the page will change. Remember how on wowhead the number in the hyperlink changes? I need it to do that. I need to learn how to do that.

So if it is at all possible to at the very least show me where I can learn this it would be very appreciated. I just really want to continue to progress on my website more. =)
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 849
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 138
Sponsor
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Practically a Posting Shark

Re: Database - CPanel

 
0
  #37
Aug 19th, 2009
basically you get the link on the side to be:
  1. <a href="http://www.wowtah.com/achievements.php?type=general">General</a><br/>
  2. <a href="http://www.wowtah.com/achievements.php?type=quests">Quests</a><br/>

You can choose to replace the type=general with e.g. type=1, where 1 would be the id from the database.

When you click this link, it will take you back to this page, but with some information in the $_GET array. So in php you can do:

  1. $type = $_GET['type'];
  2. switch ($type) {
  3. 'general': {
  4. // here you can show your general achievements
  5. break;
  6. }
  7. 'quests': {
  8. // here you can show your quest achievements
  9. break;
  10. }
  11. }

Hope you get the idea.
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 34
Reputation: Spunky is an unknown quantity at this point 
Solved Threads: 0
Spunky Spunky is offline Offline
Light Poster

Re: Database - CPanel

 
0
  #38
Aug 21st, 2009
Ok. This makes me happy. This sounds quite simple enough to do. Once I get the hang of it I'm sure I'll get it down.

Now, I took a crack at it, doing what it looked like needed to be done. But, ofcourse, I failed. But I will show you what I did so that way you can show me what I did wrong and how to fix it. =) I didn't wanna make you do all the work so I gave it a shot. =)

So. Here's what I did.

<?php
      $db_link = @mysql_connect('localhost', 'username', 'pass') or die(mysql_error());
      @mysql_select_db('wowtahc1_achievements') or die(mysql_error());
      $type = $_GET['type'];
      switch ($type) {
      'general': {
      $query = 'SELECT * FROM general';
      $result = @mysql_query($query) or die(mysql_error());
	 if ($result)
      {
      while ($row = mysql_fetch_assoc($result))
      {
      echo $row['Name'] . ":     " . $row['Description'] . '<br/>';
      }
      mysql_free_result($result);
      }
      if ($db_link) 
      break;
      }
      'quests': {
     $query = 'SELECT * FROM quests';
      $result = @mysql_query($query) or die(mysql_error());
	 if ($result)
      {
      while ($row = mysql_fetch_assoc($result))
      {
      echo $row['Name'] . ":     " . $row['Description'] . '<br/>';
      }
      mysql_free_result($result);
      }
      if ($db_link) 
      break;
      }
      break;
      }
      }	 	 
      mysql_close($db_link)?>


And then here's the error I get when I try to go to the achievements page:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_CASE or T_DEFAULT or '}' in /home/wowtahc1/public_html/achievements.php on line 243


Line 243 is this line:

'general': {


So, obviously I placed the new php wrongly, haha.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 849
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 138
Sponsor
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Practically a Posting Shark

Re: Database - CPanel

 
0
  #39
Aug 21st, 2009
Try this:

  1. <?php
  2. $db_link = @mysql_connect('localhost', 'username', 'pass') or die(mysql_error());
  3. @mysql_select_db('wowtahc1_achievements') or die(mysql_error());
  4.  
  5. $type = $_GET['type'];
  6. switch ($type) {
  7. 'general': {
  8. $query = 'SELECT * FROM general';
  9. $result = @mysql_query($query) or die(mysql_error());
  10. if ($result)
  11. {
  12. while ($row = mysql_fetch_assoc($result))
  13. {
  14. echo $row['Name'] . ": " . $row['Description'] . '<br/>';
  15. }
  16. mysql_free_result($result);
  17. }
  18. break;
  19. }
  20. 'quests': {
  21. $query = 'SELECT * FROM quests';
  22. $result = @mysql_query($query) or die(mysql_error());
  23. if ($result)
  24. {
  25. while ($row = mysql_fetch_assoc($result))
  26. {
  27. echo $row['Name'] . ": " . $row['Description'] . '<br/>';
  28. }
  29. mysql_free_result($result);
  30. }
  31. break;
  32. }
  33. }
  34. mysql_close($db_link)
  35. ?>
Last edited by pritaeas; Aug 21st, 2009 at 6:33 am.
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 34
Reputation: Spunky is an unknown quantity at this point 
Solved Threads: 0
Spunky Spunky is offline Offline
Light Poster

Re: Database - CPanel

 
0
  #40
Aug 25th, 2009
Nothing changed. = /

Same error.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC