nonshatter 26 Posting Whiz

I *think* in this case they will be two copies of the same value. You could probably check for definite if you use the PHP debugger in Linux CLI.

nonshatter 26 Posting Whiz

Try the free clone of red hat first --> CentOs v5 --> http://mirror.centos.org/centos/5/isos/ If you don't like it, then go for fedora. If you're committed on learning the command-line stuff, rather than tinkering around appearance and software etc, then it really doesn't matter in my opinion.

Otherwise, you may need to buy a proper Redhat OS and/or pay for its support. In a big corporate, where uptime and stability is key - this is where the commercial grade of RHEL comes to the fore.

Even with CentOS which is basically RHEL, the support is not as good Red Hat themselves.

Edit:- Excuse my last post, Fedora is actually sponsored by RH, (and is not debian-based)!

nonshatter 26 Posting Whiz

You can break out of the php tags to make it a bit more manageable:

<td><a class="mylink" href="<?php 'www.'.$row['website']; ?>"> <?php echo "www.$row['website']" ?></a></td>

You'll also need an image link for the thumbnail...

<td> <img src="/path/of/image" alt="image description" href="<?php $row['url'] ?>" height="78px" width="78px"></td>

This prints "www.outputsite.com" and the link URL will be exactly the same. I think that's the solution to the problem as I understand it anyway

nonshatter 26 Posting Whiz

k, either try removing the double quotes completely from the version/encoding or if that still fails, try removing the escape chars, I'm not sure how necessary they are.

nonshatter 26 Posting Whiz

Looks like there's a few bugs in there...

1. You have commented out the filename so you're pointing to just 'a'. Not sure what you're trying to do here... This makes no sense! Also, you're trying to write three lines of code on one line... You should concatenate these lines

$fname=a;//$_GET('search_fname');echo $fname;
$lname=a;//$_GET('search_lname');

2. Your query variables should have single quotes around them like this:

$sql="SELECT fname,lname,email FROM user WHERE fname='$fname' AND lname='$lname'";

3. You have used incorrect quotes here:

$xml_name = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" ;

Change it to:

$xml_name = '<? xml version=\"1.0\" encoding=\"ISO-8859-1\";' ?>

4. You've missed the last closing php tag:

<? echo $fname; echo $lname; ?>

Those are the ones I saw straight away... there's probably more in there though

nonshatter 26 Posting Whiz

Hi there,

All Linux distros have some differences... But essentially, they all perform the same operations, albeit with slight desktop and/or command-line variations.

CentOS is a good, (free) RedHat-based distro, whereas Fedora is based on a debian system. When I first began using Linux I used Ubuntu (another debian based system, similar to fedora). The reason for this was for its ease of use - particularly in terms of software management and graphical interface.

Here's a little test you can take to see which distro(s) are best for your needs http://www.zegeniestudios.net/ldc/

nonshatter 26 Posting Whiz

Ohhhh apologies. I see what you're doing now...

Shouldn't it be odbc_result() instead of odbc_results() ?

Also leave the single quotes around the variables in your query otherwise mysql will enter them literally

nonshatter 26 Posting Whiz

Why not put your function(s) in a seperate file, and include that file as you need it

File1.php

function stuff()
{
     // do some stuff...
}

File2.php

include('File1.php');
$location=stuff();
echo $location;
nonshatter 26 Posting Whiz

Actually, mysql_fetch_array can return a result row as an associative array, a numeric array, or both! http://php.net/manual/en/function.mysql-fetch-array.php
Although I usually use mysql_fetch_assoc() as it's easier to determine the result resource.

Are you receiving any errors?

Instead of this:

$query = "SELECT * FROM lgmsevze_sunbrite.webtemps LIMIT 0, 2";
      $sql = mysql_query($query);

Do this:

$query = mysql_query("SELECT * FROM lgmsevze_sunbrite.webtemps LIMIT 0,2") or die(mysql_error());
?>
 
      <ul>
   <?php
 
      while ($item = mysql_fetch_array($query))
      {
        echo "<li><img src='localhost/sbd/".$item['image']."'></li>";
      }

And tell us if you get an error

nonshatter 26 Posting Whiz

If you want to use smarty for documentation, then you can use a tool called phpdocumentor.

http://www.phpdoc.org/

nonshatter 26 Posting Whiz

Right, I have another idea. You could post the content of the variable across pages through the URL.
This should be the easiest solution. Add the content of the $artist variable to the URL so that it is sent across to the next/previous page. Forget about the session for now.

