homepage Welcome to WebmasterWorld Guest from 54.211.180.175
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
why isnt mysql value displaying
$min_id doesnt have a value when diplayed
nil111




msg:3730314
 10:37 am on Aug 25, 2008 (gmt 0)

here values for $val_name and $val gets displayed.
but $min_id seems to be null coz nothing is displaying there.
there's no problem with tha database connection as well.
wats wron here? thanks in advance....

[CODE:PHP]

<?php
echo"value name is: $val_name";
echo "<br />";
echo"the value is: $val";

if($val_name == 'medium')
{
$q_min = "SELECT min(p_painting_id) FROM paintings where p_painting_medium like '".$val."'";
}

elseif($val_name == '_cid')
{
$q_min = "SELECT min(p_painting_id) FROM paintings join paintings_categories on paintings_categories.pc_paint_id = paintings.p_painting_id where pc_category_id = {$val}";
}

elseif($val_name == 'tag')
{
$q_min = "SELECT min(p_painting_id) FROM paintings join tags on tags.t_painting_id = paintings.p_painting_id where t_text like '".$val."'";
}

$db = new dbConn();
$db->connect();
$res_min = mysql_query($q_min) or mysql_error();
while ($row_min = mysql_fetch_assoc($res_min))
{
$min_id = $row_min['p_painting_id'];
}
echo "$min_id";
?>
[\CODE:PHP]

 

nil111




msg:3730334
 11:23 am on Aug 25, 2008 (gmt 0)

hey I found the error..

for anyone interested the error is near min(p_painting_id).

it should b,
min(p_painting_id) as min_val

(min_val can be any other name)
and
$min_id = $row_min['min_val'];

:)

jatar_k




msg:3730458
 1:47 pm on Aug 25, 2008 (gmt 0)

good eye nil111 :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved