buddylee17 216 Practically a Master Poster

Try modifying the following to pull from the table, rather than comparing the date variables:

DECLARE @intime DATETIME
DECLARE @outime DATETIME
DECLARE @time int--total seconds
DECLARE @days int, @hours tinyint, @minutes tinyint, @seconds tinyint
SET @intime = GETDATE()
SET @outime = DATEADD(S, 3663, @intime)

SET @time = DATEDIFF(S,@intime,@outime)
SET @days = @time / 86400
SET @hours = (@time/3600) - (@days * 24)
SET @minutes = (@time/60) - (@days * 1440) - (@hours * 60)
SET @seconds = @time % 60

SELECT @time total_second_count
	 , @days day_count
	 , @hours hour_count
	 , @minutes minute_count 
	 , @seconds second_count
debasisdas commented: that will work nicely. +8
buddylee17 216 Practically a Master Poster

This will work with 2008. With 2005 or earlier, you'll need to use datetime and the convert to varchar to strip the time portion off.

DECLARE @yesterday DATE
SET @yesterday = DATEADD(D,-1,GETDATE())
debasisdas commented: thank you for providing alternate solution. +8
buddylee17 216 Practically a Master Poster

You have to declare the variable @letter and assign it a value:

DECLARE @letter CHAR(1)
SET @letter = 'A'
SELECT First_Name FROM dbo.Names WHERE First_Name LIKE '%' + @letter + '%'
buddylee17 216 Practically a Master Poster

Defining the column as Identity, means that each value is unique and will never repeat. It is an identifier for the row.

buddylee17 216 Practically a Master Poster

The management studio is an exe. Your machine is probably grabbing the R2 ssms instead of the 2008 one. The 2008 exe will probably be in C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe

As for the express instance, you'll need to connect to it.
Server type: Database Engine
Server name: MachineName\SQLEXPRESS

The server name is in MachineName\InstanceName format.

Also, use services (Start->Run->services.msc) or the SQL Server Configuration Manager to verify that the instance you want to connect to is running. The parentheses will tell you the instance name.

buddylee17 216 Practically a Master Poster

Yes, you can install multiple instances of sql server on the same box without any issues. It's fairly common for developers to install Sql Server Express with Visual Studio and then later install a full version of Sql Server.

buddylee17 216 Practically a Master Poster

There's your problem. The database engine, Integration services, and Analysis services all run independently as separate services. You'll need to locate SQL Server and start it. The description should be : Provides storage, processing and controlled access of data, and rapid transaction processing.

If SQL Server is not present in services, this means you didn't get the database engine installed and you'll need to install it.

See more here: http://social.technet.microsoft.com/wiki/contents/articles/a-network-related-or-instance-specific-error-occurred-while-establishing-a-connection-to-sql-server.aspx

buddylee17 216 Practically a Master Poster

Open services (start->run->services.msc) and verify that SQL Server is started.
Since the database is on the same machine that you are connecting to, shared memory would be preferred but any of the 3 should work for connecting.

buddylee17 216 Practically a Master Poster

The width and height are in the properties panel.

Also, make sure you are viewing the reports in IE. I don't know why they can't make the reports cross browser compatible, but they won't render or export correctly in other browsers.

buddylee17 216 Practically a Master Poster

Sql server is designed to be ran on a server, and that's why it says server name. It's the computer name. If you have multiple instances of sql server installed, then it will be computer name\instance name. Also, since the management studio and the database engine are both on the same PC, you should be able to use localhost as the server name.

buddylee17 216 Practically a Master Poster

Well, lets see.

Many users can be associated with a certificate
and
Many certificates can be associated with a user

This is simply a many to many relationship.

Here's a suggestion:

CREATE TABLE Users(
userid int identity not null primary key, username varchar(25) unique not null
)
CREATE TABLE Certs(
--use smallint or int for certid if you need to support more than 255 certs
certid tinyint identity not null primary key, certification varchar(10) unique not null
)
CREATE TABLE CertUserLink(
--certified column represents the Y/N value. 1 is true, 0 is false
userid int not null, certid tinyint not null, certified bit not null default 0
)

