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?

Link to comment
Share on other sites

<?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();
  }

?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.