<?php

      $next = " <a href=\"$self?page=$page&artist=$artist\">[Next]</a> ";   //add artist var

?>

Then get the URL parameter using the $_GET method

<?php
if(isset($_POST['artist']))
{
    $artist = $_POST['artist']; //get artist from input field
}
else
{
    $artist = $_GET['artist'];  //otherwise, get the artist from the URL parameter
}
?>
nonshatter 26 Posting Whiz

Well technically it's not the same page as you're passing a different parameter ($_GET) for each set of 15 results. The session should work. Test it using the code I posted

if (isset($artist))
{
    //do the query
}
else 
{
    die("Artist Variable is Empty!");
}

If you still can't get it working, I will try and replicate it on my server

nonshatter 26 Posting Whiz

Ahhh... could it be the character encoding of your database?! Check this

nonshatter 26 Posting Whiz

Yes, the variable is being passed, but only once for the first page. You will need to store the user-supplied data in a session, rather than a variable for it to work across multiple pages! If you have not used sessions before, have a look at a tutorial like this one: http://php.about.com/od/advancedphp/ss/php_sessions.htm

The code I suggested in my first post gives you the majority of what you need:

<?php
    session_start();                           //this needs to be the first line on each page you need the variable for
    $_SESSION['artist'] = $_POST['search'];    //store the users input into a session variable
    $artist = $_SESSION['artist'];             //extract the user input from the session and store it back into a variable for each page.

    //.....then issue the mysql query exactly as you have been doing
?>

Hope that helps. Give us a shout if you get stuck

nonshatter 26 Posting Whiz

hmm, that's a strange one! Surely if the variable is being passed, then there should be no reason why it won't work with the query? Your code looks good from what I can see.

Perhaps try testing with something along the lines of this:

if (isset($artist))
{
    //do the query
}
else 
{
    die("Artist Variable is Empty!");
}

If you get 'artist variable is empty', at least you know it is a problem with the variable not being passed, and not with anything else.

nonshatter 26 Posting Whiz

Not exactly sure about this, but it could be because your search input field is saved as a variable. When you navigate to the next page, the variable is lost. You may be able to save the input text in a session, so it is available across all pages of the site!

$_SESSION['artist'] = $_POST['search'];
$artist = $_SESSION['artist'];
//query

You will also need a session_start(); at the top of your page if you go with this method.

nonshatter 26 Posting Whiz

So the windows-1251 didn't work?? Every russian site i've been to has this character encoding! Look here:
http://winrus.com/cpage_e.htm

"Most Russian-language Web pages (more than 90% for sure) are made nowadays in Windows-1251 encoding a.k.a. "Cyrillic(Windows)", just because the majority of authors work under MS Windows nowadays and 1251 is what Microsoft uses for Cyrillic, so built-in Windows Cyrillic fonts and keyboard tools are for Windows-1251 encoding."

nonshatter 26 Posting Whiz

Can you give us some examples of the characters you're trying to display? Try:

<meta http-equiv="content-type" content="text/html; charset=windows-1251" />
nonshatter 26 Posting Whiz

You can have a look at this function I used a while ago to determine the file extension:

//--- DETERMINES IMAGE EXTENSION ---//
function getExtension($str) {
	$i = strrpos($str,".");
		if (!$i) {
			return "";
		}
	$l = strlen($str)-$i;
	$exten = substr($str,$i+1,$l);
	return $exten;
}

                $errors = 0;
                $filename = stripslashes($_FILES['image']['name']);
                $extension = getExtension($filename);
		$extension = strtolower($extension);
			
		if (($extension == "php") || ($extension == "phtml") || ($extension == "html") || ($extension == "js")) {
			$errors = 1;
			echo 'wrong extension';
		}
                if($errors >= 1) {
			echo 'There was a problem';
                        die(1);
		}

I can post the whole thing if you need it - it might make more sense that way. Just let me know :D

Sorcher commented: Ask him for help and google will look bad! +1
nonshatter 26 Posting Whiz

You'd do exactly the same as you would for a normal field. Create the necessary fields using

<input type="hidden" value="groupX" name="groupX">

Then on adminlogin.php get the value of the hidden field:

$hidden_field = $_POST['groupX'];
//Then insert into the database along with the text field as necessary
nonshatter 26 Posting Whiz

Hey. You'll need and if statement that takes the input value and checks to see what range it's in. Pretty simple really...

if ($input >= 0 and $input < 10)
{
    echo "Input = 0-9";
}
elseif ($input >= 10 and $input < 20)
{
    echo "Input = 10-20";
}
elseif ()
{
    // etc
}
nonshatter 26 Posting Whiz

