
June 3rd, 2004
11:40 PM
Creating Simple Query Form
am a beginner user of PHP and i was desiging a website that keeps exam results of my friends in University, I already have a Mysql database holding records with Id Numbers, Names, resuls, etc...,
and I want to create a search field to place in the site (.php page) that searches in one field only (ID Number) and then gives back the result that matches the Id number showing all field in the table with only one record that match the Id number 

June 4th, 2004
06:52 AM

Well i had ths same problem with my site and thanks that was really helpful but here comes another problem:
What will i type instead of "//id was found ... do ..." and "//id was not found" to get what i want (read below)
In my site i used
<?php
echo "<TR><TD>";
echo $row["IdNumber"];
echo "";
echo $row["Name"];
echo "<TD>";
echo $row["Year"];
echo "<TD>";
echo $row["Grade"];
?>
that worked from the sense that i got my results from my search on the page, but i didn't want them to look the way they did, i mean i got plan text results sticking together in a messy way so i thought about creating a table with headers of colums like "Id Number,Name, Year, Marks(or grades)" and in another row just below the headers i get my results in a good looking way. I am not at all good at PHP, and i don't have time to practice on it cuz i have to finish this site within 2 more weeks, so please help me, just the way of creating table and how can i insert the resukts into the wanted cells, and yah tell me if i can do most of the code (table creation) with HTML or not, cuz i am more familiar with it than php.
Last edited by euphoria_dream, June 4th, 2004 07:02 AM (Edited 1 times)

June 4th, 2004
07:18 AM
its just HTML broken up into echos tatements
<?php
echo "<table width=\"100%\" border=\"1\">\n";
echo "<tr>\n";
echo "<td>ID Number</td>\n<td>Name</td>\n<td>Year</td><td>Grade</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>$row[IdNumber]</td><td>$row[Name]</td><td>$row[Year]</td><td>$row[Grade]</td>\n";
echo "</tr>\n</table>\n";
?>

June 4th, 2004
08:37 AM
well thanks i just frgot to include the
<?php
echo "<table>"; //up
//and
echo "</tr>\n</table>\n"; //down
?>
Thanks again and hope "zigzag2001" got it too