A
Anonymous
Guest
Hi!,
I am trying to select data from two different columns and print both to html link. The code i have so far goes as follows..
$searchdata = $_GET['query'];
mysql_connect($mysqlserver1, $mysqluser, $mysqlpass) or die ("Unable to connect to MySQL server.");
mysql_select_db ("psa");
$result = mysql_query ("select id, pname from clients where pname like '%$searchdata%'") or die ("Unable to select requested table.");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$querydata1[] = $row["pname"];
$iddata[] = $row["id"];
}
I want to print the results to a link like so...
$box = array_merge ($querydata1, $querydata2, $querydata3);
sort ($box);
foreach($box as $client) {
print "<table border='0' cellpadding='0' cellspacing='0' width='100%'>";
print "<tr>";
print "\t\t<font face=\"Arial\" size=\"1\" color=red><a href='client.php?client=$client?id=$id'>$client</a></font><br>\n";
}
I have no problem with the $client variable but can't seem to match up the $id with the $client
Any help will be greatly appreciated!
TIA...
I am trying to select data from two different columns and print both to html link. The code i have so far goes as follows..
$searchdata = $_GET['query'];
mysql_connect($mysqlserver1, $mysqluser, $mysqlpass) or die ("Unable to connect to MySQL server.");
mysql_select_db ("psa");
$result = mysql_query ("select id, pname from clients where pname like '%$searchdata%'") or die ("Unable to select requested table.");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$querydata1[] = $row["pname"];
$iddata[] = $row["id"];
}
I want to print the results to a link like so...
$box = array_merge ($querydata1, $querydata2, $querydata3);
sort ($box);
foreach($box as $client) {
print "<table border='0' cellpadding='0' cellspacing='0' width='100%'>";
print "<tr>";
print "\t\t<font face=\"Arial\" size=\"1\" color=red><a href='client.php?client=$client?id=$id'>$client</a></font><br>\n";
}
I have no problem with the $client variable but can't seem to match up the $id with the $client
Any help will be greatly appreciated!
TIA...