Jump to content

closing a DB


opel

Recommended Posts

I am learning how to use PHP by hand coding everything.

my code below works to pull out a list of web links from the database and display them in a table. My question is should I have a DB close tag somewhere to close the DB for security reasons?

Here is my code:

[code]<?php
include ('connections/config.php');
include ('connections/dbconn.php');


$query  = "SELECT link_id, link_title, link_desc, category_id, link_display FROM tbl_links WHERE link_display='Yes'";
$result = mysql_query($query) or die("error querying database");
$i = 0;
while($result_ar = mysql_fetch_assoc($result)){
?>
<tr <?php if($i%2 == 1){ echo "class='tablerow2'"; }else{echo "class='tablerow1'";}?>>
<td>
<?php echo $result_ar['link_title']; ?></td>
<td>
<?php echo $result_ar['category_id']; ?>
</td>
<td class="button">
<a href="edit_link_detail.php?ID=<?php echo $result_ar['website']; ?>" title="Edit This Link">Edit</a>
</td>
<td class="button">
<a href="delete_link.php?ID=<?php echo $result_ar['website']; ?>" title="Delete This Link">Delete</a>
</td>
</tr>
<?php
$i+=1;

                   
}?>
</table>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.