ALTER TABLE CertUserLink
   ADD CONSTRAINT PK_certuserlink PRIMARY KEY CLUSTERED (certid,userid)    
   
--Make sure that the userid and certid are valid before inserts can be made
ALTER TABLE CertUserLink
   ADD CONSTRAINT FK_certs FOREIGN KEY (certid) REFERENCES Certs(certid)
ALTER TABLE CertUserLink
   ADD CONSTRAINT FK_users FOREIGN KEY (userid) REFERENCES Users(userid)
buddylee17 216 Practically a Master Poster

Select "Copy data from one or more tables or views". On the next screen, click the checkbox for the table that you want to export. Also, verify that the destination table is correct.

buddylee17 216 Practically a Master Poster

There are probably around 100 ways to do this.

If you are new to SQL Server, the easiest way will probably be the export data task.

From the Management Studio, right click on the database of the source table. Hover over "Tasks" and then select "Export Data..." Follow the instructions.

Post back if you have any issues.

buddylee17 216 Practically a Master Poster

Oh, SQL Server Management Studio didn't install. Which version did you install? Standard? Express? As long as it wasn't the Express edition, you should be able to install SSMS. If you installed Express, follow JuhaW's instructions above and install the scaled down Express version.
It should have installed on it's own, but there are known issues:
http://aspadvice.com/blogs/name/archive/2007/09/24/Installing-SQL-Server-Management-Studio-with-SQL-Server.aspx

buddylee17 216 Practically a Master Poster

I'm guessing you are coming from a SQL 2000 environment. If you want to write a query, just click the New Query button. You can also analyze the query in the Database Engine Tuning Advisor (Tools->Database Engine Tuning Advisor).

buddylee17 216 Practically a Master Poster

The lock is written into the query. You'll need to check into the correct syntax for your specific database.

buddylee17 216 Practically a Master Poster
buddylee17 216 Practically a Master Poster

Why do you need regex for this? Can you not use basic string functions like LEFT, MID, and RIGHT?

buddylee17 216 Practically a Master Poster

You could also do this with frames

buddylee17 216 Practically a Master Poster
buddylee17 216 Practically a Master Poster

Here's a tutorial. Make sure you add the COM reference that it talks about in the first paragraph.

This is what it showed for my machine:

C:
  Type:            Fixed
  File System:     NTFS
  Free Space:      189465538560
  Total Size:      249933357056
  Volume Name:     
  Serial Number:   -736547909
--------------------
D:
  Type:            CDRom
  Not ready
--------------------
E:
  Type:            Removable
buddylee17 216 Practically a Master Poster

Well, if the uid is a numeric datatype, you could use:

SELECT COUNT(uid) FROM tracking WHERE uid = $trackuid

If not numeric, you'll have to surround with quotes:

SELECT COUNT(uid) FROM tracking WHERE uid = "$trackuid"
buddylee17 216 Practically a Master Poster

I will restrain from lecturing on normalization. I assume you've probably never heard of it but I'd highly recommend looking into it.

What does your insert look like?

buddylee17 216 Practically a Master Poster

Count is an aggregate function. It's not going to return anything from the database. It's only going to count the number of records matching your criteria and return the total.

buddylee17 216 Practically a Master Poster

Echo the variable into the xml.

<?php $imagea= 'http://localhost/personal_trainer_system/images/Bench.jpg'?>;

myImage['blue'] = new Image();
myImage['blue'].src = <?php echo $imagea; ?>;
buddylee17 216 Practically a Master Poster

You'll either have to give the xml file a .php extension, or set Apache to parse php in xml files. This can be done with the http.conf file or with a .htaccess file. If you don't have access to the server, .htaccess may be the only way for you to do this.
After setting the server, you'll then be able to make the xml file dynamic by adding the necessary php scripts.

buddylee17 216 Practically a Master Poster

