PHP Again...

Soldato
Joined
26 Nov 2005
Posts
3,839
Location
Doon the Bay (Newcastle)
I'm trying to display more than one bit of information in a dropdown box though all my efforts ends up with a blank

Here's the code:

Code:
<?php
while ($componentdetail = mysql_fetch_array($Cpus)){
	$Compid= $CoName['id'];
	$Model = htmlspecialchars($componentdetail['CompName']);
	echo "<option value='$Model'>$Model</option>\n";
	}
?>

What i want is more details, i've tried the following:

['CompName'] "&" ['Model']
['CompName'] '&' ['Model']
['CompName' . 'Model']
['CompName' '.' 'Model']

I'm no doubt halfway down the wrong road. Anyone point me back on track?
 
When using the WHERE statement i'm also having a weird problem.

Basically if i search a column with a number in it it's fine but when i search a column with text in it doesn't work.

Inside PHPMyAdmin (im using xampp) i get:

#1054 - Unknown column 'INTEL' in 'where clause'

the sql for that:

SELECT * FROM `componentdetail` WHERE `CompName` = INTEL

IF i put this in:

SELECT * FROM `componentdetail` WHERE `Price` = 200

I get a return of records.
 
Hi, thanks.

It works in "" rather than '' but thanks for putting me on the right lines.
 
One last one if anyone can still be bothered with me:

My next hurdle is getting a selected field to display more information from the same DB. I can't explain it very well so here's a pic.

34q64ap.jpg


The Bottom component details is where the user will select the component and above will be some text appearing a long description, so the i720 is selected, in the component table is a description which has the long text, how do i get that ti display for each individual record?

Oh can you add pictures to a phpmyadmin SQL DB i've like to do the same thing where the picture is of the CPU so each record has its own pic.

Cheers. :D

(Even if its just pointing me to some sites where i can read up and work it out on my own and come back with smaller questions)
 
Thanks for the info, will have a scout about to see if i can make sense of AJAX if not a rethink may be needed.

Cheers.
 
Ok this is good information, i will try to see what i can come up with today, I can only really afford to spend a day on it, if it doesn't work i'll have to rethink this page.

Cheers.
 
Having a first bash:

This:

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">
$("select").change(function () {
var str = "";
$("select option:selected").each(function () {
str += $(this).text() + " ";
});
$(div class="container").text(str);
})
.change();

</script>

or this

Code:
 <script type="text/javascript">
	$("select").change(function(){
  alert(CompID.id);
}); 
      
    </script>

Seems to be the main direction forums are pointing me in; i won't pretend to have the first clue what's going on.
 
I couldn't get this resolved. Thinking of going for a refresh php instead. Not technically great but hopefully i might know how to do it.
 
Back
Top Bottom