Jump to content

PLs can someone help!


dejai

Recommended Posts

 

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.