justAnoob Posted May 10, 2009 Share Posted May 10, 2009 I can manually put in a number for the user_id that I want to display the pictures for... But I'm having trouble retrieving it so it will work for whatever user is signed in...... <?php session_start(); include "connection.php"; if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } $findit = $_SESSION['id']; $result = mysql_query("SELECT id FROM members WHERE username = '$findit'"); $query = "SELECT count(*) FROM abcxyz WHERE user_id = '1'"; ////////////////////////////////// $result = mysql_query($query); $query_data = mysql_fetch_row($result); $numrows = $query_data[0]; $rows_per_page = 1; $lastpage = ceil($numrows/$rows_per_page); $pageno = (int)$pageno; $prevpage = $pageno-1; $nextpage = $pageno+1; if ($pageno > $lastpage) { $pageno = $lastpage; } if ($pageno < 1) { $pageno = 1; } $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; $result = mysql_query("SELECT id FROM members WHERE username = '$findit'"); $result = mysql_result($result, 0, 0); $sql = mysql_query("SELECT id, imgpath, imgpath2, imgpath3, imgpath4, imgpath5, item_name, description, in_return FROM abcxyz WHERE user_id = '1' $limit"); /////////////// if($lastpage != 0) { echo "<table width='954' border='0' align='center' cellpadding='0' cellspacing='0' bordercolor='#000000' bgcolor='#BBD4E1'>"; while ($row = mysql_fetch_array($sql)) { echo "<tr><td width='188' height='180'><div align='center'>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath2'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath3'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath4'] . '" width="125" alt="" />'; echo "</div></td><td width='190'><div align='center'>"; echo '<img src="' . $row['imgpath5'] . '" width="125" alt="" />'; echo "</div></td></tr><tr><td height='43' colspan='4'>"; echo '<strong>Item Name:</strong> <input type="text" name="item_name" value="' . $row['item_name'] . '" size="50" /> '; if ($pageno == 1) { echo " Previous Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage'> Previous Item </a>"; } echo "($pageno of $lastpage)"; if ( $pageno == $lastpage ) { echo " Next Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage'> Next Item </a>"; } echo "</td><td><div align='center'>"; echo ""; echo "</div></td></tr><tr><td height='116' colspan='4'>"; echo '<strong>Description:</strong> <textarea name="description" cols="75" rows="5">' . $row['description'] . '</textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td height='124' colspan='4'>"; echo '<strong>Seeking:</strong> <textarea name="in_return" cols="75" rows="5">' . $row['in_return'] . ' </textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td colspan='4'>"; echo ''; echo "</td><td><div align='center'>"; echo "</td></tr>"; } echo "</table>"; } else { echo "You currently have no pics."; } ?> My tables are setup the following..... members id username abcxyz id user_id item_name description in_return I only showed what is important in the tables for what I am trying to accomplish Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 $result = mysql_query("SELECT id FROM members WHERE username = '$findit' LIMIT 1"); $result = mysql_fetch_assoc($result); $query = "SELECT count(*) FROM abcxyz WHERE user_id = " . $result['id']; Try that fix. Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 10, 2009 Author Share Posted May 10, 2009 What about this line??? Same thing <?php $sql = mysql_query("SELECT id, imgpath, imgpath2, imgpath3, imgpath4, imgpath5, item_name, description, in_return FROM abcxyz WHERE user_id = '1' $limit"); ?> Like this??? <?php $sql = mysql_query("SELECT id, imgpath, imgpath2, imgpath3, imgpath4, imgpath5, item_name, description, in_return FROM abcxyz WHERE user_id = ' . $result['id']' $limit"); ?> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 You have a syntax error there. But yes that should work, unless the variable $result is changed. Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 10, 2009 Author Share Posted May 10, 2009 Well,, i fixed both lines,,, but now I get this..... Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource I hate to keep bothering you,, but you have been so much help.....I'm not that good at debuggin Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 Post updated version of your code. Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 10, 2009 Author Share Posted May 10, 2009 <?php session_start(); include "connection.php"; if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } $findit = $_SESSION['id']; $result = mysql_query("SELECT id FROM members WHERE username = '$findit'"); $query = "SELECT count(*) FROM abcxyz WHERE user_id = " . $result['id']; $result = mysql_query($query); $query_data = mysql_fetch_row($result); $numrows = $query_data[0]; $rows_per_page = 1; $lastpage = ceil($numrows/$rows_per_page); $pageno = (int)$pageno; $prevpage = $pageno-1; $nextpage = $pageno+1; if ($pageno > $lastpage) { $pageno = $lastpage; } if ($pageno < 1) { $pageno = 1; } $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; $result = mysql_query("SELECT id FROM members WHERE username = '$findit'"); $result = mysql_result($result, 0, 0); $sql = mysql_query("SELECT id, imgpath, imgpath2, imgpath3, imgpath4, imgpath5, item_name, description, in_return FROM abcxyz WHERE user_id = " . $result['id'] . " $limit"); if($lastpage != 0) { echo "<table width='954' border='0' align='center' cellpadding='0' cellspacing='0' bordercolor='#000000' bgcolor='#BBD4E1'>"; while ($row = mysql_fetch_array($sql)) { echo "<tr><td width='188' height='180'><div align='center'>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath2'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath3'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath4'] . '" width="125" alt="" />'; echo "</div></td><td width='190'><div align='center'>"; echo '<img src="' . $row['imgpath5'] . '" width="125" alt="" />'; echo "</div></td></tr><tr><td height='43' colspan='4'>"; echo '<strong>Item Name:</strong> <input type="text" name="item_name" value="' . $row['item_name'] . '" size="50" /> '; if ($pageno == 1) { echo " Previous Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage'> Previous Item </a>"; } echo "($pageno of $lastpage)"; if ( $pageno == $lastpage ) { echo " Next Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage'> Next Item </a>"; } echo "</td><td><div align='center'>"; echo ""; echo "</div></td></tr><tr><td height='116' colspan='4'>"; echo '<strong>Description:</strong> <textarea name="description" cols="75" rows="5">' . $row['description'] . '</textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td height='124' colspan='4'>"; echo '<strong>Seeking:</strong> <textarea name="in_return" cols="75" rows="5">' . $row['in_return'] . ' </textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td colspan='4'>"; echo ''; echo "</td><td><div align='center'>"; echo "</td></tr>"; } echo "</table>"; } else { echo "You currently have no trades."; } ?> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 You overwrote $result after $query. See it? Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 10, 2009 Author Share Posted May 10, 2009 So renaming $result wouldn't be a fix then,, eh??? I'll try something. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 Yes, but make sure you keep it consistent throughout the code. Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 10, 2009 Author Share Posted May 10, 2009 crap,,, no matter what I do,,, still get the same error. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 Someone's *not* very creative. <?php session_start(); include "connection.php"; if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } $findit = $_SESSION['id']; $e_result = mysql_query("SELECT id FROM members WHERE username = '$findit'"); $query = "SELECT count(*) FROM abcxyz WHERE user_id = " . $e_result['id']; $result = mysql_query($query); $query_data = mysql_fetch_row($result); $numrows = $query_data[0]; $rows_per_page = 1; $lastpage = ceil($numrows/$rows_per_page); $pageno = (int)$pageno; $prevpage = $pageno-1; $nextpage = $pageno+1; if ($pageno > $lastpage) { $pageno = $lastpage; } if ($pageno < 1) { $pageno = 1; } $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; $result = mysql_query("SELECT id FROM members WHERE username = '$findit'"); $result = mysql_result($result, 0, 0); $sql = mysql_query("SELECT id, imgpath, imgpath2, imgpath3, imgpath4, imgpath5, item_name, description, in_return FROM abcxyz WHERE user_id = " . $e_result['id'] . " $limit"); if($lastpage != 0) { echo "<table width='954' border='0' align='center' cellpadding='0' cellspacing='0' bordercolor='#000000' bgcolor='#BBD4E1'>"; while ($row = mysql_fetch_array($sql)) { echo "<tr><td width='188' height='180'><div align='center'>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath2'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath3'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath4'] . '" width="125" alt="" />'; echo "</div></td><td width='190'><div align='center'>"; echo '<img src="' . $row['imgpath5'] . '" width="125" alt="" />'; echo "</div></td></tr><tr><td height='43' colspan='4'>"; echo '<strong>Item Name:</strong> <input type="text" name="item_name" value="' . $row['item_name'] . '" size="50" /> '; if ($pageno == 1) { echo " Previous Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage'> Previous Item </a>"; } echo "($pageno of $lastpage)"; if ( $pageno == $lastpage ) { echo " Next Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage'> Next Item </a>"; } echo "</td><td><div align='center'>"; echo ""; echo "</div></td></tr><tr><td height='116' colspan='4'>"; echo '<strong>Description:</strong> <textarea name="description" cols="75" rows="5">' . $row['description'] . '</textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td height='124' colspan='4'>"; echo '<strong>Seeking:</strong> <textarea name="in_return" cols="75" rows="5">' . $row['in_return'] . ' </textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td colspan='4'>"; echo ''; echo "</td><td><div align='center'>"; echo "</td></tr>"; } echo "</table>"; } else { echo "You currently have no trades."; } ?> Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 10, 2009 Author Share Posted May 10, 2009 Still get same error,, that is what I tried.... The brain is starting to hurt now.. lol Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 Hm.. oh I see. In your first SQL, your WHERE clause is username = '$findit'. Is $findit a number or an actual username? Is username column an int or a string? I'm confused there. Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 10, 2009 Author Share Posted May 10, 2009 $findit is getting the id number of the username that is signed in at the time which id is an int. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 $e_result = mysql_query("SELECT id FROM members WHERE username = '$findit'") or die(mysql_error()); $query = "SELECT count(*) FROM abcxyz WHERE user_id = " . $e_result['id']; $result = mysql_query($query) or die(mysql_error()); Use those and tell me the errors. I think something's wrong with the queries. Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 10, 2009 Author Share Posted May 10, 2009 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 '' at line 1 Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 That didn't tell me which failed. $e_result = mysql_query("SELECT id FROM members WHERE username = '$findit'") or die('1. ' . mysql_error()); $query = "SELECT count(*) FROM abcxyz WHERE user_id = " . $e_result['id']; $result = mysql_query($query) or die('2. ' . mysql_error()); Once more please. Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 10, 2009 Author Share Posted May 10, 2009 2. 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 '' at line 1 <?php session_start(); include "connection.php"; if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } $findit = $_SESSION['id']; $e_result = mysql_query("SELECT id FROM members WHERE username = '$findit'") or die('1. ' . mysql_error()); $query = "SELECT count(*) FROM abcxyz WHERE user_id = " . $e_result['id']; $result = mysql_query($query) or die('2. ' . mysql_error()); $query_data = mysql_fetch_row($e_result); $numrows = $query_data[0]; $rows_per_page = 1; $lastpage = ceil($numrows/$rows_per_page); $pageno = (int)$pageno; $prevpage = $pageno-1; $nextpage = $pageno+1; if ($pageno > $lastpage) { $pageno = $lastpage; } if ($pageno < 1) { $pageno = 1; } $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; $result = mysql_query("SELECT id FROM members WHERE username = '$findit'"); $result = mysql_result($result, 0, 0); $sql = mysql_query("SELECT id, imgpath, imgpath2, imgpath3, imgpath4, imgpath5, item_name, description, in_return FROM abcxyz WHERE user_id = " . $e_result['id'] . " $limit"); if($lastpage != 0) { echo "<table width='954' border='0' align='center' cellpadding='0' cellspacing='0' bordercolor='#000000' bgcolor='#BBD4E1'>"; while ($row = mysql_fetch_array($sql)) { echo "<tr><td width='188' height='180'><div align='center'>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath2'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath3'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath4'] . '" width="125" alt="" />'; echo "</div></td><td width='190'><div align='center'>"; echo '<img src="' . $row['imgpath5'] . '" width="125" alt="" />'; echo "</div></td></tr><tr><td height='43' colspan='4'>"; echo '<strong>Item Name:</strong> <input type="text" name="item_name" value="' . $row['item_name'] . '" size="50" /> '; if ($pageno == 1) { echo " Previous Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage'> Previous Item </a>"; } echo "($pageno of $lastpage)"; if ( $pageno == $lastpage ) { echo " Next Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage'> Next Item </a>"; } echo "</td><td><div align='center'>"; echo ""; echo "</div></td></tr><tr><td height='116' colspan='4'>"; echo '<strong>Description:</strong> <textarea name="description" cols="75" rows="5">' . $row['description'] . '</textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td height='124' colspan='4'>"; echo '<strong>Seeking:</strong> <textarea name="in_return" cols="75" rows="5">' . $row['in_return'] . ' </textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td colspan='4'>"; echo ''; echo "</td><td><div align='center'>"; echo "</td></tr>"; } echo "</table>"; } else { echo "You currently have no pics."; } ?> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 OMG! I know why. Dude, you did *NOT* follow my instructions well. I can't believe I missed it. Quoting myself! Do you see the second line there? You left it out. $result = mysql_query("SELECT id FROM members WHERE username = '$findit' LIMIT 1"); $result = mysql_fetch_assoc($result); $query = "SELECT count(*) FROM abcxyz WHERE user_id = " . $result['id']; Try that fix. Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 10, 2009 Author Share Posted May 10, 2009 Well,,, again, I am so confused.... After we fix this,, I won't bother you for a long long time.. lol.. This is what I have right now... <?php session_start(); include "connection.php"; if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } $findit = $_SESSION['id']; $result = mysql_query("SELECT id FROM members WHERE username = '$findit' LIMIT 1"); $result = mysql_fetch_assoc($result); $query = "SELECT count(*) FROM abcxyz WHERE user_id = " . $result['id']; $query_data = mysql_fetch_row($result); $numrows = $query_data[0]; $rows_per_page = 1; $lastpage = ceil($numrows/$rows_per_page); $pageno = (int)$pageno; $prevpage = $pageno-1; $nextpage = $pageno+1; if ($pageno > $lastpage) { $pageno = $lastpage; } if ($pageno < 1) { $pageno = 1; } $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; $result = mysql_query("SELECT id FROM members WHERE username = '$findit'"); $result = mysql_result($result, 0, 0); $sql = mysql_query("SELECT id, imgpath, imgpath2, imgpath3, imgpath4, imgpath5, item_name, description, in_return FROM abcxyz WHERE user_id = " . $result['id'] . " $limit"); if($lastpage != 0) { echo "<table width='954' border='0' align='center' cellpadding='0' cellspacing='0' bordercolor='#000000' bgcolor='#BBD4E1'>"; while ($row = mysql_fetch_array($sql)) { echo "<tr><td width='188' height='180'><div align='center'>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath2'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath3'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath4'] . '" width="125" alt="" />'; echo "</div></td><td width='190'><div align='center'>"; echo '<img src="' . $row['imgpath5'] . '" width="125" alt="" />'; echo "</div></td></tr><tr><td height='43' colspan='4'>"; echo '<strong>Item Name:</strong> <input type="text" name="item_name" value="' . $row['item_name'] . '" size="50" /> '; if ($pageno == 1) { echo " Previous Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage'> Previous Item </a>"; } echo "($pageno of $lastpage)"; if ( $pageno == $lastpage ) { echo " Next Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage'> Next Item </a>"; } echo "</td><td><div align='center'>"; echo ""; echo "</div></td></tr><tr><td height='116' colspan='4'>"; echo '<strong>Description:</strong> <textarea name="description" cols="75" rows="5">' . $row['description'] . '</textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td height='124' colspan='4'>"; echo '<strong>Seeking:</strong> <textarea name="in_return" cols="75" rows="5">' . $row['in_return'] . ' </textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td colspan='4'>"; echo ''; echo "</td><td><div align='center'>"; echo "</td></tr>"; } echo "</table>"; } else { echo "You currently have no pics."; } ?> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 Is there an error? Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 10, 2009 Author Share Posted May 10, 2009 Read the comment lines <?php session_start(); include "connection.php"; if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } $findit = $_SESSION['id']; $result = mysql_query("SELECT id FROM members WHERE username = '$findit' LIMIT 1"); $result = mysql_fetch_assoc($result); $query = "SELECT count(*) FROM abcxyz WHERE user_id = " . $result['id']; $query_data = mysql_fetch_row($result); ////giving me error on this line mysql_fetch_row(): supplied argument is not a valid MySQL result resource $numrows = $query_data[0]; $rows_per_page = 1; $lastpage = ceil($numrows/$rows_per_page); $pageno = (int)$pageno; $prevpage = $pageno-1; $nextpage = $pageno+1; if ($pageno > $lastpage) { $pageno = $lastpage; } if ($pageno < 1) { $pageno = 1; } $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; $result = mysql_query("SELECT id FROM members WHERE username = '$findit'"); $result = mysql_result($result, 0, 0); $sql = mysql_query("SELECT id, imgpath, imgpath2, imgpath3, imgpath4, imgpath5, item_name, description, in_return FROM abcxyz WHERE user_id = " . $result['id'] . " $limit"); if($lastpage != 0) { echo "<table width='954' border='0' align='center' cellpadding='0' cellspacing='0' bordercolor='#000000' bgcolor='#BBD4E1'>"; while ($row = mysql_fetch_array($sql)) { echo "<tr><td width='188' height='180'><div align='center'>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath2'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath3'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath4'] . '" width="125" alt="" />'; echo "</div></td><td width='190'><div align='center'>"; echo '<img src="' . $row['imgpath5'] . '" width="125" alt="" />'; echo "</div></td></tr><tr><td height='43' colspan='4'>"; echo '<strong>Item Name:</strong> <input type="text" name="item_name" value="' . $row['item_name'] . '" size="50" /> '; if ($pageno == 1) { echo " Previous Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage'> Previous Item </a>"; } echo "($pageno of $lastpage)"; if ( $pageno == $lastpage ) { echo " Next Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage'> Next Item </a>"; } echo "</td><td><div align='center'>"; echo ""; echo "</div></td></tr><tr><td height='116' colspan='4'>"; echo '<strong>Description:</strong> <textarea name="description" cols="75" rows="5">' . $row['description'] . '</textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td height='124' colspan='4'>"; echo '<strong>Seeking:</strong> <textarea name="in_return" cols="75" rows="5">' . $row['in_return'] . ' </textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td colspan='4'>"; echo ''; echo "</td><td><div align='center'>"; echo "</td></tr>"; } echo "</table>"; } else { echo "You currently have no pics."; ///also it echos this line } ?> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 <?php session_start(); include "connection.php"; if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } $findit = $_SESSION['id']; $result = mysql_query("SELECT id FROM members WHERE username = '$findit' LIMIT 1"); $e_row = mysql_fetch_assoc($result); $query = "SELECT count(*) FROM abcxyz WHERE user_id = " . $e_row['id']; $query_data = mysql_fetch_row($result); $numrows = $query_data[0]; $rows_per_page = 1; $lastpage = ceil($numrows/$rows_per_page); $pageno = (int)$pageno; $prevpage = $pageno-1; $nextpage = $pageno+1; if ($pageno > $lastpage) { $pageno = $lastpage; } if ($pageno < 1) { $pageno = 1; } $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; $sql = mysql_query("SELECT id, imgpath, imgpath2, imgpath3, imgpath4, imgpath5, item_name, description, in_return FROM abcxyz WHERE user_id = " . $e_row['id'] . " $limit"); if($lastpage != 0) { echo "<table width='954' border='0' align='center' cellpadding='0' cellspacing='0' bordercolor='#000000' bgcolor='#BBD4E1'>"; while ($row = mysql_fetch_array($sql)) { echo "<tr><td width='188' height='180'><div align='center'>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath2'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath3'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath4'] . '" width="125" alt="" />'; echo "</div></td><td width='190'><div align='center'>"; echo '<img src="' . $row['imgpath5'] . '" width="125" alt="" />'; echo "</div></td></tr><tr><td height='43' colspan='4'>"; echo '<strong>Item Name:</strong> <input type="text" name="item_name" value="' . $row['item_name'] . '" size="50" /> '; if ($pageno == 1) { echo " Previous Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage'> Previous Item </a>"; } echo "($pageno of $lastpage)"; if ( $pageno == $lastpage ) { echo " Next Item "; } else { echo "<a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage'> Next Item </a>"; } echo "</td><td><div align='center'>"; echo ""; echo "</div></td></tr><tr><td height='116' colspan='4'>"; echo '<strong>Description:</strong> <textarea name="description" cols="75" rows="5">' . $row['description'] . '</textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td height='124' colspan='4'>"; echo '<strong>Seeking:</strong> <textarea name="in_return" cols="75" rows="5">' . $row['in_return'] . ' </textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td colspan='4'>"; echo ''; echo "</td><td><div align='center'>"; echo "</td></tr>"; } echo "</table>"; } else { echo "You currently have no pics."; } ?> Edit: did you ever call mysql_query() on $query? Quote Link to comment Share on other sites More sharing options...
justAnoob Posted May 10, 2009 Author Share Posted May 10, 2009 Progress,, I think,,, Now it echos the line that says there are no pics.. But with the username that I am using I know that there are some pics.. Four of them. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.