• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

PHP not acting the same on different lines.

This I can't understand.

I have a column on a web site that should display an image.  I've "echoed" the variables that are needed, and I've also "echoed" if the file was found or not.

The page is just going through the data in the query and displaying the data.

There are two problems:
1) On some of the lines, the "echo" for "found" or "not found" does not show up.
2) The address in question is "360 Lexington".  The image is on the web site but if you notice, the "found/not found" line does not show up?

The web site is "Langsystems.net".
Click on "Exclusives" and scroll down.

Let me know if you need more info.
Thanks
Glenn
0
breeze351
Asked:
breeze351
  • 5
  • 3
  • 3
  • +1
1 Solution
 
zappafan2k2Commented:
We would need to see the PHP source code.  You should also check your log files, they may hold some clues.

On a side note, you have over 1,000 div elements that all have the id Space_Display.  Did you know that id attributes are supposed to be unique, i.e. each element that has a defined id should have its own id?
0
 
Dave BaldwinFixer of ProblemsCommented:
You have both PHP and HTML formatting problems.  We can only 'see' all the HTML errors because you have not shown us the PHP code that displays all those listings.  I don't see opening <tr> tags for the rows of the listings.  You have a </head> tag on line 9 that should not be there.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
breeze351Author Commented:
Okay.  I know I have to clean up the html, someone else wrote it and I'm trying to make it work.   I'm going through page by page and doing the best I can.
Attached is the php in question.
Look where the image is displayed
three-line-inc.php
0
 
zappafan2k2Commented:
I see several issues in the PHP at first glance.

In this line, mysql_query returns a resource, not the query result.  You need to use one of the mysql_fetch functions against $Picture_Count.
$Picture_Count = mysql_query($SqlString2,$conn);

Open in new window


In this line, you only need one greater than sign.  What you have there is a bitwise operator.
if ($Picture_Count >> 0)

Open in new window


Same thing as before.
$Picture_Data = mysql_query($SqlString3,$conn);

Open in new window



Bitwise operator again.  In this case, I think you want != instead of greater than.
if ($ROW_PICT['DESCR'] >> "")

Open in new window


That's just what I saw right off the bat.

I really hate the way EE formats their code boxes these days...
0
 
breeze351Author Commented:
I've read your comments and I do I understand what you are saying.

My question is why does it work on some of the data that is returned and not on others?  I'm echoing the querys and everything that I can but some of the results of the query are blowing by the code.  And the display only shows 3 lines instead of 4.
0
 
Dave BaldwinFixer of ProblemsCommented:
Frankly, until you fix the known errors, that is not a reasonable question.
0
 
zappafan2k2Commented:
But I suspect that is has something to do with the bitwise operator giving unpredictable results.  If I write if ($someVariable >> 0), that is not going to give the same results as writing if($someVariable > 0).  Change those two lines and see what you get.
0
 
Ray PaseurCommented:
This is looking to me like a major code cleanup, one that argues for refactoring instead of just cleanup.  Suggest you add error_reporting(E_ALL) to the top of the PHP script.  There may be many other things wrong that are hidden by message suppression.  And it always makes me itch when I see something like this:

if ($ROW['STORE'] == $ROW['CONTIGUOUS'])
{
    $ROW['CONTIGUOUS'] = $ROW['STORE'];
}

Open in new window

That kind of screams, "Warning, a non-programmer wrote this code!  Look out for timebombs and security holes!"
0
 
breeze351Author Commented:
zappafan2k2:
You were correct.  I changed the >> to > and it says that it can't find the image.
My question is why would it find the image with the >> and not with the >?
0
 
Ray PaseurCommented:
why would it find the image with the >> and not with the >?
Because these are different operators, and so the expression would be evaluated differently.  But as bad as the code smell is, I expect that it's merely coincidence that one expression appeared to find an image.  If this were my problem, I would hire a professional programmer to refactor.  It would be worth a trip to eLance, I think.
0
 
Dave BaldwinFixer of ProblemsCommented:
"My question is why would it find the image with the >> and not with the >? "

We don't know because it doesn't make sense to do that.

And I agree with @zappafan2k2 that it should be '!=' instead of '>>' or '>'.  We would appreciate it if you would fix the problems instead of asking why bad code sometimes works.  Then we could move on to fixing other problems.
0
 
breeze351Author Commented:
I think I found the problem.  It isn't me, you or the code.  It's the outfit that hosting the page.

Check this out.  I created a simple page to display 4 images, I added some text to it and it doesn't display.

"langsystems.net/temp.php"

Here's the code that I've loaded multiple times:

<link rel="stylesheet" type="text/css" href="NewCss.css">
</head>
<body>
fred
fred
<br>
<!-- 1st Picture -->
<img src = "Chrylser_Buiding.jpg" alt = "Chrylser" width ="20%" height= "20%" />
<!-- End 1st Picture -->  
 
If you look at the code on the web, it keeps adding "Templates" to the src.  It doesn't display "fred" to the screen!

I have an e-mail into them.

I'm leaving this open for now.

Thanks
Glenn
0
 
breeze351Author Commented:
OK
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now