By default, divs are block level elements, and won't allow other elements to lay next to them. You can fix this by setting the inner divs style to either float:left and float:right, or you can use display:inline for both. If you use display:inline, make sure that the sum of the width of your inner divs is slightly less than your main div.

buddylee17 216 Practically a Master Poster

Change your css back to what you had before and then add this:

ul ul{
padding-left:20px
}

Adjust the padding to your needs.

buddylee17 216 Practically a Master Poster

Your code is correct. The problem is the * in the css. Particularly the padding. With

* {
margin: 0;
padding: 0;
}

you've reset the padding of all elements to 0. By default, the browser adds padding-left to the second list. However, you've reset the padding to 0, so the list doesn't get the padding. Delete padding:0; from the * element css and you'll see your list get padded properly.

buddylee17 216 Practically a Master Poster

Use substr function. Note, I also used strpos in the example to ensure that the last word isn't broken up.

<?php
$str="The quick lazy fox jumps over a lazy dog.";
$space=" ";
$sppos=strpos($str,$space,10);
$str=substr($str,0,$sppos);
$str.=" ...";
echo $str;
?>

Example without strpos:

<?php
$str="The quick lazy fox jumps over a lazy dog.";
$str=substr($str,0,14);
$str.=" ...";
echo $str;
?>
buddylee17 216 Practically a Master Poster

Sometimes it's easier to tell php which html to send to the client, based on a condition. Simple example:

<?php
$show="invalid";
if($show=="valid"){
?>
<div>You get to see this content</div>
<?php
}else{
?>
<div>Error: Access Denied</div>
<?php
}
?>

In this example, the only thing outputted to the client would be "Error: Access Denied".
So you could do something like this:

$result = mysql_query("SELECT * FROM clients WHERE clientID=$_POST[clientID]");
$num_rows = mysql_num_rows($result);
if($num_rows>0){
while($row = mysql_fetch_array($result))
  {
  print "Hi";
  echo(" ");
  echo $row['firstname'] . " " . $row['surname'];
  echo(" ");
  echo("welcome back you can change your booking using the form below  ");
  echo "<br />";
  }
?>
<form>
<table>
<tr><td>Form stuff here</td></tr>
</table>
</form>
<?php
}else{
?>
Error: The client ID is invalid. Please click back button and try again.
<?php
}
?>
</body>
</html>
buddylee17 216 Practically a Master Poster
buddylee17 216 Practically a Master Poster

Yes, the same for more fields. Basically, if you add a text field into the form, you'll need to update the javascript variable, postr on line 52 above so that it will send the value to the php file.

Also, for better design, the javascript should be placed in an external .js file (for better organization and so it can be cached) and called from the head of the document.

buddylee17 216 Practically a Master Poster

Actually, I modified your query to test the code in my db prior to posting and it outputted "No rows retrieved'". Also, when I run the code like so:

$sql = 'SELECT * FROM `absent faculty table` WHERE absentid = "blah"'; 
$result=mysql_query($sql,$conn);
$num_rows = mysql_num_rows($result);
echo $num_rows;

it returns 0 every time.

Have you got an error in your query?

OmniX commented: Thanks helped me find my problem! +2
buddylee17 216 Practically a Master Poster

Rewrite rules don't actually hide the query string. Rewrite rules pretty much convert seo friendly urls into the actual query string.
Example .htaccess:

RewriteEngine on 
RewriteRule ([^/\.]+)/?.html$ viewPage.php?ID=$1 [L]

The above rewrite rule will allow you to do something like this:
url reads: yoursite.com/DaniWeb.html
apache interprets as: yoursite.com/viewPage.php?ID=DaniWeb
Therefore

<?php
$id=$_GET['ID'];
echo $id;
?>

will output DaniWeb.

Shanti C commented: Thanks Man... +3
buddylee17 216 Practically a Master Poster

You have to get the number of rows.

$a = "SELECT * FROM a WHERE b = c";
$b = mysql_query($a);
$num_rows = mysql_num_rows($b);
if($num_rows == 0) {
 echo "No rows retrieved";
} else {
 echo "Rows retrieved";
}

Is that what you were asking?

