As you can see, I am pulling all the contact numbers from the table, then chosing the first number the script comes accross as the number to use. The problem is that all of the contact numbers are optional, and for some reason when the script gets to a listing without a Phone number, it uses the phone number of the previous listing. That is bad.
I have even tried resetting all of those variables mentioned above by going...
$pphone = "";
$pmob = "";
$pah = "";
$pfax = "";
at the start, so each time it goes through the loop it has all the variables equalling ""
Ummm... if anyone understands my confusing explanation, any ideas?
Last edited by Brendan Nolan; 02-12-2003 at 10:16 PM.
If possible can you remove the while loop? It looks like with what you are quering, you shouldn't need it...That being said, I can't see the rest of your code, so you probably have a reason for it.
Okay... this is the code as it is at the moment... For the previous post I changed some variables, as they had names that did not describe them.. so don't get confused - the "namesql" and "nameresult" should of course be something like "getcontactssql" and "contactsresult".
I was afraid to show the whole code in public because I have see people call other people's code "Dog S***"
PHP Code:
<?php
$sql = "SELECT * FROM entities ORDER BY entity_name ASC";
$result = mysql_query($sql);
Umm... this give you any insight into where I am going wrong?
The first bit contained in the while loop is just working out who's contact details we are getting... If you need I can send you a schema of the database.
I am trying to figure out why it would possibly give the code you gave me a parse error! There doesn't seem to be anything wrong with it... I tried a few variations on that - - without luck - all parse errors!
Unfortunately, I think I've exhausted myself on this one. Sorry. I will give advice as to where you can find you answer. Head over to http://phpbuilder.com/board and ask them. Someone is sure to know.
Bookmarks