john666 Posted November 15, 2013 Share Posted November 15, 2013 Hi Guys Help ma in this Query 1st part is Working Fine but When i enter name it doesnt work i have 3 names in Database 1.Jason 2.Rooni 3.Jacob when i Press Jason it doesnt Give me result but when i Press just N its shows me 2 result if ($_REQUEST['search']) { $txt = addslashes($_REQUEST['search']); $query="select * from students WHERE stdrollno='$txt' OR stdname LIKE ('{$txt}%') "; $result = mysql_query($query); } And help me to understand these Lines some 1 make for me this lines but unable to get these lines if ($result) { $class_qry = "select * from classes "; $class_res = mysql_query($class_qry) or die(mysql_error()); if ($class_res) { while ($class = mysql_fetch_assoc($class_res)) { $class_list[$class['id']] = $class['name'];// This line i cant get All other Got what is actually happneing here } } } while ($row=mysql_fetch_assoc($result)) { ?> <tr> <td> <?php echo $row['stdname'];?> </td> <td> <?php echo $row['stdrollno'];?> </td> <td> <?php echo $row['stdfname'];?> </td> <td> <?php echo $class_list[$row['stdclass']];?> </td>// This Line too What is mean of that....... <td> <?php echo $row['stdcell'];?> </td> <td> <?php echo $row['stddob'];?> </td> <td> <?php echo $row['stdaddress'];?> </td> <td> <?php echo $row['stdfee'];?> </td> <td> <a href="std_update.php?student_id=<?php echo $row['sn'];?> ">Update</a> | <a href="std_delete.php?student_id=<?php echo $row['sn'];?>" onclick="return confirm('Do you really want to delete this student?');">Delete</a>| <a href="std_view.php?student_id=<?php echo $row['sn']; ?>">View</a> </td> </tr> Quote Link to comment https://forums.phpfreaks.com/topic/283903-query-help/ Share on other sites More sharing options...
kobryan Posted November 15, 2013 Share Posted November 15, 2013 It could be in your query where you would want to use " SELECT * FROM " not " select * from ". It has to be caps from what im told but im new so i could be wrong. Quote Link to comment https://forums.phpfreaks.com/topic/283903-query-help/#findComment-1458311 Share on other sites More sharing options...
KaiSheng Posted November 15, 2013 Share Posted November 15, 2013 It could be in your query where you would want to use " SELECT * FROM " not " select * from ". It has to be caps from what im told but im new so i could be wrong. It don't make any difference. Quote Link to comment https://forums.phpfreaks.com/topic/283903-query-help/#findComment-1458315 Share on other sites More sharing options...
john666 Posted November 15, 2013 Author Share Posted November 15, 2013 It could be in your query where you would want to use " SELECT * FROM " not " select * from ". It has to be caps from what im told but im new so i could be wrong. Bro its not Case sensitive so there is problem something else Quote Link to comment https://forums.phpfreaks.com/topic/283903-query-help/#findComment-1458333 Share on other sites More sharing options...
Barand Posted November 15, 2013 Share Posted November 15, 2013 (edited) In a previous post you gave your column names as 1..(sn)seriel number 2..std_name 3.std_father_name 3..std_roll_num 4..std_class 5..std_cell 6..std_address 7..std_dob 8..std_address 9..std_fee 1.class_id 2.class_name 3.date_created so in your last example above you need to reference $row['std_cell'] and not $row['stdcell']. The $row array indices will be the same as the column names. Similarly, in your second code, you need $class['class_id'] and $class['class_name'] Edited November 15, 2013 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/283903-query-help/#findComment-1458336 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.