Posted by Dan on 11/20/06 23:52
Hi, I'm new to PHP so this might be a simple question to answer but I
just need a little help.
So basically I'm querying the database with this simple search SQL
statement:
$conn = db_connect();
$result = $conn->query( "SELECT name, url FROM table1 WHERE field1
LIKE'%$search%'");
where db_connect is just the connection to the database.
I want to use the name and url to fill up a table of all the search
results such as below:
echo "<tr bgcolor='$color'><td><a href=\"url\">".name."</a></td>";
I was just wondering how to get the $result so I can use it to fill up
the table and what type of loop I should use. Thanks!
Navigation:
[Reply to this message]
|