Jump to content

Recommended Posts

Hi,

I have the following code (different where command...) listed 4 times on my page. The problems appears to be that it doesnt have a close command so it is only showing one connection and then nothing underneath.

Currently this page should display...

Management
no contacts found

Internal Support
no contacts found

Server Team
no contacts found

Helpdesk Team
no contacts found

However it appears that bcause the connect has not closed it only shows

Management
no contacts found

and then nothing under at all....

I have tried using the mysql_close() command but no luck. Can anyone help please.

My code is this.....

<?php

include("includes/login_details.inc");

mysql_connect ($dbhost, $dbuser, $dbpass) or die (mysql_error()); //Connects to database

mysql_select_db ($dbname) or die (mysql_error()); //Selects your database

$sql = "SELECT * FROM contacts where department = 'Server Team' ";



$result = mysql_query($sql);

//echo $sql;

if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}

if (mysql_num_rows($result) == 0) {
echo "No Contacts Found";
exit;
}

// While a row of data exists, put that row in $row as an associative array
// Note: If you're expecting just one row, no need to use a loop
// Note: If you put extract($row); inside the following loop, you'll
// then create $userid, $fullname, and $userstatus
while ($row = mysql_fetch_assoc($result)) {
echo "<table width=800 border=0 cellpadding=0 cellspacing=0><tr>";
echo "<td width=22></td>";
echo "<td width=128><font size=1 face=Verdana, Arial, Helvetica, sans-serif><strong>";
echo $row["name"];
echo "</strong></font></td>";
echo "<td width=100><font size=1 face=Verdana, Arial, Helvetica, sans-serif>";
echo $row["mobile1"];
echo "</font></td>";
echo "<td width=100><font size=1 face=Verdana, Arial, Helvetica, sans-serif>";
echo $row["phone"];
echo "</font></td>";
echo "<td width=100><font size=1 face=Verdana, Arial, Helvetica, sans-serif>";
echo $row["mobile2"];
echo "</font></td>";
echo "<td width=350><font size=1 face=Verdana, Arial, Helvetica, sans-serif><strong>";
echo $row["jobrole"];
echo "</strong></font></td>";
echo "</tr></table>";
}

mysql_free_result($result);




?>
Link to comment
https://forums.phpfreaks.com/topic/13033-simple-help-please/
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.