Jump to content

spiderwell

Members
  • Posts

    1,008
  • Joined

  • Last visited

Everything posted by spiderwell

  1. its the top debugging tip for SQL not working, i always do it
  2. not quite $pic2 .="ORDER by thumbnailID DESC LIMIT $Page_Start , $Per_Page" ; echo $pic2 ; $pic1 = mysql_query($pic2); then run the script and see what it says
  3. have you considered using nested lists and using either suckerfish css menus, or a jquery accordian menu? that way you have all the menus listed in once go, and the css or javascript makes it all operational. it would not account for pushing the current choice to the top of the list though
  4. i would like 2 help wid d images, but i canz not udderstand youz
  5. try echoing out the sql statement just before you execute it, so you can see what it says exactly, and if need copy it into phpmyadmin
  6. the file view.php, at no point in that file do you attempt to put a value into the variable $file, so it is empty a value for this is being passed via a query string in the other script here: <?php echo "<img src=\"view.php?file={$row["id"]}\">";?></td> so in view.php you need to grab that value being passed to it so put this line at the top of view.php <?php include 'db.inc'; $file = $_GET['file']; $file = clean($file, 4);
  7. <?php $objConnect = mysql_connect("localhost","","root") or die(mysql_error()); $objDB = mysql_select_db("sdf"); $pic2 = "SELECT * FROM images"; if (!isset($_GET['Page'])) $_GET['Page']='0'; $pic1 = mysql_query($pic2); $Num_Rows = mysql_num_rows($pic1); $Per_Page = 16; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) {$Page=1;} $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) {$Num_Pages =1;} else if(($Num_Rows % $Per_Page)==0) {$Num_Pages =($Num_Rows/$Per_Page) ;} else {$Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages;} $pic2 .=" order by thumbnailID ASC LIMIT $Page_Start , $Per_Page"; $pic1 = mysql_query($pic2); $cell = 0; echo ' <div id="tablediv"> <table border="0" cellpadding="17" cellspacing="0" class="table"> <tr>'; while($pic = mysql_fetch_array($pic1)) { if($cell % 4 == 0) { echo '</tr><tr>'; } if($cell == 2) { echo ' <td> fillerspace </td>'; } elseif ($cell == 3) { echo ' <td> Fillerspace2 </td>'; } else { echo ' <td> <a href="/' . $pic["link"] . '.php"> <div class="image"> <img src="https://s3.amazonaws.com/image/' . $pic["pic"] . '.png" alt="' . $pic["alt"] . '" height="200" width="200" /> </div> </a> </td>'; } $cell++; } echo '</tr></table></div>'; ?>
  8. the first thing i spotted is you are listed by ASC, so you want to change it to DESC, this will put the new image at the top. there seems to be an awful lot of extra code that you dont really need. why is $pic2 and $link1 and $alt1 all the same SQL command? (well you add ordering and paging to $pic2 but this is the only recordset you need) give me a moment and Ill post a stripped out version for you
  9. it can't be because you ask this but it doesn't appear in any of the code you have posted!?! EDIT:: glad you fixed it , as I had no clue
  10. hang on, I'll just get my crystal ball post the relevant code please
  11. its very hard to second guess your code if we can't see it. I am guessing its within the $row3 loop that you want 'selected' echoed into the <option>, but you haven't given us anything to work with
  12. when you say $row['mycount'] does not exist do you mean its value is NULL?
  13. i cant even see " . $row2['content'] . " in your code, what exactly are you trying to do, preselect an option if it is matching in $row2['content'] ?
  14. if you dont need it, dont use it.
  15. the statement isnt quite formed correctly <?php if ($new==0) { echo "new";} else { echo "old "; } ?> also theres a difference with "0" and 0, "0" is a string whereas 0 is a number, or false
  16. the first example will throw an error saying name is undefined if it wasnt found in the $_POST array, that is Null isset is a way of being sure something exists before retreiving its value i usually retreive all my form values like this if (isset($_POST['name'])) $name = $_POST['name'];
  17. is view.php missing $file = $_GET['file'] ?
  18. ryan you are doing what miko said not to do with the SQL, just use one SQL statement and order by region. <?php $currentregion = false; $result = "SELECT * FROM regions ORDER BY region ASC;"; while ($row=mysql_fetch_assoc($result)) { if (!$currentregion) //first call { echo "<h3>" . $row['region'] . "</h3>"; $currentregion = $row['region']; echo "<div><p>" ; } elseif($currentregion != $row['region']) // region has changed { echo "</p></div>"; //close last region div echo "<h3>" . $row['region'] . "</h3>"; $currentregion = $row['region']; echo "<div><p>" ; } echo "<a href=\"delete.php?region=".$row['region']."&country=".$row['country']."\" onclick=\"return confirm('Are you sure you want to delete?')\"><img src=\"http://www.veryicon.com/icon/png/System/Float/Delete.png\" height=\"20\"/></a>"; echo $row['country'] . "<br>"; }// end DB loop echo "</p></div>"; //close last div p.s. i havent checked above code for typo errors.
  19. and i found a better accordian script now for a site I have, so I might nick that for myself too!
  20. yeh sorry mikosiko, i didnt realise you had replied, i thought it was ryandward. the 2 solutions do give different results. mine puts all countries into 1 div tag, whereas yours puts each country into its own div tag, not sure which is correct for ryan
  21. then you need to group by region or order by region. then you need to make a check to see if region has changed as you loop through and close off the div and start a new one for the new region, when the region does change. something roughly like $currentregion = false; while ($row=mysql_fetch_assoc($result)) { if (!$currentregion) //first call { echo "<h3>" . $row['region'] . "</h3>"; $currentregion = $row['region']; echo "<div>" ; } elseif($currentregion != $row['region']) // region has changed { echo "</div>"; //close last region div echo "<h3>" . $row['region'] . "</h3>"; $currentregion = $row['region']; echo "<div>" ; } echo $row['country']; }// end DB loop echo "</div>"; //close last div
  22. What are you trying to say? I suggested a way to solve your issue did I not?
  23. then you need to get this moved to the javascript section
  24. do you want clientside or server side validation, serverside validation will mean the form will be posted. you can use javascript to check if a form input has text in it simply enough. validation using both would make it more robust, as javascript validation can be hacked fairly easily
×
×
  • 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.