Jump to content

Linking??


ec

Recommended Posts

I think i've got it working now using this

 

//Making sure that pupil number exists

//Check for duplicate pupil no

$qry = "SELECT count(*) AS c FROM pupil WHERE pupilno='$pupilno'";

$result = mysql_query($qry);

if($result) {

$result_array = mysql_fetch_assoc($result);

if($result_array['c'] < 1) {

$errmsg_arr[] = 'Pupil number is not in use';

$errflag = true;

}

@mysql_free_result($result);

}

else {

die("Query failed");

}

 

 

is there any eaiser way of doing it?

Link to comment
https://forums.phpfreaks.com/topic/97977-linking/#findComment-501333
Share on other sites

<?php

  $qry = "SELECT pupilno FROM pupil WHERE pupilno='$pupilno'";
  if ($result = mysql_query($qry)) {
    if (mysql_num_rows($result)) {
      $result_array = mysql_fetch_assoc($result);
    } else {
      $errmsg_arr[] = 'Pupil number is not in use';
      $errflag = true;
    }
  } else {
    die("Query failed");
  }

?>

Link to comment
https://forums.phpfreaks.com/topic/97977-linking/#findComment-501347
Share on other sites

Archived

This topic is now archived and is 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.