Create an array with all the months in it. Then if 5 is supplied as the month, just access the 5th element of the array.

You may want to put a dummy value in location 0 of the array so it makes it a bit easier to access the correct array key. E.g.

$months = array('dummy','Jan','Feb','Mar','April','May','June','July','Aug','Sept','Oct','Nov','Dec');

$oldm = 5;
$newm = $months[$oldm];
nonshatter 26 Posting Whiz

Sort out your indentation and curly braces - It makes things much easier to read and debug...

<?php
	$totalg=($totala+$totalb+$totalc+$totald+$totale+$totalf)/6;

	if($totalg <= 5.00 && $totalg >= 4.51)
	{
		$remark="Excellent";
	}
	elseif($totalg <= 4.50 && $totalg >= 3.51)
	{
		$remark="Very Satisfactory";
	}
	elseif($totag <= 3.50 && $totalg >= 2.51)
	{
		$remark="Satisfactory";
	}
	elseif($totalg <= 2.50 && $totalg >= 1.51)
	{
		$remark="Fair";}
	elseif($totalg <= 1.50 && $totalg >= 1.00)
	{
		$remark="Needs Improvement";
	}

	echo $remark;
?>
nonshatter 26 Posting Whiz

You need to change 'else' to 'elseif' for each of the statements.

as hielo suggested, Quotation marks are required around the remark values

Also 'totalg' needs the '$' prefix! It is a variable.

nonshatter 26 Posting Whiz

I'm not sure, I have never tried passing an array as a URL parameter. However, you could save the array as a session and simply get the contents of it on the payment page. Or even a bunch of hidden fields and get the values through $_post rather than $_get?

nonshatter 26 Posting Whiz

The easiest way to check if the path is correct is to right click where the broken image is displayed, then 'copy Image URL', then paste the shortcut which will tell you whether the path is output correctly.

If it looks correct, but still doesn't display the image, then try adding the full path to the location. E.g.

<img src=<?php echo "C://xampp/htdocs/images/". $thumbnail ?> >
facarroll commented: Knowledgeable and helpful. +1
nonshatter 26 Posting Whiz
<?php

$query = mysql_query("SELECT title FROM topics WHERE managerId='".$managerId."'                                                                                                                                                    AND egroup1='"."1"."' ORDER BY title ASC"); 
?>

<table>
<tr>
while($row1 = mysql_fetch_assoc($query))
{
        $thumbnail = $row1['title'];
    ?>
        <td><img src=<?php echo "images/". $thumbnail ?> /></td>
    <?php
}
?>
</tr>
</table>
nonshatter 26 Posting Whiz

try this? and report back the results!

<img src="images/"<?php echo $thumbnail ?> />
nonshatter 26 Posting Whiz

Can you show us an example of what is contained within $thumbnail? Try removing the <br> and the '.=' may want to be changed to '='

You are allowed to use variables in path names. Are you using a windows or linux host?

nonshatter 26 Posting Whiz

Don't quote me on this, but I think it's because the array you're passing the foreach loop isn't initialised. I find the following to be interesting in the man page:

foreach works only on arrays, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable.
nonshatter 26 Posting Whiz
<?php
if (isset($_POST['submit']))
{
    $name = $_POST['name'];
    $location = $_POST['location'];
    $email = $_POST['email'];
    $url = $_POST['url'];
    $comments = $_POST['comments'];
 
    $query = mysql_query("INSERT INTO guestbook (name,location,email,url,comments) VALUES ('$name', '$location', '$email', '$url', '$comments');") or die("Could not execute". mysql_error());

?>
<html>
<head></head>
<body>
     <h2>Thanks!!</h2>
     <h2><a href="view.php">View My Guest Book!!!</a></h2>
<?php
}
else
{
    include("sign.php");
}
?>
</body>
</html>
nonshatter 26 Posting Whiz

Good. Now try adding this data to your database:

<?php
if (isset($_POST['submit']))
{
    $name = $_POST['name'];
    $location = $_POST['location'];
    $email = $_POST['email'];
    $url = $_POST['url'];
    $comments = $_POST['comments'];

    $query = mysql_query("INSERT INTO guestbook (name,location,email,url,comments) VALUES ('$name', '$location', '$email', '$url', '$comments');") or die("Could not execute". mysql_error());
}
?>
nonshatter 26 Posting Whiz

