samsbc12 Posted May 26, 2006 Share Posted May 26, 2006 This is the display page and when you click the edit link it opens up the edit.php but i can not get the text to display in the form of the edit page[code]<? $username="******"; $password="******"; $database="******"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM links"; $result=mysql_query($query); //Count Number of rows in table $num=mysql_numrows($result); //Close Connection mysql_close(); //loop through $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $category=mysql_result($result,$i,"category"); $name=mysql_result($result,$i,"name"); $description=mysql_result($result,$i,"description"); $link=mysql_result($result,$i,"link"); $mirror=mysql_result($result,$i,"mirror"); echo "<b>Category:</b> $category <br> Title: $name<br> Description: $description<br> <a href =\"$link\"> -Link-</a>"; if($mirror != ""){ echo"<a href =\"$mirror\"> -mirror-</a>"; } echo"<a href =\"edit.php?id=$id\"> -Edit-</a>"; echo"<br><br>"; $i++; } ?>[/code]edit.php[code]id does however display because its passed in the url<? $id=$_GET['id']; $username="******"; $password="******"; $database="******"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query=" SELECT * FROM links WHERE id='$id'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $id = mysel_result($result, $i, "id"); $category=mysql_result($result,$i,"category"); $name=mysql_result($result,$i,"name"); $description=mysql_result($result,$i,"description"); $link=mysql_result($result,$i,"link"); $mirror=mysql_result($result,$i,"mirror"); ++$i; } ?> <form action="update.php" method="post"> <div align="left"><br> <br> <br> <table width="730" border="0"> <tr> <td align="right" valign="top"><strong>Id: </strong></td> <td valign="top"><input type="text" disabled="disabled" name="id" value="<? echo $id; ?> "></td> </tr> <tr> <td align="right" valign="top"><strong>Category: </strong></td> <td valign="top"><input name="category" type="text" value="<? $category; ?>"></td> </tr> <tr> <td align="right" valign="top"><strong>Name: </strong></td> <td valign="top"><input type="text" name="name" value="<? echo $name; ?>"></td> </tr> <tr> <td align="right" valign="top"><strong><br> Description: </strong></td> <td valign="top"><textarea name="description" cols="40" rows="8" ><? echo $description; ?></textarea></td> </tr> <tr> <td align="right" valign="top"><strong>Link: </strong></td> <td valign="top"><input type="text" name="link" value="<? echo $link; ?>"></td> </tr> <tr> <td align="right" valign="top"><strong>Mirror: </strong></td> <td valign="top"><input type="text" name="mirror" value="<? echo $mirror; ?>"></td> </tr> <tr> <td align="right" valign="top"> </td> <td valign="top"><input name="Submit" type="Submit"></td> </tr></table> <br><br> </div> </form>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10531-pulling-data-from-the-mysql-data-base/ Share on other sites More sharing options...
freakus_maximus Posted May 26, 2006 Share Posted May 26, 2006 You have a mispelling in this bit of code.Change this: [code] $id = mysel_result($result, $i, "id");[/code]to this:[code]$id = mysql_result($result, $i, "id");[/code]Other than that I did not see anything else wrong. Quote Link to comment https://forums.phpfreaks.com/topic/10531-pulling-data-from-the-mysql-data-base/#findComment-39263 Share on other sites More sharing options...
samsbc12 Posted May 26, 2006 Author Share Posted May 26, 2006 [!--quoteo(post=377380:date=May 26 2006, 03:02 PM:name=freakus_maximus)--][div class=\'quotetop\']QUOTE(freakus_maximus @ May 26 2006, 03:02 PM) [snapback]377380[/snapback][/div][div class=\'quotemain\'][!--quotec--]You have a mispelling in this bit of code.Change this: [code] $id = mysel_result($result, $i, "id");[/code]to this:[code]$id = mysql_result($result, $i, "id");[/code]Other than that I did not see anything else wrong.[/quote]thanks man i didnt even see that, is there a way to get php to echo the errors when the page doesnt load? Quote Link to comment https://forums.phpfreaks.com/topic/10531-pulling-data-from-the-mysql-data-base/#findComment-39265 Share on other sites More sharing options...
l33t_script3r Posted May 27, 2006 Share Posted May 27, 2006 [!--quoteo(post=377382:date=May 27 2006, 07:13 AM:name=samsbc12)--][div class=\'quotetop\']QUOTE(samsbc12 @ May 27 2006, 07:13 AM) [snapback]377382[/snapback][/div][div class=\'quotemain\'][!--quotec--]thanks man i didnt even see that, is there a way to get php to echo the errors when the page doesnt load?[/quote]i think you can use die() or mysql_error() not sure how to use them though... Quote Link to comment https://forums.phpfreaks.com/topic/10531-pulling-data-from-the-mysql-data-base/#findComment-39392 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.