Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inserting query results into a table

Status
Not open for further replies.

dunskii

Programmer
Sep 14, 2001
107
AU
Hi all,

I'm trying to insert 2 queries into a 2 tables on the same page, using the results as the data for the checkbox info.

I keep getting a parse error on line 4 -> $re1 = mysql_query

Its probably something simple but i cant see it. I use similar code for both queries.

<?php

$db = mysql_connect(&quot;localhost&quot;, &quot;root&quot;);

mysql_select_db(&quot;fjc&quot;,$db);

$res1 = mysql_query(&quot;SELECT * FROM admissions&quot;),$db);

$myrow = mysql_fetch_array($res1);


$admis_id = $myrow[&quot;admis_id&quot;];
$admission = $myrow[&quot;admission&quot;];

echo &quot;
<table width=\&quot;100%\&quot; align=\&quot;center\&quot; border=0>
<tr>
<td><span class=\&quot;text\&quot;><input type=\&quot;checkbox\&quot; name=\&quot;admissions\&quot; value=\&quot;$admis_id\&quot;>$admission</span></td>
</tr>
</table>
\n&quot;;

?>


Thanks for your help,

Dunskii
 
hi dunskii
i just overlooked ur code
may be the extra bracket in query is giving u a parse error.


ie $res1 = mysql_query(&quot;SELECT * FROM admissions&quot;),$db);



it shd be
$res1 = mysql_query(&quot;SELECT * FROM admissions&quot;,$db);



also if there r more than one rows u need a while loop to fetch the records

cheers

spookie

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top