TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 05-08-2009, 07:22 PM   #1 (permalink)
The Wanderer
 
Join Date: Apr 2009
Posts: 19
Thanks: 9
shankar is on a distinguished road
Default Jesus help me dynamic update in drop down

<form action="stud_attendance_report_month.php" name="select_date" method="POST">
View results of &nbsp;&nbsp;&nbsp;
<select name = "month" >
<?php
include("connect.php");

$query = mysql_query("SELECT * FROM stud_attendance WHERE username = 'srikant'");
$numrows = mysql_num_rows($query);
if ($numrows!=0)
{
$row = mysql_fetch_assoc($query);
$id = $row['stud_id'];
$thing = $row['date'];
$set_month = mysql_query("SELECT MONTHNAME('".$thing."') FROM stud_attendance");
$set_month_value = mysql_query("SELECT MONTH('".$thing."') FROM stud_attendance");
}
?>
<option value ="<?php echo $set_month_value;?>"><?php echo $set_month; ?></option>
<?php
}
?>
</select>
&nbsp;&nbsp;&nbsp;

<input id='button' type='submit' name='select_date' value='Submit' />
</form>


Am unable to get the output, it does not display any month name.
Can anybody help me, have to submit the project by evening.
__________________
--
Regards
Shankar
shankar is offline  
Reply With Quote
Old 05-08-2009, 07:32 PM   #2 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

You can't do it that way, you are trying to output the resource with that approach. You have to do it like this:

Current:
PHP Code:
$set_month mysql_query("SELECT MONTHNAME('".$thing."') FROM stud_attendance");
$set_month_value mysql_query("SELECT MONTH('".$thing."') FROM stud_attendance"); 


New:
PHP Code:
$set_month mysql_query("SELECT MONTHNAME('".$thing."') FROM stud_attendance");
$month_name_rows mysql_fetch_assoc($set_month);
$month_name $month_name_rows['MONTHNAME'];
$set_month_value mysql_query("SELECT MONTH('".$thing."') FROM stud_attendance");
$month_value_rows mysql_fetch_assoc($set_month_value);
$month_value $month_value_rows['MONTH']; 
allworknoplay is offline  
Reply With Quote
The Following User Says Thank You to allworknoplay For This Useful Post:
shankar (05-09-2009)
Old 05-08-2009, 08:11 PM   #3 (permalink)
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
ETbyrne is on a distinguished road
Default



Sorry, couldn't help myself.
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
ETbyrne is offline  
Reply With Quote
The Following User Says Thank You to ETbyrne For This Useful Post:
shankar (05-09-2009)
Old 05-08-2009, 08:12 PM   #4 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

haha, yeah he seems pretty frustrated. That should lighten him up.

But programming can do that to ya!
allworknoplay is offline  
Reply With Quote
The Following User Says Thank You to allworknoplay For This Useful Post:
shankar (05-09-2009)
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Drop down relationship to SQL? xxtokerxx Absolute Beginners 1 05-05-2009 08:32 PM
mysql update with multi fields sarmenhb Absolute Beginners 1 02-06-2009 10:03 PM
Can you use IGNORE in the update of a mysql row ? codefreek General 5 11-17-2008 12:45 AM
You are subscribed to this thread mysql update with multi fields sarmenhb Advanced PHP Programming 0 11-15-2008 05:00 AM
mysql update with multi fields sarmenhb General 0 11-15-2008 04:19 AM


All times are GMT. The time now is 06:48 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design