Jump to content

[SOLVED] showin image of user who posted a message


runnerjp

Recommended Posts

hey guys me again  :D

 

i have my code here

<?php $SQL = "SELECT * FROM $tablname WHERE account = '$user2' ORDER BY id DESC LIMIT $howmany";

    $results = mysql_db_query($database, "$SQL", $connection);
    if (!$results)
      return ("ERROR: " . mysql_error() . "\n$SQL\n");

    while ($row = mysql_fetch_array($results))
      { 
        $nick     = $row["nick"]; 
        $url      = $row["url"];
        $message  = $row["message"];
        $datetime = $row["datetime"];
        $senton= date("M jS, Y \a\\t h:i A T", $datetime);


        /* Add Emoticons to the user's message */
       if ($emoticon == 1)
          $msg = emoticon($message);

        /* Some people don't have web sites, so we check to see if they put a URL in the database */
        if ($url=="" or $url=="http://") /* If they didn't then we just display the nick and the message */
          $nick = "$nick";
        else /* If they did, then we link it!! */
          $nick = "<a href=\"$url\" target=\"_blank\">$nick</a>";
          
          $query = "SELECT * FROM users WHERE Username = '$nick' LIMIT 1"; 
if ($result = mysql_query($query)or die("Error running query:".mysql_error())){
    if (mysql_num_rows($result)) {
        $array = mysql_fetch_assoc($result);
        $pid = $array['ID'];
           $sql = "SELECT `ext` FROM `user_images` WHERE `user_id`='$pid' LIMIT 1";?>
  <table width="100%" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1%" rowspan="3" align="left" valign="top"><?php  $q = mysql_query($sql) or die("Error running query:".mysql_error());
                                 if($q && mysql_num_rows($q) > 0)  {
                                $row = mysql_fetch_array($q);                                
                                if(!empty($row)) {
                                echo "<img src='http://www.website.com/members/images/mini/". $pid . "." . $row['ext']  . "'";
                                        }
                                        else {
                                    echo 'no image';
                                                }
																							                                            }
                                            ?>

 

what it should do is... find the username of the person who posted in users tbale == $query = "SELECT * FROM users WHERE Username = '$nick' LIMIT 1";

 

then find there id $pid = $array['ID'];

 

then find the image in the db with there id $sql = "SELECT `ext` FROM `user_images` WHERE `user_id`='$pid' LIMIT 1";?>

 

i thought this would work but i just get blank page... can any 1 show me where im going worng??

i thought logic was there lol

Link to comment
Share on other sites

A blank page generally indicates that you have display_errors set to off, but do have errors in your page.

 

The errors in question are unclosed braces - you have if statements that have not been closed. However, it is not necessarily a question of just adding the closing braces - they may have been required earlier in the script. Just placing them at the end will more than likely result in logic problems.

 

All that said, you're really going a long way round of doing this. Using a join in the query would be much simpler and more efficient. Speaking of which, you shouldn't select all the columns from a table if you only need one or two.

Link to comment
Share on other sites

As i say, i suggest you rewrite the above and join your tables. It'll be something like:

 

<?php
$sql = "SELECT t.*,user_images.ext as ext,users.ID as pid as ext FROM $tablname as t,users,photos WHERE t.account = '$user2' AND t.nick=users.nick AND users.ID = user_images.user_id ORDER BY t.id DESC LIMIT $howmany";
$result = mysql_db_query($database,$sql,$connection) or die(mysql_error());
while($row = mysql_fetch_assoc($result)){
    $nick     = $row["nick"]; 
    $url      = $row["url"];
    $message  = $row["message"];
    $datetime = $row["datetime"];
    $senton= date("M jS, Y \a\\t h:i A T", $datetime);
    $pid = $row['pid'];
    $ext = $row['ext'];
    //echo out as required
     
}
?>

Link to comment
Share on other sites

Well i'll start with the full stop. You use a full stop to separate a table and a field name. Hence user_images.ext is the ext field from the user_images table.

 

The t is an alias. It allows you to do alias.fieldname rather than longtablename.fieldname. You set an alias with the AS keyword. You can also use aliases for the names of the selected fields. This is useful both to eliminate the table name or function from the result set (that is, so you dont have to use $row['tablename.fieldname'] or $row['COUNT(*)'] - instead you could just use $row['fieldname'] or $row['count'] ) and for the use of the selected fields in more complex queries.

Link to comment
Share on other sites

humm ok..i have had ago at messing around with it but hit more problems then i need lol... could you tell me where i have gone wrong here

<?
session_start();
require_once '../../settings.php';
require ("required.php");

echo "<!-- $scriptname v$version Start -->\n\n";
echo "<HTML>\n";
echo "  <HEAD>\n";
echo "    <LINK rel=\"stylesheet\" type=\"text/css\" href=\"shoutbox/tagboard.css\">\n";
echo "  </HEAD>\n";
echo "  <BODY topmargin=\"2\" leftmargin=\"2\" bottommargin=\"2\" rightmargin=\"2\">\n";
$user2 =  $_GET['username'];
if ($usemysql == 1)
  {
    /* Load the tagboard, the X number of most recent posts */
    if ($order == "0")
    
    $SQL = "SELECT * FROM $tablname WHERE account = '$user2' ORDER BY id DESC LIMIT $howmany";

    $results = mysql_db_query($database, "$SQL", $connection);
    if (!$results)
      return ("ERROR: " . mysql_error() . "\n$SQL\n");

    while ($row = mysql_fetch_array($results))
      { 
        $nick     = $row["nick"]; 
        $url      = $row["url"];
        $message  = $row["message"];
        $datetime = $row["datetime"];
        $senton= date("M jS, Y \a\\t h:i A T", $datetime);


        /* Add Emoticons to the user's message */
       if ($emoticon == 1)
          $msg = emoticon($message);

        /* Some people don't have web sites, so we check to see if they put a URL in the database */
        if ($url=="" or $url=="http://") /* If they didn't then we just display the nick and the message */
          $nick = "$nick";
        else /* If they did, then we link it!! */
          $nick = "<a href=\"$url\" target=\"_blank\">$nick</a>";
          }
          $query = "SELECT * FROM users WHERE Username = '$nick' LIMIT 1"; 
if ($result = mysql_query($query)or die("Error running query:".mysql_error())){
    if (mysql_num_rows($result)) {
        $array = mysql_fetch_assoc($result);
        $pid = $array['ID'];}
           $sql = "SELECT `ext` FROM `user_images` WHERE `user_id`='$pid' LIMIT 1";?>
  <table width="100%" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1%" rowspan="3" align="left" valign="top"><?php  $q = mysql_query($sql) or die("Error running query:".mysql_error());
                                 if($q && mysql_num_rows($q) > 0)  {
                                $row = mysql_fetch_array($q);                                
                                if(!empty($row)) {
                                echo "<img src='http://www.runningprofiles.com/members/images/mini/". $pid . "." . $row['ext']  . "'";
                                        }
                                        else {
                                    echo 'no image';
                                                }
																							                                            }
                                            ?> </td>
    <td width="99%" bgcolor="#e4ebeb"><?php echo $nick;?> wrote</td>
  </tr>
  <tr>
    <td bgcolor="#e4ebeb">at <? echo $senton;?></td>
  </tr>
  <tr>
    <td><? echo $msg;?></td>
  </tr>
  
</table>
  <BR>


        
        <?
      }

      /* Like always, we close the connection to the database */
      mysql_close($connection);
  }
else
  {
    $i = 0;
    $file_lines = file($flatfile);

    foreach($file_lines as $line)
      {
        if ($i <= $howmany)
          {
            $delim    = strpos($line, "%%");
            $ts_delim = strpos($line, "@@");
            $ip_delim = strpos($line, "##");

            $nick = substr($line, 0, $delim);
            $message = substr($line, $delim + 2, $ts_delim - $delim - 2);
            $ts = substr($line, $ts_delim + 2, $ip_delim - $ts_delim - 2);
  
            if ($timestamping == 1)
              echo "    <B>$nick ($ts)$spacer</B> ";
            else 
              echo "    <B>$nick$spacer</B> ";

            if ($emoticon == 1)
              echo (emoticon($message)); 
          
              

            echo "<BR>\n";

            $i++;
          }
      }
  }



function emoticon($msg)
  {
    $msg = str_replace("o:-)", "<IMG src=\"http://www..com/members/shoutbox/images/angel.gif\">", $msg);
   
    
    return $msg;
  }

?>

 

for it to not echo my image at all before i jump into adding the join in query lol learn form basics and work my way up :D

Link to comment
Share on other sites

ok i tried

<?php
$sql = "SELECT t.*,user_images.ext as ext,users.ID as pid as ext FROM $tablname as t,users,photos WHERE t.account = '$user2' AND t.nick=users.nick AND users.ID = user_images.user_id ORDER BY t.id DESC LIMIT $howmany";
$result = mysql_db_query($database,$sql,$connection) or die(mysql_error());
while($row = mysql_fetch_assoc($result)){
    $nick     = $row["nick"]; 
    $url      = $row["url"];
    $message  = $row["message"];
    $datetime = $row["datetime"];
    $senton= date("M jS, Y \a\\t h:i A T", $datetime);
    $pid = $row['pid'];
    $ext = $row['ext'];
    //echo out as required
     
}
?>

again but im getting You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as `ext` FROM tagboard as t,users,photos WHERE t.account = 'Admin' AND t.nick=us' at line 1

Link to comment
Share on other sites

Seem to have an extra as ext in there for some reason, not sure how that got there. Try:

 

<?php
$sql = "SELECT t.*,user_images.ext as ext,users.ID as pid FROM $tablname as t,users,photos WHERE t.account = '$user2' AND t.nick=users.nick AND users.ID = user_images.user_id ORDER BY t.id DESC LIMIT $howmany";
$result = mysql_db_query($database,$sql,$connection) or die(mysql_error().'<br />Query was:'.$sql);
while($row = mysql_fetch_assoc($result)){
    $nick     = $row["nick"]; 
    $url      = $row["url"];
    $message  = $row["message"];
    $datetime = $row["datetime"];
    $senton= date("M jS, Y \a\\t h:i A T", $datetime);
    $pid = $row['pid'];
    $ext = $row['ext'];
    //echo out as required
     
}
?>

Link to comment
Share on other sites

ok i bailed on that idea i was getting to confused at what coloums whent wherre ect lol gonna go for long widned version

 

<?
session_start();
require_once '../../settings.php';
require ("required.php");

echo "<!-- $scriptname v$version Start -->\n\n";
echo "<HTML>\n";
echo "  <HEAD>\n";
echo "    <LINK rel=\"stylesheet\" type=\"text/css\" href=\"shoutbox/tagboard.css\">\n";
echo "  </HEAD>\n";
echo "  <BODY topmargin=\"2\" leftmargin=\"2\" bottommargin=\"2\" rightmargin=\"2\">\n";
$user2 =  $_GET['username'];
if ($usemysql == 1)
  {
    /* Load the tagboard, the X number of most recent posts */
    if ($order == "0")
    
    $SQL = "SELECT * FROM $tablname WHERE account = '$user2' ORDER BY id DESC LIMIT $howmany";

    $results = mysql_db_query($database, "$SQL", $connection);
    if (!$results)
      return ("ERROR: " . mysql_error() . "\n$SQL\n");




    while ($row = mysql_fetch_array($results))
      { 
        $nick     = $row["nick"]; 
        $url      = $row["url"];
        $message  = $row["message"];
        $datetime = $row["datetime"];
        $senton= date("M jS, Y \a\\t h:i A T", $datetime);


        /* Add Emoticons to the user's message */
       if ($emoticon == 1)
          $msg = emoticon($message);

        /* Some people don't have web sites, so we check to see if they put a URL in the database */
        if ($url=="" or $url=="http://") /* If they didn't then we just display the nick and the message */
          $nick = "$nick";
        else /* If they did, then we link it!! */
          $nick = "<a href=\"$url\" target=\"_blank\">$nick</a>";
          }
          $query = "SELECT * FROM users WHERE Username = '$nick' LIMIT 1"; 
if ($result = mysql_query($query)or die("Error running query:".mysql_error())){
    if (mysql_num_rows($result)) {
        $array = mysql_fetch_assoc($result);
        $pid = $array['ID'];}
           $sql = "SELECT `ext` FROM `user_images` WHERE `user_id`='$pid' LIMIT 1";?>
  <table width="100%" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1%" rowspan="3" align="left" valign="top"><?php  $q = mysql_query($sql) or die("Error running query:".mysql_error());
                                 if($q && mysql_num_rows($q) > 0)  {
                                $row = mysql_fetch_array($q);                                
                                if(!empty($row)) {
                                echo "<img src='http://www.runningprofiles.com/members/images/mini/". $pid . "." . $row['ext']  . "'";
                                        }
                                        else {
                                    echo 'no image';
                                                }

















































                                            }
                                            ?> </td>
    <td width="99%" bgcolor="#e4ebeb"><?php echo $nick;?> wrote</td>
  </tr>
  <tr>
    <td bgcolor="#e4ebeb">at <? echo $senton;?></td>
  </tr>
  <tr>
    <td><? echo $msg;?></td>
  </tr>
  
</table>
  <BR>


        
        <?
      }










      /* Like always, we close the connection to the database */
      mysql_close($connection);
  }
else
  {
    $i = 0;
    $file_lines = file($flatfile);

    foreach($file_lines as $line)
      {
        if ($i <= $howmany)
          {
            $delim    = strpos($line, "%%");
            $ts_delim = strpos($line, "@@");
            $ip_delim = strpos($line, "##");

            $nick = substr($line, 0, $delim);
            $message = substr($line, $delim + 2, $ts_delim - $delim - 2);
            $ts = substr($line, $ts_delim + 2, $ip_delim - $ts_delim - 2);
  
            if ($timestamping == 1)
              echo "    <B>$nick ($ts)$spacer</B> ";
            else 
              echo "    <B>$nick$spacer</B> ";

            if ($emoticon == 1)
              echo (emoticon($message)); 
          
              

            echo "<BR>\n";

            $i++;
          }
      }
  }



function emoticon($msg)
  {
    $msg = str_replace("o:-)", "<IMG src=\"http://www.r.com/members/shoutbox/images/angel.gif\">", $msg);
   
    return $msg;
  }

?>

 

the problem is my images are not being shown :S i think i have put a } in the wrong place but im not sure...

Link to comment
Share on other sites

Well I for one am not going to sit here and unpick your logic. As far as I can see there are missing braces all over the place.

 

Short and concise code (i.e. with just the one query) is much easier to debug.

 

If you insist on following your version, i suggest the first step would be to fix the indentation and get rid of the unnecessary whitespace. It'll be easier to follow the flow of the code that way.

Link to comment
Share on other sites

ok i went back to the script you told me and stook with it.. like you said easyer and less bulk!!

 

just little confused

 

ok so i have this now

       $sql = "SELECT t.*,user_images.ext as ext,users.ID as pid FROM $tablname as t,users,user_images WHERE t.account = '$user2' AND t.nick=nick AND users.ID = user_images.user_id ORDER BY t.id DESC LIMIT $howmany";
$result = mysql_db_query($database,$sql,$connection) or die(mysql_error().'<br />Query was:'.$sql);
while($row = mysql_fetch_assoc($result)){
    $nick     = $row["nick"]; 
    $url      = $row["url"];
    $message  = $row["message"];
    $datetime = $row["datetime"];
    $senton= date("M jS, Y \a\\t h:i A T", $datetime);
    $ID = $row['id'];
    $ext = $row['ext'];
    //echo out as required
     
}
     

$ID = $row['id']; this needs to come from this

 

$query = "SELECT * FROM users WHERE Username = '$nick' LIMIT 1";

if ($result = mysql_query($query)or die("Error running query:".mysql_error())){

    if (mysql_num_rows($result)) {

        $array = mysql_fetch_assoc($result);

        $pid = $array['ID'];}

 

but at the moment its pointing to the image gallery and pulling the id of the shout... i need it to point to users table and look for ID in there... but im confused into which parts of the query i should chnage :S

Link to comment
Share on other sites

ahhh yes ty...im starting to understand now.. only problem now is

 

  <?php  $sql = "SELECT t.*,user_images.ext as ext,users.ID as pid FROM $tablname as t,users,user_images WHERE t.account = '$user2' AND t.nick=nick AND users.ID = user_images.user_id ORDER BY t.id DESC LIMIT 10";
$result = mysql_db_query($database,$sql,$connection) or die(mysql_error().'<br />Query was:'.$sql);
while($row = mysql_fetch_assoc($result)){
    $nick     = $row["nick"]; 
    $url      = $row["url"];
    $message  = $row["message"];
    $datetime = $row["datetime"];
    $senton= date("M jS, Y \a\\t h:i A T", $datetime);
    $id = $row['pid'];
    $ext = $row['ext'];
    //echo out as required
   ?>
     
}

 

where it says ORDER BY t.id DESC LIMIT 10  well for some reason its only displaying 1 message rather then 10 :S

 

would look like this <?php $SQL = "SELECT * FROM $tablname WHERE account = '$user2' ORDER BY id DESC LIMIT 10";?>

Link to comment
Share on other sites

This stuff:

<php
....
while($row = mysql_fetch_assoc($result)){
....
    $ext = $row['ext'];
    //echo out as required
   ?> 
}

 

Should be:

<php
....
while($row = mysql_fetch_assoc($result)){
....
    $ext = $row['ext'];
    //echo out as required
}
?>

 

Then the script will end after the while loop

Link to comment
Share on other sites

sorry it does that allready just added ?> before it...

 

i will post whole code if it helps

 <?php $sql = "SELECT t.*,user_images.ext as ext,users.ID as pid FROM $tablname as t,users,user_images WHERE t.account = '$user2' AND t.nick=nick AND users.ID = user_images.user_id ORDER BY t.id DESC LIMIT 10";
$result = mysql_db_query($database,$sql,$connection) or die(mysql_error().'<br />Query was:'.$sql);
while($row = mysql_fetch_assoc($result)){
    $nick     = $row["nick"]; 
    $url      = $row["url"];
    $message  = $row["message"];
    $datetime = $row["datetime"];
    $senton= date("M jS, Y \a\\t h:i A T", $datetime);
    $id = $row['pid'];
    $ext = $row['ext'];
    //echo out as required     
}


        /* Add Emoticons to the user's message */
       if ($emoticon == 1)
          $msg = emoticon($message);

        /* Some people don't have web sites, so we check to see if they put a URL in the database */
        if ($url=="" or $url=="http://") /* If they didn't then we just display the nick and the message */
          $nick = "$nick";
        else /* If they did, then we link it!! */
          $nick = "<a href=\"$url\" target=\"_blank\">$nick</a>"?>
           
           
<table width="100%" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1%" rowspan="3" align="left" valign="top"><?php  $q = mysql_query($sql) or die("Error running query:".mysql_error());
                                 if($q && mysql_num_rows($q) > 0)  {
                                $row = mysql_fetch_array($q);                                
                                if(!empty($row)) {
                                echo "<img src='http://www.r.com/members/images/mini/". $id . "." . $row['ext']  . "'";
                                        }
                                        else {
                                    echo 'no image';
                                                }
																							                                            }
                                            ?> </td>
    <td width="99%" bgcolor="#e4ebeb"><?php echo $nick;?> wrote</td>
  </tr>
  <tr>
    <td bgcolor="#e4ebeb">at <? echo $senton;?></td>
  </tr>
  <tr>
    <td><? echo $msg;?></td>
  </tr>
  
</table>

  <BR>

still only displayin 1 message :S

also... the image is not displaying for the right person... what i need it to be is that $nick = username in the table users... so what parts do i need to chnage for that..iv had ago but keep getting errors

Link to comment
Share on other sites

That would be because you close the while loop and THEN echo out the data - the data needs to be echoed inside the while loop, otherwise only the last result would be displayed. Try doing this:

 

<?php 
$sql = "SELECT t.*,user_images.ext as ext,users.ID as pid FROM $tablname as t,users,user_images WHERE t.account = '$user2' AND t.nick=nick AND users.ID = user_images.user_id ORDER BY t.id DESC LIMIT 10";
$result = mysql_db_query($database,$sql,$connection) or die(mysql_error().'<br />Query was:'.$sql);
while($row = mysql_fetch_assoc($result)){
    $nick     = $row["nick"]; 
    $url      = $row["url"];
    $message  = $row["message"];
    $datetime = $row["datetime"];
    $senton= date("M jS, Y \a\\t h:i A T", $datetime);
    $id = $row['pid'];
    $ext = $row['ext'];
    //echo out as required
    echo 'Username:'.$nick.'<br />';
    echo 'URL:'.$urk.'<br />';
    echo 'Message:'.$message.'<br />';
    echo 'Time:'.$senton.'<br />';
    echo 'Img: <img src="http://www.r.com/members/images/mini/'.$id.'.'.$ext.'" /><br />';
    echo "<hr />\n";
    }
?>

 

Do the above to verify that you are getting the data you want, then worry about the formatting of it.

Link to comment
Share on other sites

okok i think im getting it... at the mo the image is comming from the user under account... but i need it to come from nick ... i tried to chnage  t.account = '$user2'  to  t.nick = '$user2'  but i get blank no errors or anything... am i dfoing it right/changing right thing :S

Link to comment
Share on other sites

What is the purpose of t.account="$user2'? It was in your original query, so i left it there initially. However, i have to wonder why it was there in the first place. You also seem to have removed an alias somewhere along the line. Try:

 

$sql = "SELECT t.*,user_images.ext as ext,users.ID as pid FROM $tablname as t,users,user_images WHERE t.nick=users.nick AND users.ID = user_images.user_id ORDER BY t.id DESC LIMIT 10";

Link to comment
Share on other sites

ok i did this

$sql = "SELECT t.*,user_images.ext as ext,users.ID as pid FROM $tablname as t,users,user_images WHERE t.nick=nick AND users.ID = user_images.user_id ORDER BY t.id DESC LIMIT 10";

as users.nick gets Unknown column 'users.nick' in 'where clause'

 

but images still displaying as this

$user2 =  $_GET['username'];

$query = "SELECT * FROM users WHERE Username = '$user2' LIMIT 1";  (this is only way i can think its getting it)

 

when it would be....

 

$nick    = $row["nick"];

$query = "SELECT * FROM users WHERE Username = '$nick' LIMIT 1";

$pid = $array['ID'];

$sql = "SELECT `ext` FROM `user_images` WHERE `user_id`='$pid' LIMIT 1";

 

 

does that make sence :P

 

 

 

 

Link to comment
Share on other sites

This is always the trouble with trying to write queries for a database you didn't created/don't use.

 

Try:

<?php 
$sql = "SELECT t.*,user_images.ext as ext,users.ID as pid FROM $tablname as t,users,user_images WHERE t.nick=users.Username AND users.ID = user_images.user_id ORDER BY t.id DESC LIMIT 10";
$result = mysql_db_query($database,$sql,$connection) or die(mysql_error().'<br />Query was:'.$sql);
while($row = mysql_fetch_assoc($result)){
    $nick     = $row["nick"]; 
    $url      = $row["url"];
    $message  = $row["message"];
    $datetime = $row["datetime"];
    $senton= date("M jS, Y \a\\t h:i A T", $datetime);
    $id = $row['pid'];
    $ext = $row['ext'];
    //echo out as required
    echo 'Username:'.$nick.'<br />';
    echo 'URL:'.$urk.'<br />';
    echo 'Message:'.$message.'<br />';
    echo 'Time:'.$senton.'<br />';
    echo 'Img: <img src="http://www.r.com/members/images/mini/'.$id.'.'.$ext.'" /><br />';
    echo "<hr />\n";
    }
?>

Link to comment
Share on other sites

ok i have users

[code]CREATE TABLE `users` (
  `ID` int(11) NOT NULL auto_increment,
  `Username` varchar(255) NOT NULL default '',
  `Password` varchar(255) NOT NULL default '',
  `date_registered` int(11) NOT NULL default '0',
  `Temp_pass` varchar(55) default NULL,
  `Temp_pass_active` tinyint(1) NOT NULL default '0',
  `Email` varchar(255) NOT NULL default '',
  `Active` int(11) NOT NULL default '0',
  `Level_access` int(11) NOT NULL default '2',
  `Random_key` varchar(32) default NULL,
  `about_me` text NOT NULL,
  `events` varchar(255) NOT NULL default '',
  `first_name` varchar(255) NOT NULL default '',
  `last_name` varchar(20) NOT NULL default '',
  `gender` varchar(6) NOT NULL default '',
  `dob` varchar(99) NOT NULL default '',
  `ip` varchar(29) NOT NULL default '',
  `lastlog` varchar(99) NOT NULL default '',
  PRIMARY KEY  (`ID`),
  UNIQUE KEY `Username` (`Username`),
  UNIQUE KEY `Email` (`Email`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;

 

user images

 

CREATE TABLE `user_images` (
  `user_id` int(11) NOT NULL default '0',
  `ext` varchar(10) NOT NULL default '',
  PRIMARY KEY  (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

 

and tagboard

CREATE TABLE `tagboard` (
  `id` int(10) NOT NULL auto_increment,
  `nick` varchar(16) NOT NULL default '',
  `url` varchar(128) NOT NULL default '',
  `message` varchar(128) NOT NULL default '',
  `datetime` varchar(255) NOT NULL default '',
  `ip` varchar(15) NOT NULL default '',
  `account` varchar(99) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=55 ;

 

you see `nick` varchar(16) NOT NULL default '',  will be the same as  `Username` varchar(255) NOT NULL default '',[/code]

Link to comment
Share on other sites

Ok, and what is the point of the account fiend in the tagboard table? What does it store?

 

And while we're on the subject, why are you storing the extension for an image in a separate table? Is a user only ever allowed to have one picture? If so, why dont you just store the path to the image in the users table?

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.