ok.... Put this in your create_entry.php file. Add some text to the input fields on the sign.php page and click submit. If you see what you typed after the create_entry page loads, then you know the values are there. Then we can concentrate on getting it into your database

<?php
if (isset($_POST['submit']))
{
	$name = $_POST['name'];
	$location = $_POST['location'];
    $email = $_POST['email'];
    $url = $_POST['url'];
    $comments = $_POST['comments'];
	echo $location ."<br>";
	echo $email ."<br>";
	echo $url ."<br>";
	echo $comments ."<br>";
}
?>
<h2>Thanks!!</h2>
<h2><a href="view.php">View My Guest Book!!!</a></h2>

I just tested this.

nonshatter 26 Posting Whiz
<?php
include("dbconnect.php");
if ($submit == "Sign!")
{
$query = "insert into guestbook
(name,location,email,url,comments) values
('$name', '$location', '$email', '$url', '$comments')"
;
mysql_query($query) or
die (mysql_error());
?>
<h2>Thanks!!</h2>
<h2><a href="view.php">View My Guest Book!!!</a></h2>
<?php
}
else
{
include("sign.php");
}
?>

Okay, the main problem is within this file. You're telling it to insert variables that don't contain anything! You must get the input values using $_POST or $_GET.

E.g.

//check the user clicked the submit button
if(isset($_POST['submit']))
{
    // get the user-supplied values from the input fields. Echo out these values to make sure they exist!
    $name = $_POST['name'];
    $location = $_POST['location'];
    $email = $_POST['email'];
    $url = $_POST['url'];
    $comments = $_POST['comments'];

    //then once you know the values exist, issue your mysql insert query.
    $query = mysql_query("INSERT INTO guestbook (name,location,email,url,comments) VALUES ('$name','$location','$email','$url','$comments')") or die ("query failed". mysql_error());
}

Note, I haven't tested this. So read up on $_GET and $_POST, make sure the variables are holding the input data, then do the query. Hope that helps! Nonshatter

nonshatter 26 Posting Whiz

Please remember to wrap your code in [ code ] tags. What exactly do you mean by "everytime i run the sign.php form and i input entries into the form, i get this:" . Does the db connection file have <?php ?> tags??

<?php mysql_connect("localhost", "root","mobolaji") or die ("Could not connect to database"); mysql_select_db("guestbook") or die ("Could not select database"); ?>

*Edit:- If the file was wrapped in php tags you would get the error: "Could not select database" (as that's what you've told it to output with the die function). The error should not print the whole contents of the file.

nonshatter 26 Posting Whiz

Hi again,

Try this instead. I have used Javascript for the redirect as PHP can sometimes moan about headers:

if (!$html)
{
	echo 'Incomplete Data, Redirecting...';
			Redirect("error.html");
}

/**
 * JavaScript Redirect Function - Redirects the user should the result data be empty
 * @param string $url the dynamic url to redirect to
 */
function Redirect($url) 
{ ?>
	<script type="text/javascript">
		window.location = "<?php echo $url ?>"
	</script>
<?php 
}
nonshatter 26 Posting Whiz

Hey bud, Well from printing out the entire contents of the html array, you can see that the Release date is the 3rd row down.

$i=0;
	$x=0;
	while(isset($html[$i]))
	{
			echo $html[$i];
		$i++;
	}
Director: Gary Winick
Writers: Jose Rivera, Tim Sullivan
[B]Release Date: 9 June 2010 (UK) [/B]
Taglines: What if you had a second chance to find true love? See more » ..................
..................

This means that the line you want is located in array position 2. As the array starts from 0 and counts up. So it would be:

$html[0] = Director: Gary Winick
$html[1] = Writers: Jose Rivera, Tim Sullivan
$html[2] = Release Date: 9 June 2010 (UK)
$html[3] = Taglines: What if you had a second chance to find true love? See more

So the easy solution would be to simply echo out position 2.

echo $html[2];

However, if the Release date from a different imdb page was put into a different array position, this wouldn't work. So the most precise and dynamic way of doing this would be to create a regular expression to check what each array value contains before deciding whether or not to print it out. (This is something I've just started to learn as well, so it's probably not the most efficient way of doing it, but hey - if it ain't broke don't fix it!)

<?php
 // produce the release date of film
 
$some_link = 'http://www.imdb.com/title/tt0892318/';

$tagName = 'div';
$attrName = 'class';
$attrValue = 'txt-block';
$subtag = 'h4'; …
nonshatter 26 Posting Whiz

Hey yea, that's no problem. Just start a new thread when you want to get started. Nonshatter

