i am not getting the value in $sql2. so can anyone please....
thank u
$sql2="select allocatedmemory from projects where projectname='$projectassign'";
mysql_error();
$data1=mysql_query($sql2);
echo '$data1';
i am not getting the value in $sql2. so can anyone please....
thank u
$sql2="select allocatedmemory from projects where projectname='$projectassign'";
mysql_error();
$data1=mysql_query($sql2);
echo '$data1';
Try this.
$sql2="select allocatedmemory from projects where projectname='$projectassign'";
$data1=mysql_query($sql2) or die(mysql_error());
echo '$data1';
[edit]
Oops, and the echo will need changing to suit your purposes. What are you trying to do on the echo line, trying to display allocatedmemory? If so then try the following
$sql2="select allocatedmemory from projects where projectname='$projectassign'";
$result=mysql_query($sql2) or die(mysql_error());
$data1=mysql_result($result,0);
echo $data1;
[/edit]
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 6 in C:\Program Files\Apache Group\Apache2\htdocs\Project\upload.php on line 50
$data1
Yes I received your pm and the reason for that bug would be because the query returns zero results (no rows). So to solve this use the following:
$sql2="select allocatedmemory from projects where projectname='$projectassign'";
$result=mysql_query($sql2) or die(mysql_error());
if (mysql_num_rows($result)>0) {
$data1=mysql_result($result,0);
} else {
$data1='No data.';
}
echo $data1;
hey if i executed the same sql in mysql i am getting the value. but now it is displaying No Data.
Perhaps $projectassign isn't it's expected value.
Perhaps $projectassign isn't it's expected value.
i think the error might be here
$data1=mysql_result($d,0);
i think the error might be here
$data1=mysql_result($d,0);
Did you read my previous example fully as that code has a bug in it if your following my example. Not that that particular line would effect the if statement.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.