sneakyimp;10967782 wrote:The reason it prints nothing is because you have not defined $array to contain any values. $try it on $row. I still have no idea what you are trying to do.
Hey sneakyimp,
Thanks for the reply.
I was off on a tangent yesterday and forgot to include my function to array code 🙂
What I am attempting to do is basically create a function that can do selects and join with out all the entry data.
I am expanding upon this code so I can do join/union.
SO I need the column_name of all the tables I wish to work with ... so at this point ... data =' Input' ... and I NEED data = 'Input' join/union 'Input' ... which can be a simple or complex join with out all the SQL syntax code.
function selectQuery($table, $cond="", $fields="", $order="", $sort="asc", $limit="")
{
$cond = ($cond=="")?"":"where $cond";
$fields = ($fields=="")?"*":$fields;
$order = ($order=="")?"":"order by $order $sort";
$limit = ($limit=="")?"":"limit $limit";
$query = "select $fields from $table $cond $order $limit";
$result = mysql_query($query) or die(mysql_error());
$data = Array();
if(mysql_num_rows($result) > 0)
while($row=mysql_fetch_array($result))
$data[] = $row;
return $data;
}
I am basically having issues retrieving the column name from the database in an array so I can create a join tlb function that I can implement into the above code.
I have not built many function codes so I thought this forum would be the best place to ask.