nonshatter 26 Posting Whiz

And yea, it would be best to call it as a function. Although it might be a bit tricky as each page may have different tags to display the same information, particularly with imdb as it's so rich of information.

I've only used this technique manually - plugging in the tag names and attributes as and when I need them. Let me know if you find a solution to this. Cheers

nonshatter 26 Posting Whiz

Yes you're correct. I'm not sure how to return just the one element, other than to only echo out the first value of the $html array E.g. $html[0];

This works:

<?php 

$some_link = 'http://www.imdb.com/title/tt1055292/';
$tagName = 'div';
$attrName = 'class';
$attrValue = 'txt-block';
$subtag = 'a';
 
$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
@$dom->loadHTMLFile($some_link);
 
$html = getTags($dom, $tagName, $attrName, $attrValue, $subtag);
 
	
		echo $html[0];
	
 
function getTags($dom, $tagName, $attrName, $attrValue, $subtag)
{
    	$html = '';
    	$domxpath = new DOMXPath($dom);
    	$newDom = new DOMDocument;
    	$newDom->formatOutput = true;
 
	//$filtered = $domxpath->query("//$tagName" . '[@' . $attrName . "='$attrValue']");
 	$filtered = $domxpath->query("//$tagName" . '[@' . $attrName . "='$attrValue']/$subtag");
    	$i = 0;
   	$x = 0;
    	while( $myItem = $filtered->item($i++) )
	{		
		$html[$x] = $filtered->item($x)->nodeValue ."<br>";
    		$x++;
	}
    	return $html;
 
}
?>
nonshatter 26 Posting Whiz

Yes, that should work just fine. Just remember to remove the "/$subtag" part of the domxpath query if you're only using three nodes:

$domxpath->query("//$tagName" . '[@' . $attrName . "='$attrValue']/$subtag"); //remove "/$subtag"

Or failing that, you could keep the $subtag and try:
$tagName = 'div';
$attrName = 'class';
$attrValue = 'txt-block';
$subtag = 'a'

Make sense?

nonshatter 26 Posting Whiz

Hmm, yeah that's a bit strange. Personally, I don't trust these IDE environments like Dreamweaver. They can often be more trouble than they're worth!

To interpret the source code, I just navigated to that page (http://www.imdb.com/title/tt0892318/) in mozilla firefox, then right-click and select 'View-Source'. Then I Ctrl+F to search the source code for the interesting bit (the rating).

The rating as I see it on this page is held in the html:

<span style="display:none" id="star-bar-user-rate"><b>6.3</b><span class="mellow">/10</span></span>

Hope this helps! :)

nonshatter 26 Posting Whiz

No, I meant what imdb url you were trying to get the starbar-meta class from. In this page I am testing from, the rating is in a span tag as follows:

<span style="display:none" id="star-bar-user-rate"><b>4.9</b>

Here is the same code I posted before, and it works!

<?php
$some_link = 'http://www.imdb.com/title/tt1055292/';
$tagName = 'span';
$attrName = 'id';
$attrValue = 'star-bar-user-rate';
$subtag = 'b';

$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
@$dom->loadHTMLFile($some_link);

$html = getTags($dom, $tagName, $attrName, $attrValue);

	$i=0;
	while(isset($html[$i]))
	{
		echo $html[$i];

		
		$i++;
	}

function getTags($dom, $tagName, $attrName, $attrValue)
{
    	$html = '';
    	$domxpath = new DOMXPath($dom);
    	$newDom = new DOMDocument;
    	$newDom->formatOutput = true;
	
	$filtered = $domxpath->query("//$tagName" . '[@' . $attrName . "='$attrValue']");
		
    	$i = 0;
   	$x = 0;
    	while( $myItem = $filtered->item($i++) )
	{		
		$html[$x] = $filtered->item($x)->nodeValue ."<br>";
    		$x++;
	}
    	return $html;
	
}
?>
nonshatter 26 Posting Whiz

Hmm... It should work. Can you send me the URL you are trying to get that data from and I will have a look

nonshatter 26 Posting Whiz

Great! I'm glad it's working. Now I'm not 100% as I haven't had a chance to play around, but try something like this: (I got this from Here)

$tagName = 'div';
$attrName = 'class';
$attrValue = 'starbar-meta';
$subtag = 'b';                   // add the new subtag <b>

$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
@$dom->loadHTMLFile($some_link);

