Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php Subject: Re: isset not working with select Date: Mon, 13 May 2013 20:10:24 +0200 Lines: 48 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net caocNuDUNH1Hssky29Ev5AJ0NHWlKKBkPFh+zv/ROtoewb1hHT Cancel-Lock: sha1:2UdTXUa4dLLjFxwYQzI9IDv6nmA= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130408 Thunderbird/17.0.5 In-Reply-To: Xref: csiph.com comp.lang.php:9306 On 13/05/13 13:01, richard wrote: > http://mroldies.net/showtable.php?year=1960 > > > > $result = mysql_query("SELECT acover,bcover FROM A$year WHERE id = > $number"); > if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } > $cov = mysql_fetch_row($result); > > > if (isset($cov[0])) > {echo "";} > echo ""; > > On item #1 in the table, the panel appears with the desired images as > wanted. > On item #2 image place holders appear because I do not have them online > yet. > I do not want to see the place holders if there is not an image. > What to use to do that? isset() will not work in this case, as both cells will always be set. I recommend you try empty() which will give you indication if the cell is empty or not. $value_to_use = empty($cov[0])?$cov[1]:$cov[0]; echo ""; IMHO it's not good to echo things, build up what you want to do and echo out everything when you are finished, this way you get out only what you want to show to the user, as you can remove parts completely if they fail. > Also, if you click on 1961, or any other year, and then any item in the > table, you will get a message below the videos stating the column does not > exist so it can't continue processing. > How can I bypass this when that database does not have that column? Don't know what you mean, didn't see any such message, but I guess that is a question to a javascript newsgroup. -- //Aho