hello friend i have two table studentlogin and seconed studentinfo
i want that when student login i like to select rollno from student login table
in student login there is four field sloginid, rollno, username and password
now when rollno fetched succesfully from studentlogin table i like to fetch s_id from studentinfo where rollno will equal to studentlogin table, in studentinfo table here also rollno column.
and i used this query but it give error
Unknown column '0818cs091040' in 'where clause'
it is giving this erro
Unknown column '0818cs091040' in 'where clause'
here is code that i used
<?php
session_start();
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("sfcs") or die(mysql_error());
$loginid=$_SESSION['logid'];
$sql="select rollno from studentlogin where sloginid=".$loginid;
$query = mysql_query($sql) or die(mysql_error());
$num = mysql_num_rows($query);
if($num >0)
{
while($rows = mysql_fetch_object($query))
{
$rollno=$rows->rollno;
}
$sql="select s_id from studentinfo where roll_no=".$rollno or die(mysql_error());
$query = mysql_query($sql) or die(mysql_error());
$num = mysql_num_rows($query);
if($snum >0)
{
while($rows = mysql_fetch_object($query))
{
$sid=$rows->s_id;
}
}
}
?>