Jump to content

getting data from a table using form information from a different page


seany02

Recommended Posts

Im trying to spread information accross three pages. On the first page I have a form the collects a specific id. On the second page a table is generated displaying in brief the information from the dbtable. And on the third page more detailed data is displayed still using the id from the first page... Roughly.

The following is the code i'm using

 

$name=$_Post["secondtxt"]; 

$db = @mysql_connect("localhost","root","");

if (!$db)
{
do_error("Could not connect to the server");
}

// Connect to the database
@mysql_select_db("Rufus" ,$db)or do_error("Could not connect to the database");
// Run query

	$result = mysql_query("SELECT * FROM project WHERE projectid='$name' ORDER BY projectid",$connect);
	while($myrow = mysql_fetch_array($result))
             {
               echo "<b>Project ID: ";
               echo $myrow['projectid'];
               echo "</b><br>Project Name: <i>";
               echo $myrow['projectname'];
               echo "</i><hr align=left width=160>";
               echo $myrow['projectdescription'];
		   
              
               echo "<br><a href=\"pro_details.php?projectid=$myrow[projectid]\">Read More...</a>";
             }

?>

 

Currently i'm getting two parse errors from this:

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\xampp\htdocs\newsearch.php on line 62

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\newsearch.php on line 63

 

line 62 starts at $result.

 

Any help would be appreciated!

It looks like your mysql queries are not correct...

 

You have:

$result = mysql_query("SELECT * FROM project WHERE projectid='$name' ORDER BY projectid",$connect);

 

it should be:

$result = mysql_query("SELECT * FROM project WHERE projectid='$name' ORDER BY projectid");

 

I don't believe you need the $connect variable at the end of the query statement... I never do it like that anyway... Tye it, and it should clear up your issues. Make sure you correct any other query calls and take out the $connect variable.

 

This is the only that that I spotted while briefly looking over your code.

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.