dejai Posted September 19, 2009 Share Posted September 19, 2009 here is the code i keep getting a warning - Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource $connect_mysql = mysql_connect($server, $servername, $password); $db = "royaleng_solutionplus"; $mysql_db = mysql_select_db($db); $sql_disp =("SELECT * FROM student_details WHERE 'Parent_email'=". $_POST['usr']." && password=".$_POST['pw']); $result= mysql_query($sql_disp); echo"<tr ><DIV ALIGN=CENTER><h1>DETAILS OF REGISTRATION FORM</h1></DIV></tr>"; echo"<table border=1 color=brown ALIGN=CENTER> "; echo "<tr><h5><td><B>FIRST NAME</td><td><B>LAST NAME</td><td><B>SEX</td><td><B>Date of birth</td><td><B>Country</td><td><B>Origin</td><td><B>School</td><td><B>Class</td><p><p><p><p><p><p><td>Registration Status<B></td></tr>"; while($row = mysql_fetch_array($result)) echo"<tr>"; echo"<td> $row[First_Name]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Last_Name]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[sex]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Date_Birth]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Country]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Origin]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[school]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Class]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Reg_Status]</td>"; echo"</tr>"; echo"</table>"; echo"</table>"; ?> Link to comment https://forums.phpfreaks.com/topic/174794-pls-can-someone-help/ Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 Remember to use code tags when posting... try replacing this: $sql_disp =("SELECT * FROM student_details WHERE 'Parent_email'=". $_POST['usr']." && password=".$_POST['pw']); to this: $sql_disp =("SELECT * FROM student_details WHERE Parent_email=''". $_POST['usr']." && password='".$_POST['pw']."'"); Link to comment https://forums.phpfreaks.com/topic/174794-pls-can-someone-help/#findComment-921173 Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 I just realised... where is $row = mysql...... etc?? edited: nevermind... to hard to read when not in code tags... Link to comment https://forums.phpfreaks.com/topic/174794-pls-can-someone-help/#findComment-921177 Share on other sites More sharing options...
dejai Posted September 19, 2009 Author Share Posted September 19, 2009 I tried this but it still does not work <?php $server ="********"; $servername = "*********"; $password="******"; $user=$_POST['usr']; $pass=$_POST['pw']; $connect_mysql = mysql_connect($server, $servername, $password); $db = "royaleng_solutionplus"; $mysql_db = mysql_select_db($db); $sql_disp =("SELECT * FROM student_details WHERE Parent_email=''". $_POST['usr']." && password='".$_POST['pw']."'"); $result= mysql_query($sql_disp); echo"<tr ><DIV ALIGN=CENTER><h1>DETAILS OF REGISTRATION FORM</h1></DIV></tr>"; echo"<table border=1 color=brown ALIGN=CENTER> "; echo "<tr><h5><td><B>FIRST NAME</td><td><B>LAST NAME</td><td><B>SEX</td><td><B>Date of birth</td><td><B>Country</td><td><B>Origin</td><td><B>School</td><td><B>Class</td><p><p><p><p><p><p><td>Registration Status<B></td></tr>"; while($row = mysql_fetch_array($result)) echo"<tr>"; echo"<td> $row[First_Name]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Last_Name]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[sex]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Date_Birth]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Country]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Origin]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[school]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Class]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Reg_Status]</td>"; echo"</tr>"; echo"</table>"; echo"</table>"; ?> Link to comment https://forums.phpfreaks.com/topic/174794-pls-can-someone-help/#findComment-921191 Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 removed - double posting his question Link to comment https://forums.phpfreaks.com/topic/174794-pls-can-someone-help/#findComment-921196 Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 removed - double posting his question Link to comment https://forums.phpfreaks.com/topic/174794-pls-can-someone-help/#findComment-921198 Share on other sites More sharing options...
work_it_work Posted September 19, 2009 Share Posted September 19, 2009 try to change to this code: $connect_mysql = mysql_connect($server, $servername, $password); $db = "royaleng_solutionplus"; $mysql_db = mysql_select_db($db); $sql_disp =("SELECT * FROM student_details WHERE 'Parent_email'=". $_POST['usr']." && password=".$_POST['pw']); $restult = mysql_query($sql_disp); or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo"<tr ><DIV ALIGN=CENTER><h1>DETAILS OF REGISTRATION FORM</h1></DIV></tr>"; echo"<table border=1 color=brown ALIGN=CENTER> "; echo "<tr><h5><td><B>FIRST NAME</td><td><B>LAST NAME</td><td><B>SEX</td><td><B>Date of birth</td><td><B>Country</td><td><B>Origin</td><td><B>School</td><td><B>Class</td><p><p><p><p><p><p><td>Registration Status<B></td></tr>"; echo"<tr>"; echo"<td> $row[First_Name]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Last_Name]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[sex]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Date_Birth]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Country]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Origin]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[school]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Class]</td>"; echo"</tr>"; echo"<tr>"; echo"<td> $row[Reg_Status]</td>"; echo"</tr>"; echo"</table>"; echo"</table>"; }?> Link to comment https://forums.phpfreaks.com/topic/174794-pls-can-someone-help/#findComment-921212 Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 it is the sql query itself. $sql_disp =("SELECT * FROM `student_details` WHERE `Parent_email`='". $_POST['usr']."' && `password`='".$_POST['pw']."'"); Link to comment https://forums.phpfreaks.com/topic/174794-pls-can-someone-help/#findComment-921226 Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 haha I am soooo sorrryyyyy. well, you should be too $restult = mysql_query($sql_disp); or die(mysql_error()); while($row = mysql_fetch_array($result)) { change to $result = mysql_query($sql_disp); or die(mysql_error()); while($row = mysql_fetch_array($result)) { Link to comment https://forums.phpfreaks.com/topic/174794-pls-can-someone-help/#findComment-921286 Share on other sites More sharing options...
ozestretch Posted September 21, 2009 Share Posted September 21, 2009 I got your PM dejai, if you post it here others can help too. Your PM said it responds with unknown user/password... check your $_POST names and make sure they are the same as the form fields your are using. Link to comment https://forums.phpfreaks.com/topic/174794-pls-can-someone-help/#findComment-921990 Share on other sites More sharing options...
redarrow Posted September 21, 2009 Share Posted September 21, 2009 post your current code please cheers. Link to comment https://forums.phpfreaks.com/topic/174794-pls-can-someone-help/#findComment-921991 Share on other sites More sharing options...
ozestretch Posted September 21, 2009 Share Posted September 21, 2009 he has started anotherpost for this http://www.phpfreaks.com/forums/index.php/topic,269981.0.html :anim_rules: Link to comment https://forums.phpfreaks.com/topic/174794-pls-can-someone-help/#findComment-922271 Share on other sites More sharing options...
Zane Posted September 23, 2009 Share Posted September 23, 2009 Thread locked for double posting.. to be continued on aforementioned thread. Link to comment https://forums.phpfreaks.com/topic/174794-pls-can-someone-help/#findComment-923283 Share on other sites More sharing options...
Recommended Posts