Page 1 of 1

what's wrong?

Posted: Thu Dec 30, 2004 4:00 am
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?

Posted: Thu Dec 30, 2004 5:40 am
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..

Posted: Thu Dec 30, 2004 6:28 am
by Redghost
everything is ok.
logo table is defined and it has some records.

Posted: Thu Dec 30, 2004 7:47 am
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.
:(

Posted: Thu Dec 30, 2004 9:23 am
by Redghost
Thanx fella :) Everything working