Jump to content

Help!


shyam13

Recommended Posts

I am trying to pull data from a database using the insect_id which is sent to the url, below is my code:

 

insect.php:

 

 

<?php

require_once('includes/php/require.php');

$insect = mysql::select('insects',NULL, condition::where('insect_vis')->is(1)->and(condition::where('insect_web')->is(2)));

if (isset($_GET['insect_id'])) $insect->condition->and(condition::where('insect_id')->is($_GET['insect_id']));

$insect = $insect->order('insect_slug asc')->limit(10)->execute()->row(0);

?><!DOCTYPE HTML>

<html>

<head>

 

<meta charset='utf-8'>

<title></title>

<meta name='description' content='' />

 

<script type='text/javascript' src='/includes/js/jquery.min.js'></script>

<script type='text/javascript' src='/includes/js/jquery-ui.min.js'></script>

<script type='text/javascript' src='/includes/js/index.js'></script>

 

<link href='/includes/css/jquery-ui.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/reset.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/index.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/header.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/navigation.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/blog.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/cart.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/footer.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/insecttable.css' rel='stylesheet' type='text/css' />

 

</head>

 

<body>

<div class='wrapper'>

<?php include('fragments/header.php'); ?>

   

    <?php include('fragments/navigation.php'); ?>

   

<div class='content overflow'>

    <div class='left small articles'><ul><h1>insects</h1>

              </div>

      </div>

       

        <div class='right large'>

        <h2>Insect</h2>

<ul class='insecttable'><?php

$insect = mysql::select('insects', NULL, condition::where('insect_web')->is(2)->and(condition::where('insect_vis')->is(1)));

foreach($insect->order('insect_science')->execute()->data as $insect) { ?>

<ul><li><form method='get' class='insect'>

<a href='/insectcientific/<?php echo $insect['insect_id']; ?>'>

<div>

<strong><?php echo $insect['insect_science']; ?></strong><br />

<?php echo $insect['insect_com']; ?>

                           

</div>

</a>

 

<?php if (mysql::select('insects', 'insect_id', condition::where('insect_id')->is($insect['insect_id'])->and(condition::where('insect_vis')->is(1)))->limit(10)->execute()->row()) { ?>

<a href='/insectcientific/<?php echo $insect ['insect_id']; ?>' class='button inline'>Details</a>

<?php }?>

</form></li>

<?php } ?></ul>     

            </div>

     

   

    <?php include('fragments/footer.php'); ?>

</div>

 

</body>

</html>

 

 

insectscientific.php:

 

 

<?php

require_once('includes/php/require.php');

 

if(isset($_GET['insect_id'])){

$insect = mysql::select('insect', 'insect_slug, insect_science, insect_com, insect_mdes', condition::where('insect_id')->equalto($_GET['insect_id']))->and (condition::where('insect_vis')->equalto(1))->execute();

 

?>

<?php } ?>

<html>

<head>

 

<meta charset='utf-8'>

<title></title>

<meta name='description'/>

 

<script type='text/javascript' src='/includes/js/jquery.min.js'></script>

<script type='text/javascript' src='/includes/js/jquery-ui.min.js'></script>

<script type='text/javascript' src='/includes/js/index.js'></script>

 

<link href='/includes/css/jquery-ui.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/reset.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/index.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/header.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/navigation.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/blog.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/cart.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/footer.css' rel='stylesheet' type='text/css' />

<link href='/includes/css/insects.css' rel='stylesheet' type='text/css' />

 

</head>

 

<body>

<div class='wrapper'>

<?php include('fragments/header.php'); ?>

   

    <?php include('fragments/navigation.php'); ?>

   

<div class='content overflow'>

    <div class='left small articles'><ul><h1>insects</h1>

      </div>

          </div>

       

        <div class='right large'>

        <?php 

      $data = mysql::select('insect','insect_slug, insect_science, insect_com, insect_mdes', condition::where('insect_web')->equalto(2)->and(condition::where('insect_vis')->equalto(1)))->execute()->row();

?>

        <strong style='color:white'><?php echo $blog['insect_mdes']; ?></strong>

            </div>

     

   

    <?php include('fragments/footer.php'); ?>

</div>

 

</body>

</html>

 

I can access the other page but when I select an item from my insect page the id is sent to the url but the data is not retrieved from the database using the url.

 

Any help?

Link to comment
https://forums.phpfreaks.com/topic/266900-help/
Share on other sites

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.