Jump to content

Enum is returning the field name, not the value


tibberous

Recommended Posts

well lets write it a bit more strucutred so it makes more sense

<?php
$q = "select * from `prices`";
$r = mysql_query($q) or die(mysql_error()."<Br /><br />".$q);
if(mysql_num_rows($r) >0){
while($row = mysql_fetch_assoc($r)){
	print_r($row);
}
}
else{
echo "No Rows Found.";
}
?>

...

 

That's not actual code I'm using in my program. I just need to know whats up with enum's so I can fix it - I figured it would be easier to answer if I narrowed down the problem rather than pasting in three pages of code that you still can't run because you still don't have the database.

i'm sure you'll be happy to get back on topic, so what value does it have as far as phpMyAdmin (or console) is concerned?  and is this the case for all the rows, or just the one that gets returned first?  (not sure if you're just print_r()ing the first returned row as your posted code implies or if that was just for show)

If mysql_fetch_assoc is false, mysql_num_rows is false, it's stupid to explicitly check. It's also not at all relevant to the question, nor is rewriting my code with error handling.

 

I'm using navicat, it displays the correct value, but I am pretty sure that is because it is fixing it. It is return the field name for all the rows.

 

I think it might be like an html checkbox, where it's value is always the same, but it's checked property changes.

 

And I looked at the doc's. It says I can get the index by refering to the field in 'interger context', but I'm not sure how to do that, and I'd really rather have the value as text.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.