| | |
Database - CPanel
Please support our Database Design advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
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.
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
-- NASA
•
•
Join Date: Jun 2009
Posts: 34
Reputation:
Solved Threads: 0
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.
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.
•
•
Join Date: Jun 2009
Posts: 34
Reputation:
Solved Threads: 0
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. =)
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. =)
basically you get the link on the side to be:
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:
Hope you get the idea.
php Syntax (Toggle Plain Text)
<a href="http://www.wowtah.com/achievements.php?type=general">General</a><br/> <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:
php Syntax (Toggle Plain Text)
$type = $_GET['type']; switch ($type) { 'general': { // here you can show your general achievements break; } 'quests': { // here you can show your quest achievements break; } }
Hope you get the idea.
"If it is NOT source, it is NOT software."
-- NASA
-- NASA
•
•
Join Date: Jun 2009
Posts: 34
Reputation:
Solved Threads: 0
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.
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.
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.
Try this:
php Syntax (Toggle Plain Text)
<?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); } 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); } break; } } mysql_close($db_link) ?>
Last edited by pritaeas; Aug 21st, 2009 at 6:33 am.
"If it is NOT source, it is NOT software."
-- NASA
-- NASA
![]() |
Similar Threads
- help im getting error with syntax on this registration script (MySQL)
- Free Social Web Hosting - 0bones.com (Web Hosting Deals)
- Need PHP/MYSQL database help (PHP)
- Check and Repair MySQL Database (MySQL)
- Database and web design (MySQL)
- Copying a database to another server (MySQL)
- show content from another sites's database (PHP)
- Automatic email creation in cpanel ----PHP (PHP)
- Remotly Hosted MySQL Database (MySQL)
Other Threads in the Database Design Forum
- Previous Thread: Database Newbie
- Next Thread: ERD for social networking website
| Thread Tools | Search this Thread |





