Jump to content

Mysql LongText to php list Box HELP


road2one

Recommended Posts

I need to get the data from a Mysql DB Table Names Productions (LongText Box) Exp.

 

Production 1

Production 2

Production 3

Production 4

Production 5

Production 6

 

To a list BOX using PHP

I tryed this

-----------------------

PHP Code:

</select>
<select multiple name="toBox" id="toBox">

<?
  $id2=$_GET['id'];
queryReq2 =$id2;
$query2= "SELECT id, Productions FROM  Models  where id='$queryReq2'";
$result2=mysql_query($query2);
echo mysql_error();
while (list($idN,$Productions)= mysql_fetch_array($result2))
{
echo '<option value="'.$idN.'">'.$Productions.'</option>';

?>  

-------------

I only get the first line populated from the options ... I need each production to get a option and I been trying and can't figure it out.

HELP.......

Link to comment
https://forums.phpfreaks.com/topic/81575-mysql-longtext-to-php-list-box-help/
Share on other sites

Give this ago, you may need to change the values in the select boxes to suit your mysql table cols

 



<?php


$query2 = "SELECT id, Productions FROM  Models  where id='" . $_GET['id'] . "'";
if ( ! $result2 = mysql_query($query2) )
{
     echo "Error : " . mysql_error();
}
die;
print "<select multiple name=\"toBox\" id=\"toBox\">";
while ( $row = mysql_fetch_array($result2) )
{
     print "<option value=\"" . $row['idN'] . "\">" . $row['Productions'] .
         "</option>";
}
print "</select>";

?>

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.