buddylee17 216 Practically a Master Poster

Here is a simple AJAX form submission using POST. It basically sends the first and last name to the server, and the server outputs the form information and the date on the server. Very simple, but easy to build on.
post.php:

<?php
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$today = date("m/d/Y");
//send output back to page.
echo "Hello $FirstName $LastName. Todays date is $today.";
?>

html file(name it whatever you want):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" language="javascript">
   var http_request = false;
   function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('myspan').innerHTML = result;            
         } else {
            alert(http_request.status);
         }
      }
   }
   
   function get(obj) {
      var poststr = "FirstName=" + encodeURI( document.getElementById("FirstName").value ) +
                    "&LastName=" + encodeURI( document.getElementById("LastName").value );
      makePOSTRequest('post.php', poststr);
   }
</script>
</head>
<body>
<form action="javascript:get(document.getElementById('myform'));" name="myform" id="myform">
<input type="text" id="FirstName" />
<input type="text" id="LastName" />
<input type="Submit" value="Submit" /> …
nav33n commented: Good example.. +10
buddylee17 216 Practically a Master Poster

Have you added a loop to display the output?

<cfquery name="players" datasource="connsilvereagles">
SELECT *
FROM player
ORDER BY playernumber DESC</cfquery>

<cfoutput>
<table>
<cfloop query="players">
<tr><td>#playernumber#</td></tr>
</cfloop>
</table>
</cfoutput>
peter_budo commented: Good job +15
buddylee17 216 Practically a Master Poster

The file is included inline and parsed just like the contents of the file would be if they were placed there instead. A standard include for the content could be something like:
content.php:

<div class="content">
<?php echo $content;?>
</div>

Then the page could be something like:

<?php
//query db and populate $content variable here.
?>
<html>
<head><title>Page</title></head>
<body>
<?php include "content.php";?>
</body>
</html>

The above would display the same output as:

<?php
//query db and populate $content variable here.
?>
<html>
<head><title>Page</title></head>
<body>
<div class="content">
<?php echo $content;?>
</div>
</body>
</html>

You should also consider using includes for things that are common throughout the site, like the navigation menu. This way, if you have 50 pages on the site and you want to add a link to the navigation menu, you only have to change one file, instead of 50.

buddylee17 216 Practically a Master Poster

Please review the Member Rules, specifically the "Keep it Organized" section regarding proper use of code tags. Without the tags, there is no toggle plain text option, and most of us will not bother troubleshooting.

buddylee17 216 Practically a Master Poster

Either disable html messages or look into using BBCode

buddylee17 216 Practically a Master Poster

Use captcha.

buddylee17 216 Practically a Master Poster

You've got to make it a link:

$link = "<a href='".BASE_URL . 'activate.php?x=' . urlencode($e) . "&y=$a'>".BASE_URL."</a>";
buddylee17 216 Practically a Master Poster

What does echo $link; output?

buddylee17 216 Practically a Master Poster

So are you wanting the link content to fill the white box?

buddylee17 216 Practically a Master Poster

So did you get everything to work?

buddylee17 216 Practically a Master Poster

I would need a link to the page to see exactly what's happening, but yes it can be done with javascript.

buddylee17 216 Practically a Master Poster

You need to integrate a server side language such as php/asp/jsp/coldfusion to automatically update the database. You shouldn't be creating a new page for each user. You should have one template filled with variables that are populated by the database.

buddylee17 216 Practically a Master Poster

Well are you trying to compare the value of $lengths[2] to 25 or set $lengths[2] equal to 25?

if ($lengths[2] = 25) {

This code is resetting the value of $lengths[2] to 25 and will result in the if statement being true every time. If you want to compare $lengths[2] to 25, use:

if ($lengths[2] == 25) {

The same applies to $lengths[3].

buddylee17 216 Practically a Master Poster

Look into using sessions for authentication. Basically the idea is:

<?php
session_start();
if($_SESSION['loggedIn']==true){
echo "This content will only be viewable for users who are logged in";
}
else{
echo "You are not logged in";
}?>