...

View Full Version : possible to use functions with: mysql_query()?



DiarYofaMadmaN
05-25-2004, 03:27 AM
<?PHP
include 'dbconnect-include.php';

$TableName = maxforcepc;

$link = mysql_connect ($Host, $User, $Password);
mysql_select_db($DBName, $link);

$id_query = "SELECT ID FROM products";
$list_query = "SELECT $col FROM $table";

$id_result = mysql_query ($query) or die(mysql_error());

function results($results) {
$list_results = mysql_query ($results);
}

function run_query($col, $table) {
if ($list_results) {
echo "<select name='$col' id='$col'><option></option>";
while ($Row = mysql_fetch_array(results($list_query)) { echo "<option>".$Row[$col]."</option>"; }
} else {
echo "The query could not be executed!";
}

mysql_close ($link);
print ("</select>");
}
?>

I'm getting syntax errors and i think it has to do with this line: while ($Row = mysql_fetch_array(results($list_query)) I'm not really sure on how to use a function with doing that... Can any one help me out?
-peace

fimi
05-25-2004, 05:11 AM
<?PHP
//.......
while ($Row = mysql_fetch_array(results($list_query)) { echo "<option>".$Row[$col]."</option>"; }
}
}
/.....
?>

I'm getting syntax errors and i think it has to do with this line: while ($Row = mysql_fetch_array(results($list_query)) I'm not really sure on how to use a function with doing that... Can any one help me out?
-peace
you missed: you opend 3 brackets and you only closed 2:
while ($Row = mysql_fetch_array(results($list_query)) )



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum