Jump to content

adman4054

Members
  • Posts

    68
  • Joined

  • Last visited

Posts posted by adman4054

  1. So when I look at the source when putting the code outside the loop, it says "Start <ul> inside a table.." in red, so I assume I need to place that outside the table that Ch0cu3r was asking? The entire page is "tableized" (dont think that is a real word, but......). any place else I put it, it doesn't start with the <ul>

     

    I'm using a jquery called ListNav and it isnt picking up the structure that it needs to work;

     

    ul id="demoOne" class="demo">
    <li class="ln-_" style= "display: none;"> <a href="#"> 411 Services </a> <li>
    <li class="ln-a;"> <a href="#"> Adams </a> <li>
    <li class="ln-z;"> <a href="#"> fake </a> <li>
    </ul>

     

    So do I need to somehow get rid of the tables for this to work? Appreciate the time :)

  2. I've searched Google and can quite get this to work after hours of searching.

     

    I'm trying to use an unordered list. Like this:

    <ul id="demoOne" class="demo">
        <li class="ln-_" style= "display: none;"> <a href="#"> 411 Services </a> <li>
        <li class="ln-a;"> <a href="#"> Adams </a> <li>
        <li class="ln-z;"> <a href="#"> fake </a> <li>
    </ul>
    

    Using this code, I cant get the <UL> to only appear once in the code. Can I still use "echo" when trying to use the above?

    while($company = mysql_fetch_array($query)) {
    								
    echo "<tr><td width='125' class='bodyTxt'>". $company['t2'] ." </td><td class='bodyTxt'><a href='CompanyContact.php?companyID=".$company['t2']. "'class='adminLink'>" . "<li>" . $company['t1'] ." </li></a></td></tr>";
    

    As shown in the above code, I need $company[t1] to be the list itself (<li>company a </li> under the <ul> as shown in my first code block.) $company [t2] is just a number and needs to appear with [t1], but isn't part of the <li> list.

     

    Any help is appreciated

     

    Thanks

     

    Query

    include("../inc/conn.php");		  
    				//$query = mysql_query("SELECT company.companyName t1, company.companyID t2, companycontact.contactID t3 from company, companycontact where company.companyID=companycontact.companyID ORDER BY company.companyName");
    				
    				$query = mysql_query("SELECT company.companyName t1, company.companyID t2 from company ORDER BY company.companyName");
    				$num_rows=mysql_num_rows($query);  
    
  3. Hi --

    I'm using the following code to display an alphabetical list at the top of a long page. It displays "A",  "B", "C" and so on as links.

    <ul style="list-style: none; display:inline;">
    				<? foreach (range('A','Z') as $i): ?>
    					<li style="width: 18px;display:inline;"><a style="padding: 0;margin: 0;background: none;" href="?first_letter=<?= $i ?>"><?= $i ?></a></li>
    				<? endforeach ?>
    			</ul>
    

    I'm trying to add this code to display the appropriate letter between the results and to move the page to the letter that is clicked, like an anchor tag, but I can't seem to make it work

    $firstletter = substr($row['name'], 0,1);
    		if ($firstletter != $firstletter) {
    			$firstletter = $firstletter;
    			echo "<tr>
    						<td class='firstletter' colspan='6'><h3 class='firstletter' id='$firstletter'>$firstletter</h3></td>
    					</tr>";
    

    My query and "while" code:

    include("../inc/conn.php");		  
    				//$query = mysql_query("SELECT company.companyName t1, company.companyID t2, companycontact.contactID t3 from company, companycontact where company.companyID=companycontact.companyID ORDER BY company.companyName");
    				
    				$query = mysql_query("SELECT company.companyName t1, company.companyID t2 from company ORDER BY company.companyName");
    				$num_rows=mysql_num_rows($query);       
    					   
    			    echo "<table width='650' align='center'>";
                    echo "<tr>"; 
                    echo "<td colspan='2'> <div class='headerText'>".$num_rows." Active Companies: </div><div class='bodyTxt'><i>(click to view contact and listing details)</i></div><br></td>";
                    echo "</tr>";
                    echo "<tr> <td width='37'></td>";
                    echo "<td width='601' align='left' valign='top' class='bodyTxt'>";
    		  
    		  
    								echo "<table>";
    								echo "<tr><td class='headerText'>Company ID</td><td class='headerText'>Company Name</td><tr>";
    
    								//$exists = 0;
    								while($company = mysql_fetch_array($query)){
    								echo "<tr><td width='125' class='bodyTxt'>". $company['t2'] ." </td><td class='bodyTxt'><a href='reportCompanyContact.php?companyID=".$company['t2']."' class='adminLink'>". $company['t1']." </a></td></tr>";
    								}
    								?>
    
    
    
    
    

    Any help would be greatly appreciated.

     

    Thanks

     

     

     

  4. Perfect, thank you, I had a field name wrong on the second example. Both solutions work perfectly. I have been using your examples to try and figure out what is wrong with my example #1, if you have any time left, can you look at example #1 and tell me what Ive done wrong? So much thank you's :)

  5. Thanks for the reply. Agree with changing the field names and I'll do that when I get this running. The first example still wont run and the second, when I make the changes you suggest, returns a value of "No" when there is data present, any idea what I'm doing wrong? Thanks again!

     

    Also, something else came up last night during testing. This YouTube embed code returns the value twice. The extra <![CDATA[  and extra ] is required by the cms we are importing into

    $f = fieldExists($row['youTubeEmbed']);
    $xml .= "\t<youTubeEmbed>" . ($f ? "<![CDATA[" . ($row['youTubeEmbed']) . "]]>$f" : "No") . "</youTubeEmbed>\n";
    

    Appreciate you helping me out, I'm learning a great deal and hopefully someone else will with this thread!

  6. Hope I'm not pushing my luck here. You guys have been very helpful and the earlier solutions work great when using a URL.

     

    I'm receiving errors when I use the same code when just pulling the row (no URL), in the first example and I dont think I have the syntax right in the second. The second should show www.someurl.com/Download.php?listID=1234&no=1

     

    Thanks again for all the help! :happy-04:

    First Example
    $f = fieldExists($row['file1Title']);
        $xml .= "\t<file1Title>" . ($f ? "($row['file1Title'])$f" : "No") . "</file1Title>\n";
    
    Second Example	
    	$f = fieldExists($row['file1Path']);
    $xml .= "\t<file1Path>" . ($f ? "www.someurl.com/Download.php?listID= . ($row['listingID']) . "&no=1 $f"  : "No") . "</file1Path>\n";
    
  7. function fieldExists($fieldValue){
    	$trimValue = trim(str_replace(array(' ','\t','\n','\r','\0','\x0B'), '', ($fieldValue)));
    	//$fieldExists = (empty($trimValue) ? "No" : "Yes");
       return empty($trimValue) ? 'No' : $trimValue;
    	//return $fieldExists;
    }
    
    
    
    function setValue($fieldValue, $joinValue = ''){
        $trimValue = trim(str_replace(array(' ','\t','\n','\r','\0','\x0B'), '', ($fieldValue)));
        return empty($trimValue) ? 'No' : $joinValue . $trimValue;
    }
    
    $f = fieldExists($row['soundPath']);
    $xml .=  "\t<soundPath>" . ($f ? "www.someurl.com/somefolder/$f" : "No") . "</soundPath>\n";
    

    Really appreciate the assistance and its almost working. I had to remove the "echo" or I couldn't find the right place for it. If the field is populated, it works perfect. If there isn't anything in the row, it gives me the URL, which I don't want, followed by "No". Again, appreciate the help and as you can see fairly new to PHP.

  8. $xml .= "\t<soundPath>www.some url.com/somefolder/" . fieldExists($row['soundPath']) . "</soundPath>\n";

     

    Appreciate you taking the time.

     

    When I use the original code you created for me

    function fieldExists($fieldValue){
        $trimValue = trim(str_replace(array(' ','\t','\n','\r','\0','\x0B'), '', ($fieldValue)));
        return empty($trimvalue) ? 'No' : $trimvalue;
    }
    

    And the newest part of the code you created

    $xml .= "\t<soundPath>www.some url.com/somefolder/" . fieldExists($row['soundPath']) . "</soundPath>\n";
    

    It produced "No" when I ran the script againsy a row that contained data. And I'm looking for just "<soundPath>no</soundPath>" without the url and the folder if there isnt data in the row, is that possible?

     

    Thanks Again!!

  9. Maybe thats a better way. What I'm trying to do is to present the value of the row if it exists:

     

    <soundPath> www.someurl.com/somefolder/57.mp3</soundPath>

     

    If there isnt anything in the row

     

    <soundPath>no</soundPath>

     

    This is the code, but it isnt working. Would I use the fieldexists within the code or is there a better way. Thanks

    $xml .= "\t<soundPath>www.some url.com/somefolder/"($row['soundPath']).  "</soundPath>\n"; 
    
  10. I want to change the returned value in this php code

    function fieldExists($fieldValue){
    	$trimValue = trim(str_replace(array(' ','\t','\n','\r','\0','\x0B'), '', ($fieldValue)));
    	$fieldExists = (empty($trimValue) ? "No" : "Yes");
    
    

    I still want to return a value of "No" if there isnt anything in the row, but instead of displaying "yes" I'd like to display the value of the item.

     

    Thank you in advance :)

  11. I need to insert a new column within a table in an exsisting db. Here is what im looking for.

     

    I want PHP to look at the data in one column called "CID" in the CSV file, match data in a field in MYSQL also called "CID" and insert a record from a column in the CSV called "Private" into the field in the MYSQL db also called "Private.

     

    Really appreciate someone pointing me in the right direction. Thanks.

  12. Hi --

     

    I cant figure out how to sort/order this query. I'd like to display the category alphabetically.

    "SELECT category.* FROM categorylisting LEFT JOIN category ON categorylisting.categoryid = category.categoryID WHERE categorylisting.listingid = '$listID' AND category.parentID = '86608'";  
    
    

    Thank you :)

  13. Thanks for looking at it!

    Where is the $contact query?

     $qcontacts = "SELECT * FROM contact WHERE branchID = '".$branch['id']."' ";
             echo '<br />';
             $contacts = mysql_query($qcontacts)or die(mysql_error());
             while ($contact1 = mysql_fetch_assoc($contacts)) {
                 if(!empty($contact1['firstName']) && trim($contact1['firstName'])!=''){ echo "<strong>First Name: </strong>" . $contact1['firstName'] . " <br />"; }
                 if(!empty($contact1['lastName']) && trim($contact1['lastName'])!=''){ echo "<strong>Last Name: </strong>" . $contact1['lastName'] . " <br />"; }
                 if(!empty($contact1['suffix']) && trim($contact1['suffix'])!=''){ echo "<strong>Suffix: </strong>" . $contact1['suffix'] . " <br />"; }
                 if(!empty($contact1['position']) && trim($contact1['position'])!=''){ echo "<strong>Position: </strong>" . $contact1['position'] . " <br />"; }
                 if(!empty($contact1['title']) && trim($contact1['title'])!=''){ echo "<strong>Title(s): </strong>" . $contact1['title'] . " <br />"; }
                 //echo '<br />';
             }
             //echo " <br />";
        }
    ?>
    
    
  14. Just add ORDER by position ASC to the end of the query.

    Thank you, but I should have been clearer,

    <?php
    $num_rows = mysql_num_rows($contact);
    if($num_rows != NULL)
    {
    ?>
    <br />
    <p>
    <strong>Key Personnel</strong><br />
    <?php
    }
        while ($personnel = mysql_fetch_assoc($contact)) {
             echo $personnel['firstName'] .' '.$personnel['lastName'];
             
             if(!empty($personnel['title'])){ echo ', '.$personnel['title'];}
            
             echo " <br />";
        }
    ?>
    </p>
    

    The queries are commented out, correction is above. Really new to this stuff, can you point me in the right direction? Thanks again

  15. I'm trying to sort this using a field in the same table (contact) named "position" in asending order and I'm not sure where to add it. any help would be appreciated.

    <?php
    $num_rows = mysql_num_rows($contact);
    if($num_rows != NULL)
    {
    ?>
    <br />
    <p>
    <strong>Key Personnel</strong><br />
    <?php
    }
        while ($personnel = mysql_fetch_assoc($contact)) {
             echo $personnel['firstName'] .' '.$personnel['lastName'];
             //if(!empty($personnel['position'])){ echo ', '.$personnel['position']; }
             if(!empty($personnel['title'])){ echo ', '.$personnel['title'];}
             /*if(!empty($personnel['secondTitle'])){ 
                 $query = mysql_query("SELECT name FROM contact_titles WHERE id = ".$personnel['secondTitle']);
                 while ($title = mysql_fetch_array($query)) {
                    echo ', '.$title['name'];
                 }
             }
             if(!empty($personnel['thirdTitle'])){ 
                 $query = mysql_query("SELECT name FROM contact_departments WHERE id = ".$personnel['thirdTitle']);
                 while ($title = mysql_fetch_array($query)) {
                    echo ', '.$title['name'];
                 }
             }*/
             echo " <br />";
        }
    ?>
    </p>
    

    Thanks in advance!

  16. Good evening,

     

    I'm sorry but it's not clear for me either. So what column are you having issues with if we go from that image you posted? You said you have 2 columns but I see 3.

     

    When you say you want them to stack, what exactly do you mean?

     

    Kind regards,

     

    L2c.

    Thanks for the reply. The third column is servered by a seperate include file, so it doesnt have anything to do with the other 2. The two coulmns have ads for lack of a better term. Each ad has two images, a headline and some text. These ads are contained in the "Showcase div", but they wont align to the bottom of the ad on top of it, there is white space on the left column between the ads, but not on the right column. I dont want any white space and want each ad to follow the one underneath it. Thanks again.

  17. I have searched everywhere for an answer, but I don't think I'm asking the question in the right way. I have two columns, but I need the elements to stack and cant seem to make anything work. I also want to add a background color to make the elements stand out. If you look at the image attached,  it shows that the left column doesnt but up against the bottom of the element above it, it seems to align itsself to the right column. Appreciate any help. Thanks in advance

     <style type="text/css">
    	#showcase {
    		width: 100%;
    		margin-bottom: 20px;
    		margin-top: 4px;
    		vertical-align:top;
    	}
    		#showcase > div {
    			width: 280px;
    			float: left;
    			border: 1px solid #ddd;
    			padding: 5px;
                vertical-align:top;
    			margin-left: 0px;
    		}
    			#showcase > div:first-child {
    				margin-left: 0;
                    vertical-align:top;
    			}
    			#showcase > div > div {
    				
    				float: right;
    				margin-left: 8px;
                    vertical-align:top;
    				font: 12px arial, sans-serif;
    			}
    			#showcase > div > img:last-child {
    				width: 150px;
    				clear: both;
    				margin-top:16px;
    				margin-left:0px;
                    vertical-align:top;
    			}
        img.floatLeft { 
        float: left; 
        margin: 4px; 
        }
        img.floatRight { 
        float: right; 
        margin: 4px; 
        }
    
        </style>
    
    
        <div class="module" style="margin-top:0px;">
    	<div class="module-header"><h3>Product Spotlight</h3></div>
        </div>
        <div id="showcase">
    
    
    
    	<? while($row = mysql_fetch_array($products_showcase_query)): ?>
    
    		<div>
    			<span style="display: block;font-size:20px;line-height:        130%;margin-bottom:4px;"><?=              $row['product_headline'] ?></span>
    			
    			
    			<img src="../product_images/<?= $row['product_image'] ?>" style="width: 134px; float: left;" />
    			
    			<div><div class="floatLeft">
    				<?= $row['product_summary'] ?>
    			</div></div>
    			
    			<img src="../product_logos/<?= $row['product_logo'] ?>" />
    		
    		</div>
    
    	<? endwhile ?>
    	<span style="display: block;clear:both;"></span>
            </div>
    
    
    
    
    

    post-102515-0-72281600-1368989038_thumb.jpg

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.