I hope someone can help me. I seem to have multiple errors and hope that someone could give me some help on them.
I have the following fields in my input file form.html :
T_No, A_REG, Hrs_shown, L_shown , Correct_Hrs, Correct_L, Received_DATE , Amended_date and User_ID
my store.php file should receive the data, compare User_ID and also send User_ID and the above fields input into the database "hrs_test".
PLease note. User_ID should reference the original Primary key on another database called "User_data" under table"ID"field "ID_no". otherwise its not a valid user.
anyway my code is as follows for store.php
$query = "INSERT INTO Dis_reg(T_No, A_REG, Hrs_shown, L_shown , Correct_Hrs, Correct_L, Received_DATE , Amended_date)". //db
"VALUES ('$T_No', '$A_REG, '$Hrs_shown', '$L_shown', '$Correct_Hrs', '$Correct_L', '$Received_DATE', '$Amended_date')"; //-values of input field -->
//the white text fields to be entered into the table staff and to be pulled accross
$result = mysql_query($query);
if ( !$result )
{
echo ("<P>Error performing INSERT: " . mysql_error() . "</P>" );
}
$query = "SELECT T_NO, A_REG, Hrs_shown, L_shown, Correct_Hrs, Correct_L, Received_DATE, Amended_date, User_ID FROM Dis_reg";
$query = "INSERT User_ID FROM Dis_reg
WHERE User_ID='$User_ID' OR
User_ID='$1' OR
User_ID='$2' OR
User_ID='$3' OR
User_ID='$4'";
$result = mysql_query($query);
$maxrow = mysql_num_rows($result);
$T_No = mysql_result($result, $maxrow, "T_No");
$A_REG = mysql_result($result, $maxrow, "A_REG");
$Hrs_shown = mysql_result($result, $maxrow, "Hrs_shown"); //taken out of middle $endfile
$L_shown = mysql_result($result, $maxrow,"L_shown"); //$endfile,
$Correct_Hrs = mysql_result($result, $maxrow,"Correct_Hrs");
$Correct_L = mysql_result($result, $maxrow,"Correct_L");
$Received_DATE = mysql_result($result, $maxrow,"Received_DATE");
$Amended_date = mysql_result($result, $maxrow,"Amended_date");
$User_ID = mysql_result($result, $maxrow,"User_ID");
print( "<P>Technical no= " . $T_No . "<P>Tech No = " . $A_REG . "<P>Hours shown = " . $Hrs_shown . " <P>Leads Shown = " . $L_shown . " <p>Correct Hours = " . $Correct_Hrs . "<p>Correct Lead = " . $Correct_L . " <p>date received = " . $Received_DATE. "<p>Amended Date = " . $Amended_date</P>");
//mysql_close($session);
?>
well i get errors as follows:
1) mysql_num_rows(): supplied argument is not a valid MySQL result resource ""store.php on line 329
i am not sure why does it not like mysql_num_rows argument?
2) If the user types in an existing user ID e.g 1 - 4 then it also sends me an error saying i am inputting a duplicate info (i guess cos its a unique field and its assuming i am trying to save the same id no. How do i make the input user ID field compare with the user_id field on the database then write that id to the database? the user id field only works when i input a totally different number to the ones in the database.
3) it doesnt like my print command.. not sure why not?
Can anyone help? sorry its so long but i would appreciate any help you can offer.. thanks..