Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 03-12-2005, 05:52 PM Small problem..
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
The information is taken from a database... The entire file is an "IF Statement".

What should happen is:

Select the page you wish to view:

[About me]
Description.


[About XinG-Designs]
Description.

[About XinG-Animations]
Description.

Each link should go to each individual page... Like "About me" should go to ".../?p=info&pg=me"

(Example on www.xing-designs.com/new/?p=info)

The information on "info" is written into the file, but on "info2" the information is from a database, the problem being, it shows the links after clicking a link and also repeats "Select page you..." after each link !

Can anyone help solve this problem?
feraira is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-12-2005, 05:55 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
It's very hard without seeing some code but I'm guessing that your not properly checking conditions in your if statement. A true or false value is easy to produce by the script itself even before you set it.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 03-12-2005, 05:58 PM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
Sorry heres the code:

PHP Code:
if ($_GET["pg"] == "$pg")  {

echo(
"<b>[$title]</b>");
echo(
"<br><br>");
echo(
"$cont");

}

else {

echo(
"Select the page you wish to view:");
echo(
"<br><br>");
echo(
"<a href=\"./?p=info2&pg=".$pg."\"><b>[$title]</b></a><br>$tdesc"); 

Last edited by Republikin; 03-12-2005 at 06:11 PM.. Reason: changed code tags to php
feraira is offline
Reply With Quote
View Public Profile
 
Old 03-12-2005, 06:11 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
What does $pg equal?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 03-12-2005, 06:13 PM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
Thats ripped from the database (as are all the others). $pg is what the extension is:

$pg=xd

.../?p=info&pg=xd

$pg=me

.../?p=info&pg=me

if u get it
feraira is offline
Reply With Quote
View Public Profile
 
Old 03-12-2005, 06:15 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Yeah but I don't get this....

PHP Code:
if ($_GET["pg"] == "$pg")  { 
If "$pg" is the same value as $_GET["pg"] then this will always equate to true. Try this...

PHP Code:
if (isset($_GET["pg"]) && $_GET["pg"] != "")  { 
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 03-12-2005, 06:19 PM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
that does nothing, just makes it worse lol

shows all information from all links not just the 1 u want
feraira is offline
Reply With Quote
View Public Profile
 
Old 03-12-2005, 07:15 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Ok, perhaps show me the entire page because there is stuff that I am missing.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 03-12-2005, 07:30 PM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
PHP Code:
mysql_connect("localhost""username""password");
        
mysql_select_db("db");

$result mysql_query("SELECT * FROM info order by title ASC");
        while (
$row mysql_fetch_array($result)) {
        
$title $row['title'];
$tdesc $row['tdesc'];
$cont $row['cont'];
$pg $row['pg'];

if (
$_GET["pg"] == "$pg")  {

echo(
"<b>[$title]</b>");
echo(
"<br><br>");
echo(
"$cont");

}

else {

echo(
"Select the page you wish to view:");
echo(
"<br><br>");
echo(
"<a href=\"./?p=info2&pg=".$pg."\"><b>[$title]</b></a><br>$tdesc");
echo(
"<br><br>");

}}

mysql_close(); 

Last edited by Republikin; 03-12-2005 at 09:30 PM..
feraira is offline
Reply With Quote
View Public Profile
 
Old 03-12-2005, 09:32 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
I don't know why I did not see this before, try this...

PHP Code:
mysql_connect("localhost""username""password");
        
mysql_select_db("db");

$result mysql_query("SELECT * FROM info order by title ASC");
        while (
$row mysql_fetch_array($result)) {
        
$title $row['title'];
$tdesc $row['tdesc'];
$cont $row['cont'];
$pg $row['pg'];

if (
$_GET["pg"] == $pg)  {

echo(
"<b>[$title]</b>");
echo(
"<br><br>");
echo(
"$cont");

}

else {

echo(
"Select the page you wish to view:");
echo(
"<br><br>");
echo(
"<a href=\"./?p=info2&pg=".$pg."\"><b>[$title]</b></a><br>$tdesc");
echo(
"<br><br>");

}}

mysql_close(); 
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 03-13-2005, 05:43 AM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
whats changed?
feraira is offline
Reply With Quote
View Public Profile
 
Old 03-13-2005, 05:51 AM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
hmm, ok thats a little bit better... what it does now is shows the information for the link you click... But also the information for the other 2. Also the "Select the page..." also still appears and the other links when your trying to look at the specific link.
feraira is offline
Reply With Quote
View Public Profile
 
Old 03-13-2005, 08:03 AM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
All I changed was

PHP Code:
if ($_GET["pg"] == $pg)  { 
I removed the quotes around $pg. However I am still kind of baffled as to why it shows everything else.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 03-13-2005, 01:53 PM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
What could solve this problem? I still can't think how! Would it help if I send you both the files? (Database driven and non-database driven)
feraira is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Small problem..
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.84745 seconds with 12 queries