what's wrong?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Redghost
Forum Newbie
Posts: 5
Joined: Thu Dec 30, 2004 3:52 am
Location: Lithuania

what's wrong?

Post by Redghost »

I have a script:

Code: Select all

<?php
$db_prisijungimas = mysql_connect("localhost", "username", "pass") 
					or die("Negalime prisijungti prie duombazes" . mysql_error());
mysql_select_db ("stebuklas", $db_prisijungimas) 
				or die("Nerandu duombazes" . mysql_error());
$kategorijos = "SELECT id, name FROM logo_categories;";
$query_results = mysql_query ($kategorijos, $db_prisijungimas)
print"<center>";
				while ($row = mysql_fetch_object ($query_results))
					{
					print("<a href="$PHP_SELF?id=" . $row -> id . " " >" . $row -> name ."</a>"); 
					print(" | ");
					}
					print("</center>");
			if(!isset($_GET['id']))
			{
					print "</br></br></br>";
					$logo = "SELECT id,cat_id  FROM logo;";
					$logo_results = mysql_query ($logo, $db_prisijungimas) or die(mysql_error());
					while ($rows = mysql_fetch_object($logo_results))
					{
						print ("<a href="www.myweb.com". $rows -> id ." .gif "");
					} 
			}
			else
			{
				 $logo = "SELECT id,cat_id  FROM logo WHERE cat_id = ". $_GET['id'] . ";";
				 $logo_results = mysql_query ($logo, $db_prisijungimas) or die(mysql_error());
				 while ($rows = mysql_fetch_object($logo_results))
					{
						print ("<a href="www.myweb.com". $rows -> id ." .gif "");
					}
			}
			
			
?>
First loop is normal, but others didn't print anything. What's wrong?
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

There may be two reasons for this.

First> You haven't defined the logo table.

Second> table logo doesn't contain any records at all.

Check it out, fella and report..
Redghost
Forum Newbie
Posts: 5
Joined: Thu Dec 30, 2004 3:52 am
Location: Lithuania

Post by Redghost »

everything is ok.
logo table is defined and it has some records.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

there is something i noticed at first sight also but didnt mention it then.
in the 2nd and thirg loops u havent closes the <a> tag. Both closing > and </a> are missing.
See if that makes any difference.
:(
Redghost
Forum Newbie
Posts: 5
Joined: Thu Dec 30, 2004 3:52 am
Location: Lithuania

Post by Redghost »

Thanx fella :) Everything working
Post Reply