Jump to content

[SOLVED] Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htd


beboo002

Recommended Posts

i con't understand this problem

 

<?php

if($_POST['Submit2']!="") {

$link=mysql_connect("localhost","root","");

if(!$link) die("can not connect to mysql");

mysql_select_db("timesheet",$link);

/////////////////////////////////////////fetch/////////////////////////////

$sql2="select firstName,lastname,address,officeemail,otheremail,phoneno,mobileno,panno,bloodgroup,department,designation,manager,dateofjoining from employeeinfo where name ='".$_POST['text2']."'";

$result2=mysql_query($sql2,$link);

//$query1=mysql_fetch_array($result1);

echo "<table border=1 align = center>

<tr>

<th>firstName</th>

<th>lastname</th><th>address</th>

<th>officeemail</th><th>otheremail</th>

<th>phoneno</th><th>mobileno</th>

<th>panno</th><th>bloodgroup</th><th>deportment</th>

<th>designation</th><th>manager</th><th>dateofjoining</th></tr>";

while($row1 = mysql_fetch_array($result2))

{

  echo "<tr><td>";

  echo $row1['firstName'];

    echo "</td>";

echo "<td>";

  echo $row1['lastname'];

echo "<td>";

  echo $row1['address'];

echo "<td>";

  echo $row1['officeemail'];

echo "<td>";

  echo $row1['otheremail'];

echo "<td>";

  echo $row1['phoneno'];

echo "<td>";

  echo $row1['mobileno']; 

echo "<td>";

  echo $row1['panno'];

echo "<td>";

echo $row1['bloodgroup'];

 

echo "<td>";

  echo $row1['department'];

echo "<td>";

  echo $row1['designation'];

echo "<td>";

echo $row1['manager'];

 

echo "<td>";

  echo $row1['dateofjoining'];

 

    echo "</td></tr>";

  }

echo "</table>";

 

mysql_close($link);

}

?>

Link to comment
Share on other sites

Change:

$result2=mysql_query($sql2,$link);

 

to:

$result2=mysql_query($sql2,$link) or die("Error: ". mysql_error(). " with query ". $sql2);

 

And if it's not obvious what needs to be fixed, post the result of that change here.

Link to comment
Share on other sites

Do you mean you no longer get the 'not a valid ...' error message?  I assume means that you corrected something in your script. If so, we need to see what you now have assuming you mean the script works but does not display any data even though you have data in the table.

 

If I misunderstood, what's the present problem?

Link to comment
Share on other sites

i hav emplyee info table in mysql i want to fetch the record in table and store something like this

firstName lastname address officeemail otheremail phoneno mobileno panno bloodgroup deportment designation manager dateofjoining

           

table is printing but record are not found

thats my problem where goes my record for above code i hav change in my where cluse officeemail insted of name.

Link to comment
Share on other sites

After you define your query string ($sql2), add a new line of code:

 

echo $sql2;

 

Then you'll know for certain just what query is being passed to the database.  If that doesn't make the solution obvious, post what output it gives.

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.