$html = getTags($dom, $tagName, $attrName, $attrValue, $subtag);      //call the function with the new subtag

	$i=0;
	$x=0;
	while(isset($html[$i]))
	{
		echo $html[$i];		
                                  //remove the preg_split function if you don't need it
		$i++;
	}

function getTags($dom, $tagName, $attrName, $attrValue, $subtag)      //pass the subtag parameter
{
    	$html = '';
    	$domxpath = new DOMXPath($dom);
    	$newDom = new DOMDocument;
    	$newDom->formatOutput = true;
	
	$filtered = $domxpath->query("//$tagName" . '[@' . $attrName . "='$attrValue']/$subtag");     //the new query should select all <b> tags within the node tree div -> class -> starbar-meta -> b
		
    	$i = 0;
   	$x = 0;
    	while( $myItem = $filtered->item($i++) )
	{		
		$html[$x] = $filtered->item($x)->nodeValue ."<br>";
    		$x++;
	}
    	return $html;
	
}
nonshatter 26 Posting Whiz

Hey David, you were right the code I posted just returned an empty array. No problem though, I just tested this code and it works on my set up.

<?php

$some_link = 'http://www.imdb.com/title/tt1055292/';
$tagName = 'h1';
$attrName = 'class';
$attrValue = 'header';

$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
@$dom->loadHTMLFile($some_link);

$html = getTags($dom, $tagName, $attrName, $attrValue);

	$i=0;
	while(isset($html[$i]))
	{
		echo $html[$i];

		$take = preg_split("/\ /", $html[$i]);

		for($n=0;$n<count($take);$n++)
		{ 
			print($take[$n]);
			echo "<br/>";
		}		
		$i++;
	}

function getTags($dom, $tagName, $attrName, $attrValue)
{
    	$html = '';
    	$domxpath = new DOMXPath($dom);
    	$newDom = new DOMDocument;
    	$newDom->formatOutput = true;
	
	$filtered = $domxpath->query("//$tagName" . '[@' . $attrName . "='$attrValue']");
		
    	$i = 0;
   	$x = 0;
    	while( $myItem = $filtered->item($i++) )
	{		
		$html[$x] = $filtered->item($x)->nodeValue ."<br>";
    		$x++;
	}
    	return $html;
	
}
?>

This returns:

Life as We Know It (2010) 
Life
as
We
Know
It (2010)

I used the preg_split function to chop up the array value. This is useful if you are returning rows of a table, <tr>'s for example. I hope this helps and let me know how it goes!

nonshatter 26 Posting Whiz

Hi there, I have been doing something similar recently to obtain data contained in an external webpage. I have used the DOMDocument technique to achieve this. Take a look:

<?php
$some_link = 'www.imdb.com/webpage.html';
$tagName = 'div';
$attrName = 'id';
$attrValue = 'tn15title';

$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
@$dom->loadHTMLFile($some_link);

$html = getTags($dom, $tagName, $attrName, $attrValue);
echo $html;

function getTags($dom, $tagName, $attrName, $attrValue)
{
    	$html = '';
    	$domxpath = new DOMXPath($dom);
    	$newDom = new DOMDocument;
    	$newDom->formatOutput = true;
	
	$filtered = $domxpath->query("//$tagName" . '[@' . $attrName . "='$attrValue']");
		
    	$i = 0;
   	$x = 0;
    	while( $myItem = $filtered->item($i++) )
	{		
		$html[$x] = $filtered->item($x)->nodeValue ."<br>";
    		$x++;
	}
    	return $html;
	
}
?>

You could adopt this for your needs... Here is the man page for it:
http://www.php.net/manual/en/book.dom.php

nonshatter 26 Posting Whiz

Correct me if i'm wrong, but I think it might be because you're trying to print each row as an associative array when the results are returned as mysql_fetch_array.

Try this:

$row=mysql_fetch_assoc($result);
while($row = mysql_fetch_assoc($result))
nonshatter 26 Posting Whiz

Undefined index means you're referring to an array with an index value that doesn't exist or can't be recognised. Try putting single quotes around the

$_POST['$id'];
nonshatter 26 Posting Whiz

Try:

<table border="0" align="center" cellpadding="0" cellspacing="0">
	<tr> 
	  <td><img src="/_images/nav_divider_white.gif"></td>
	  
	  <?php while ($nav = @mysql_fetch_assoc($navigation)) { 
              if ($nav['fieldname'] == "company") {
              continue;
              }
          ?>

... remaining original code, etc. ...

...Replacing with the name of the mysql fieldname that company is located. Also, I can't see where $mainnav and $mainnav2 are coming from