what you have in found is a pointer to the query itself, you need to pull the data from that try this

<?php
    echo "Thank you for submitting " . mysql_result($found,0,0) . "<br />\n";
?>

    Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\program files\easyphp1-7\www\mysql1\testing.php on line 40

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in c:\program files\easyphp1-7\www\mysql1\testing.php on line 42
    Thank you for submitting
    .

    any other ideas?

      Hey I am willing to help, but could you please tell me how you are getting the data to insert into the database? Is it coming off of an HTML form, or are you just inserting static data?

        i have never known the reason why sometimes it doesn't work, as in the past when i have tried mysql_num_rows i have had the same problem...
        usually it only affects num_rows and not any other query

        if you want to try a replacement for the num_rows you can try this:

        $numofrow = mysql_query("SELECT COUNT(*) FROM res") or die(mysql_error());
        

        not sure whether you need to get it from the resource with a fetch_array or not

          mparker-im using just plain data, if u have read above, u would have noticed. im not working MySQL from forms yet, since im a starter with it

          helz-i dont wanna find the row number, i just want it to pick DXL from the database

            sorry thats me getting confused 🙂

            change:
            mysql_fetch_row to mysql_fetch_array
            and see if that works

              Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\program files\easyphp1-7\www\mysql1\testing.php on line 40
              Thank you for submitting your resource, .

              ummm...this is really starting to get on my nerves

                try this:

                $found = mysql_query("SELECT author FROM res WHERE title = 'Darth'") or die(mysql_error()); 
                $found1 = mysql_fetch_array($found);
                $found = $found1[0];
                echo "Thank you for submitting your resource, ".$found.".";
                

                  Okay bud, this is what you need to do... Use this script to retreive the data you had inserted with your last script...

                  // Declare Database Connection Variables // 
                  $user = "yourUserName"; 
                  $pass = "yourPassword"; 
                  $database = "test";
                  $host = "localhost"; 
                  
                  // Establish A Connection //
                  $connection = @mysql_connect($host,$user,$pass) or die("Could not connect to MySQL<br><br>ERROR:'" . mysql_error() . "'");
                  $db = mysql_select_db($database,$connection) or die ("Could not open database"); 
                  
                  // Obtaining the Data //
                  $SQL = "SELECT title FROM res WHERE title = 'Darth'"; 
                  $result = @mysql_query($SQL, $connection) or die("Could not execute query.");
                  $nums = @mysql_num_rows($result); 
                  
                  // If a record was found Display It //		
                  if($nums) {
                  	$data = mysql_fetch_array($result);
                  	echo $data['title'];
                  	} else {
                  		echo "Sorry no records were found...";
                  		}
                  

                  Remember to change the variables at the top and Let me know how it goes...

                    helz-"Table 'test.res' doesn't exist" was the result i got

                    mparker-"Could not execute query." was my result there

                      Originally posted by DXL
                      helz-"Table 'test.res' doesn't exist"

                      Okay,

                      That is telling you that the table called res does not exist. Are you sure there is a Database named test with a table in it called res that is storing your data?

                        sorry i got res as the table name from your original post at the start of the thread, so really the code is correct its just that your code for creating the table is wrong...

                          Write a Reply...