Problems using local server
Posted by: Macromac (213.166.210.---)
Date: July 10, 2006 10:09PM

Hi,
I have just attended a small course in PHP. There I was able to start to be amazed by PHP!
However at home I have installed WAMP, no problem, and am now trying to run my course files to further modify them.
But I get the following error message
"Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\wamp\www\stage\immo.php on line 19"

Here is the code from immo.php
case "Identify" :
$login=$_POST['Login'];
$password=$_POST['Password'];
//echo "parameters:".$_POST['User'].$_POST['Login'].$_POST['Password'].$_POST['First_name'].$_POST['Surname'];
$query="Select * from User where Login='".$Login."' and Password='".$Password."'";
$result=mysql_query($query);
$found=mysql_num_rows($result);
if($found!=0)
{
$tbs=new clsTinyButStrong;
$tbs->LoadTemplate('welcome.htm');
while ($row= mysql_fetch_array($result))
{
$First_name= $row['First_name'];
$Surname= $row['Surname'];
$Password= $row['Password'];
$User= $row['User'];
}
$query2= "Select * from bien";
$tbs->MergeBlock('blk',$connection,$query2);
$tbs->Show();
}
else
{
echo "<body bgcolor=#FF0000>";
echo "<center><br><br>";
echo "<font face=Verdana, Arial, Helvetica, sans-serif size=6><strong>";
echo "You are not allowed to view this information";
echo "</strong></font>";
echo "</center>";
echo "</body>";
}

break;

Can someone please help. And where can I find a good tutorial for installing a local server in case mine is not configured correctly.

Thanks

Paul

Options: ReplyQuote
Re: Problems using local server
Posted by: CyberSpatium (67.170.181.---)
Date: July 11, 2006 03:17AM

you only use case when you are using switch. before you can use mysql_query you need to connect to mysql first.

<?php

$dbuser = 'root';
$dbpass = '_Your_Password_Here_';
$dbhost = 'localhost';
$dbbase = '_Your_Database_Here_';


$dblink = mysql_connect($dbhost, $dbuser, $dbpass) or die('Unable to connect to MySQL server');
$dbconnect = mysql_select_db ($dbbase, $dblink) or die(mysql_error());


$query = "SELECT * FROM User WHERE Login='" . $Login . "' AND Password='" . $Password . "'";
$result = mysql_query($query, $dblink);
$found = mysql_num_rows($result);

if($found != 0)
{
$tbs=new clsTinyButStrong;
$tbs->LoadTemplate('welcome.htm');
while ($row= mysql_fetch_array($result))
{
$First_name= $row['First_name'];
$Surname= $row['Surname'];
$Password= $row['Password'];
$User= $row['User'];
}
$query2= "Select * from bien";
$tbs->MergeBlock('blk',$connection,$query2);
$tbs->Show();
}
else
{
echo "<body bgcolor=#FF0000>";
echo "<center><br><br>";
echo "<font face=Verdana, Arial, Helvetica, sans-serif size=6><strong>";
echo "You are not allowed to view this information";
echo "</strong></font>";
echo "</center>";
echo "</body>";
}

?>

Options: ReplyQuote


Sorry, only registered users may post in this forum.