Jump to content

[SOLVED] Warning: mysql_fetch_array() expects parameter 1 to be resource


justineaguas

Recommended Posts

I am using an array to check and compare the values in one variable, If the variable exists, the set of values will be inserted in the table of the variable. I am successful in inserting the values inside the mySQL table. However, I receive an error:

 

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\datbas\do_addpage_off.php on line 98

 

while ($row=mysql_fetch_array($result, MYSQL_ASSOC) or die(mysql_error())) //error here LINE 98
			{
				$temp=$row['BRGY_name'];
				if ($temp==$brgy)
				{
					include ('connect.php');
					$get = "SELECT BRGY_id FROM BRGY_info WHERE BRGY_name='$brgy'";
					$res = mysql_query($get) or die(mysql_error()) or die(mysql_error());
					$row = mysql_fetch_array($res, MYSQL_ASSOC);
					$sql = "INSERT INTO OFF_info(OFF_fname,OFF_lname,OFF_position,OFF_contact,BRGY_id,OFF_status)VALUES('$fname','$lname','$position','$contact','{$row['BRGY_id']}','$num')";
					$result = mysql_query($sql) or die(mysql_error());
					echo "
					<br /><br />
					<center>
					Thank you for adding a new barangay.<br />
					<span class='linkBody'>
					<a href='addpage.php'>Add Another?</a>
					</span>
					<br />
					<br />
					</center>";
				}

Link to comment
Share on other sites

change variable name $result to $resul1 in this

$sql = "INSERT INTO OFF_info(OFF_fname,OFF_lname,OFF_position,OFF_contact,BRGY_id,OFF_status)VALUES('$fname','$lname','$position','$contact','{$row['BRGY_id']}','$num')";
$result = mysql_query($sql) or die(mysql_error());

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.