Jump to content

[SOLVED] Can someone look my code over for any mistakes?


djfox

Recommended Posts

Here is my code:

 

$res = mysql_query("SELECT id, name, description, url, price, preview FROM collection WHERE id='$c[2]'");
$comico = mysql_fetch_row($res);
mysql_free_result($res);
{
echo "<a href='sell7.php?id=$comico[0]&p=$comico[4]'>";
echo "<img src='collection/$comico[5]' border=0></a>";
}

 

Here is my problem:

$comico[0] and $comico[5] appear fine but $comico[4] is not showing up.

 

Can someone look me over and see if I messed up somewhere?

<?php

  if ($res = mysql_query("SELECT id, name, description, url, price, preview FROM collection WHERE id='{$c[2]}'")) {
    if (mysql_num_rows($res)) {
      $comico = mysql_fetch_row($res);
      mysql_free_result($res);
      echo "<a href='sell7.php?id={$comico[0]}&p={$comico[4]}'>";
      echo "<img src='collection/{$comico[5]}' border=0></a>";
    }
  } else {
    echo mysql_error();
  }

?>

the code seems ok to me and when i create an array as follows

$comico = ARRAY("me", "name", "desc", "url","20.44","preview");

 

which is what the query code does, but with your values from the database

and if I run your echo statements I get the following source code

 

<a href='sell7.php?id=me&p=20.44'><img src='collection/preview' border=0></a>

 

which, based on my array is exactly what it should say

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.