Page 1 of 1

windows7 messages

PostPosted: 02. February 2011 19:14
by ckdoublenecks
All my system works flawlessly on my win 2000 and winXP machines. They also work on my windows7 machine but I get messages like the below each time. What must I do?

Notice: Use of undefined constant localhost - assumed 'localhost' in C:\xampp\htdocs\hofiles\tenantnumbers.php on line 2

Notice: Use of undefined constant root - assumed 'root' in C:\xampp\htdocs\hofiles\tenantnumbers.php on line 2

Notice: Use of undefined constant prerentdb - assumed 'prerentdb' in C:\xampp\htdocs\hofiles\tenantnumbers.php on line 3

Re: windows7 messages

PostPosted: 02. February 2011 19:26
by Altrea
That depends on your code.
Do you use constants by accident (forgotten single-quotes or $-sign)?
Or do you really want to use constants but your constants weren't defined well?

I think that would be clear if you show us your lines 2 and 3 of that file.

Re: windows7 messages

PostPosted: 02. February 2011 20:43
by ckdoublenecks
below is the code
Code: Select all
<?php
mysql_connect(localhost,root,"");
mysql_select_db(prerentdb) or die( "Unable to select database");
if(!empty($_POST["submit"]))
{
 $apt = $_POST['apt'];
 $query="SELECT * FROM payments Where apt='$apt'";
$result=mysql_query($query);
if(mysql_num_rows($result))
{
  echo "<form action='#' method='post'><b>Tenant Phone #s<br><br>";
  echo"<table border='0'>
<tr>
<th>Apt</th>
<th>Tenant</th>
<th>Phone#</th>
<th>Emergency#</th>
<th>Cell#</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['apt'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['phone'] . "</td>";
echo "<td>" . $row['ephone'] . "</td>";
echo "<td>" . $row['cell'] . "</td>";
echo "</tr>";
}
echo "</table>";
echo "</form>";
}
else{echo "no entry for apt $apt ...Select Another?";}
}
?>
<form method="post" action="#">
 <br />
 <input type="text" name="apt"/> <p>
<input type="submit" name="submit" value="selected apartment"/>
</form>

Re: windows7 messages

PostPosted: 02. February 2011 20:45
by Altrea
forgotten (single-)quotes.
try this:


Code: Select all
[...]
mysql_connect('localhost','root','');
mysql_select_db('prerentdb') or die( "Unable to select database");
[...]

Re: windows7 messages

PostPosted: 02. February 2011 21:08
by ckdoublenecks
It doesn't work at all your way

Re: windows7 messages

PostPosted: 02. February 2011 21:11
by Altrea
Then i can't help you. PHP is telling you lies :shock:

Re: windows7 messages

PostPosted: 02. February 2011 21:13
by ckdoublenecks
I forgot to state that I'm using new version of xampp on the windows7 machine ?

Re: windows7 messages

PostPosted: 02. February 2011 21:17
by Altrea
Doesn't matter. I use XAMPP Versions from 1.5.3 till actual 1.7.4 on my Windows 7 64 Bit and all are running fine.

PHP tells you, you use constants in line 2 and 3.
You have corrected that with the things of my post.
But your errors (notices) are the same as before.

So, PHP don't tell you the truth.
And at this point, noone can help you.