Jump to content

[SOLVED] Stuck with functions


phatgreenbuds

Recommended Posts

I have the following code for my function:

 

function get_cust_content(){
$query = "SELECT * FROM tbl_content WHERE cust_id = '1' ORDER BY vid_desc ASC";
$cust_content = mysql_query($query);
confirm_query($cust_content); //function higher up that validates the results
return $cust_content; //returns the function result to the requesting file.
}

function list_content(){
$cust_content = get_cust_content(); //calls to the function above. ?>
  	<select name="Content">
    
<?php do { ?>
<option value="<?php echo $content['vid_desc']?>"><?php echo $content['vid_desc']?></option>
    
<?php
	} while ($content = mysql_fetch_array($cust_content)) ;
	$rows = mysql_num_rows($cust_content);
	if ($rows > 0)
	{
		mysql_data_seek($cust_content, 0);
		$content = mysql_fetch_assoc($cust_content);
	}}
?>
     </select>

 

This function works great...does exactly what I want it to. However when I place it in the file below its not displaying as I would have expected.

 

  <tr>
    <td><p>Select Content</p></td>
    <td><input name="content1" value="<?php list_content(); ?>"></td>
  </tr>

 

The reason I am doing this is that the function needs to repeat and return post data based on the "input name=" portion of the form field. This input name will change with every repetition and post to a different field in the DB

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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