Jump to content


Id DATABASE selection


3 replies to this topic

#1 Philcey

    Young Padawan

  • Members
  • Pip
  • 4 posts

Posted 18 July 2005 - 03:22 PM

I am trying to code a theme shop module, I cant find out how to make my second function (themeview) find out what ID is in the title and collect all the columbs data for that row, please help me..

<?php
global $modulefile;
if ((eregi("index.php", $_SERVER['SCRIPT_NAME'])) || (!eregi("".$modulefile.".php", $_SERVER['SCRIPT_NAME']))) { header("location:../../index.php"); }
includelang($modulename, "module"); // includes module language if exists

############ 
## Global ##
############



function index(){
global $modulefile, $modulename, $db, $prefix, $dblinkscat;
Head();
modulelogo($modulename);

$db->sql_query("SELECT * FROM tscat");
$result = mysql_query("SELECT * FROM tscat");
while($r=mysql_fetch_array($result))
{
$title=$r["title"];
$description=$r["description"];
$id=$r["ID"];

OpenTable();

echo"<table width=\"70%\">"
  . "               <td class=\"tabletop\" width=\"20%\">Theme Name </a></b></td>"
  . "                <td class=\"tabletop\" width=\"50%\">Description</a></b></td>"
  . " 	 </tr>"
  . "  <tr>"
  . " 	 <td class=\"row1\" width=\"20%\"><a href=\"".$modulefile.".php?load=$modulename&function=themeview&id=" . $id . "\">$title"
  . " 	 <td class=\"row1\" width=\"50%\">$description</td>"
  . "       </table></td>"
 ."";



CloseTable();
}
Foot();
}


function themeview(){
global $modulefile, $modulename, $db, $prefix, $dblinkscat;
Head();
modulelogo($modulename);

*** CODE MISSING ****




OpenTable();

echo "

<table width=100% border=0 cellspacing=3 cellpadding=0>
<tr>
<td>$tuts3[message]</td>
</tr>
</table>


";


CloseTable();

}
Foot();
}





###########
## Cases ##
###########
switch($function) {

    default:
    index();
    break;
	
	case "themeview":
	themeview();
	break;
	
	case "addlink":
	addlink($title, $url, $catid, $info);
	break;
	
}
?>


#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 18 July 2005 - 06:25 PM

First off, what title?
Second, if you didn't write that, you should probably ask the creator's of the script how to do what you're asking. If you did write it, then you should also know the answer to your question, or think about a new hobby :lol:

#3 Philcey

    Young Padawan

  • Members
  • Pip
  • 4 posts

Posted 20 July 2005 - 04:44 PM

i ment url, so it finds out the id in the url and then does a query on all data the columbs in the ids row

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 20 July 2005 - 06:00 PM

Then just use $_GET['id'] run a mysql_query similar to:
mysql_query("SELECT * FROM table_name WHERE col_name = ".$_GET['id']);





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users