Jump to content

myrok24

Members
  • Posts

    20
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

myrok24's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi there, im using a image carousel script from: http://www.dynamicdrive.com/dynamici...rightslide.htm The problem is, after a tweak i do get the images from my database, and also an encounting leftrightslide[NUMBER]. but in the browser it is somehow litterly showing the text "leftrightslide[NUMBER]".. plus the correct image. It seems that im missing a closing or starting tag of somekind.. but can't find it.. example: http://blikvoer.com/temp/bok/carous.php I changed this: var finalslide='' leftrightslide[0]='<a href="http://"><img src="dynamicbook1.gif" border=1></a>' leftrightslide[1]='<a href="http://"><img src="dynamicbook2.gif" border=1></a>' leftrightslide[2]='<a href="http://"><img src="dynamicbook3.gif" border=1></a>' leftrightslide[3]='<a href="http://"><img src="dynamicbook4.gif" border=1></a>' leftrightslide[4]='<a href="http://"><img src="dynamicbook5.gif" border=1></a>' into this: var finalslide='' </SCRIPT> <? $i=0; while ($row = mysql_fetch_assoc($result)){ extract($row); ?> leftrightslide[<?php echo $i;?>]=' <a target="_parent" href="index.php?pagina=klanten&klant=<?php echo $klant;?>"><? echo '<img src="logoimage/' . $logoname . '" />'; ?> </a>' <? $i=$i+1; } ?> <script type="text/javascript"> //Specify gap between each image (use HTML): Any help is appreciated..
  2. <html> <head> <title>Upload File To MySQL Database</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="../xxxx.css" rel="stylesheet" type="text/css"> </head> <body> <select name='category'id='category'><option value=></option><option value=Boeken>Boeken</option><option value=Campagne>Campagne</option><option value=Internet>Internet</option><option value=Lespaketten>Lespaketten</option><option value=Spellen>Spellen</option></select> <form action="" method="post" enctype="multipart/form-data" name="uploadform"> <table width="400" border="0" align="center" cellpadding="8" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#99CC00"> <tr> <td class="info">Opdracht titel:</td> <td><input name="label" type="text" class="box" id="label"></td> </tr> <td class="info">Afbeelding uploaden:</td> <td><input name="userfile" type="File" class="box" id="userfile" size="15"></td> </tr> <tr> <td class="info"> </td> <td><input name="upload" type="Submit" class="dynamic_button" id="upload" value="Uploaden"> <input name="btnBack" type="button" class="dynamic_button" id="btnBack" onClick="window.location.href='cms-admin.php';" value="Overzicht"></td> </tr> </table> </form> </body> </html>
  3. Im trying to write (insert) data from a dynamic droplist to the database, but it's not giving any result. Droplist filling: <?php $query = "SELECT id, category, label FROM upload GROUP BY category"; $result = mysql_query($query) or die('Error : ' . mysql_error()); echo "<select name='category'id='category'>"; while($row=mysql_fetch_array($result)){ echo "<option value=$row[category]>$row[category]</option>"; } echo "</select>"; ?> That's working well... Later on i define the variable: <? $category = $_POST['category']; ?> And the processing: <? $query = "INSERT INTO upload (name, size, type, path, label, category) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$filePath', '$label','$category')"; ?> What am i doing wrong? thnx!
  4. solved: <? if (isset($_GET['selectie'])) { $selectie = $_GET['selectie']; } else { $selectie = 1; } $query = "SELECT count(*) FROM upload WHERE klant = '".mysql_real_escape_string($_GET['klant'])."' "; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); $query_data = mysql_fetch_row($result); $numrows = $query_data[0]; $rows_per_page = 1; $lastpage = ceil($numrows/$rows_per_page); $selectie = (int)$selectie; if ($selectie > $lastpage) { $selectie = $lastpage; } if ($selectie < 1) { $selectie = 1; } $limit = 'LIMIT ' .($selectie - 1) * $rows_per_page .',' .$rows_per_page; $query = " SELECT id, name, label, tekst, category, klant, DATE_FORMAT(datum, '%d-%m-%Y') AS nl_datum FROM upload WHERE klant = '".mysql_real_escape_string($_GET['klant'])."' $limit "; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); while ($myrow = mysql_fetch_assoc($result)) { ?> <!-- ### WERK TONEN ######--> <div style="width:500px;background-color:#0CF; float:right"> <div > <div> <h3> <? echo $myrow['klant'] ?></h3> <p class="newsdate">Geplaatst op: <? echo $myrow['nl_datum'] ?></p> <p class="newsdate">Middel: <? echo $myrow['category'] ?></p> <p class="newsdate">Opdracht: <? echo $myrow['label'] ?></p> <? echo '<img class=plaatje src="image/' . $myrow['name'] . '" />' ; ?> <p class="newstext"> <? echo ($myrow['tekst']) ?> </p> </div> </div> </div> <!-- ### PAGINERING: volgende/totaal/volgende ######--> <div style="background-color:yellow"> <? if ($selectie == 1) { echo "<FONT color=grey size=1>VORIGE</FONT>"; //tekst als er geen vorige of eerste is } else { // echo " <a href='index.php?pagina=klanten&klant={$_GET['klant']}&selectie=1'> <FONT size=1>EERSTE</FONT></a> "; //eerste optie $prevpage = $selectie-1; echo " <a href='index.php?pagina=klanten&klant={$_GET['klant']}&selectie=$prevpage'><FONT size=1>VORIGE</FONT></a> "; //vorige optie } echo " <FONT size=1> || OPDRACHT <strong> $selectie </strong> / $lastpage || </FONT> "; if ($selectie == $lastpage) { echo "<FONT color=grey size=1>VOLGENDE</FONT>"; //tekst als er geen volgende of laatste is } else { $nextpage = $selectie+1; echo " <a href='index.php?pagina=klanten&klant={$_GET['klant']}&selectie=$nextpage'><FONT size=1>VOLGENDE</FONT></a> "; //volgende optie // echo " <a href='index.php?pagina=klanten&klant={$_GET['klant']}&selectie=$lastpage'><FONT size=1>LAATSTE</FONT></a> "; //laatste optie } ?></br>KLANTEN </div> <!-- ### PAGINERING EINDE ####--> <?php } // (while..) aflsuiten.. ?>
  5. solved.. final code: <? if (isset($_GET['selectie'])) { $selectie = $_GET['selectie']; } else { $selectie = 1; } $query = "SELECT count(*) FROM upload WHERE klant = '".mysql_real_escape_string($_GET['klant'])."' "; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); $query_data = mysql_fetch_row($result); $numrows = $query_data[0]; $rows_per_page = 1; $lastpage = ceil($numrows/$rows_per_page); $selectie = (int)$selectie; if ($selectie > $lastpage) { $selectie = $lastpage; } if ($selectie < 1) { $selectie = 1; } $limit = 'LIMIT ' .($selectie - 1) * $rows_per_page .',' .$rows_per_page; $query = " SELECT id, name, label, tekst, category, klant, DATE_FORMAT(datum, '%d-%m-%Y') AS nl_datum FROM upload WHERE klant = '".mysql_real_escape_string($_GET['klant'])."' $limit "; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); while ($myrow = mysql_fetch_assoc($result)) { ?> <!-- ### WERK TONEN ######--> <div style="width:500px;background-color:#0CF; float:right"> <div > <div> <h3> <? echo $myrow['klant'] ?></h3> <p class="newsdate">Geplaatst op: <? echo $myrow['nl_datum'] ?></p> <p class="newsdate">Middel: <? echo $myrow['category'] ?></p> <p class="newsdate">Opdracht: <? echo $myrow['label'] ?></p> <? echo '<img class=plaatje src="image/' . $myrow['name'] . '" />' ; ?> <p class="newstext"> <? echo ($myrow['tekst']) ?> </p> </div> </div> </div> <!-- ### PAGINERING: volgende/totaal/volgende ######--> <div style="background-color:yellow"> <? if ($selectie == 1) { echo "<FONT color=grey size=1>VORIGE</FONT>"; //tekst als er geen vorige of eerste is } else { // echo " <a href='index.php?pagina=klanten&klant={$_GET['klant']}&selectie=1'> <FONT size=1>EERSTE</FONT></a> "; //eerste optie $prevpage = $selectie-1; echo " <a href='index.php?pagina=klanten&klant={$_GET['klant']}&selectie=$prevpage'><FONT size=1>VORIGE</FONT></a> "; //vorige optie } echo " <FONT size=1> || OPDRACHT <strong> $selectie </strong> / $lastpage || </FONT> "; if ($selectie == $lastpage) { echo "<FONT color=grey size=1>VOLGENDE</FONT>"; //tekst als er geen volgende of laatste is } else { $nextpage = $selectie+1; echo " <a href='index.php?pagina=klanten&klant={$_GET['klant']}&selectie=$nextpage'><FONT size=1>VOLGENDE</FONT></a> "; //volgende optie // echo " <a href='index.php?pagina=klanten&klant={$_GET['klant']}&selectie=$lastpage'><FONT size=1>LAATSTE</FONT></a> "; //laatste optie } ?></br>KLANTEN </div> <!-- ### PAGINERING EINDE ####--> <?php } // (while..) aflsuiten.. ?>
  6. No thats not it maybe it's bit confusion because.. there's another "pagina". wich is the current page (pagina=klanten.php). Somehow its;s not giving any result in the next page.. dunno if the "GET" argument is good also..
  7. PLease can someone help me with my issue. I have this pagination in my file. But somehow it's not getting the right values or something for the next, previous e hyperlinks... my code: <? if (isset($_GET['pagina'])) { $pagina = $_GET['pagina']; } else { $pagina = 1; } $query = "SELECT count(*) FROM upload WHERE klant = '".mysql_real_escape_string($_GET['klant'])."' "; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); $query_data = mysql_fetch_row($result); $numrows = $query_data[0]; $rows_per_page = 1; $lastpage = ceil($numrows/$rows_per_page); $pagina = (int)$pagina; if ($pagina > $lastpage) { $pagina = $lastpage; } if ($pagina < 1) { $pagina = 1; } $limit = 'LIMIT ' .($pagina - 1) * $rows_per_page .',' .$rows_per_page; $query = " SELECT id, name, label, tekst, category, klant, DATE_FORMAT(datum, '%d-%m-%Y') AS nl_datum FROM upload WHERE klant = '".mysql_real_escape_string($_GET['klant'])."' $limit"; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); while ($myrow = mysql_fetch_assoc($result)) { ?> <!-- ### WERK TONEN ######--> <div style="width:500px;background-color:#0CF; float:right"> <div > <div> <h3> <? echo $myrow['klant'] ?></h3> <p class="newsdate">Geplaatst op: <? echo $myrow['nl_datum'] ?></p> <p class="newsdate">Middel: <? echo $myrow['category'] ?></p> <p class="newsdate">Opdracht: <? echo $myrow['label'] ?></p> <? echo '<img class=plaatje src="image/' . $myrow['name'] . '" />' ; ?> <p class="newstext"> <? echo ($myrow['tekst']) ?> </p> </div> </div> </div> <?php } // (else..) aflsuiten.. ?> <? if ($pagina == 1) { echo " EERSTE VORIGE"; } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagina=1'>EERSTE</a> "; $prevpage = $pagina-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagina=$prevpage'>VORIGE</a> "; } echo " ( pagina $pagina / $lastpage ) "; if ($pagina == $lastpage) { echo " VOLGENDE LAATSTE "; } else { $nextpage = $pagina+1; // echo " <a href='{$_SERVER['PHP_SELF']}?pagina=$nextpage'>VOLGENDE</a> "; echo " <a href='index.php?pagina=klanten&klant={$_GET['klant']}&pagina=$nextpage'>VOLGENDE</a> "; ?> //new one.. echo " <a href='{$_SERVER['PHP_SELF']}?pagina=$lastpage'>LAATSTE</a> "; } ?> I changed one "next" hyperlink with a better url. but still nothing in the output when i click it. Strange thing is that the total record count is correct and when i changed the max resultst, the records are al there. So the only thing that's not working are the buttons for more.. It's not getting the right info?.. thnx in advance! example: http://blikvoer.com/temp/samtest/index.php?pagina=klanten&klant=Anwb --> second "volgende" link..
  8. It's almost working now. Only problem is the next (previous ed..) button. It's not giving the right url output. whole code: <? if (isset($_GET['pagina'])) { $pagina = $_GET['pagina']; } else { $pagina = 1; } $query = "SELECT count(*) FROM upload WHERE klant = '".mysql_real_escape_string($_GET['klant'])."' "; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); $query_data = mysql_fetch_row($result); $numrows = $query_data[0]; $rows_per_page = 1; $lastpage = ceil($numrows/$rows_per_page); $pagina = (int)$pagina; if ($pagina > $lastpage) { $pagina = $lastpage; } if ($pagina < 1) { $pagina = 1; } $limit = 'LIMIT ' .($pagina - 1) * $rows_per_page .',' .$rows_per_page; $query = " SELECT id, name, label, tekst, category, klant, DATE_FORMAT(datum, '%d-%m-%Y') AS nl_datum FROM upload WHERE klant = '".mysql_real_escape_string($_GET['klant'])."' $limit"; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); while ($myrow = mysql_fetch_assoc($result)) { ?> <!-- ### SHOW WORK ######--> <div style="width:500px;background-color:#0CF; float:right"> <div > <div> <h3> <? echo $myrow['klant'] ?></h3> <p class="newsdate">Geplaatst op: <? echo $myrow['nl_datum'] ?></p> <p class="newsdate">Middel: <? echo $myrow['category'] ?></p> <p class="newsdate">Opdracht: <? echo $myrow['label'] ?></p> <? echo '<img class=plaatje src="image/' . $myrow['name'] . '" />' ; ?> <p class="newstext"> <? echo ($myrow['tekst']) ?> </p> </div> </div> </div> <?php } // (else..) close.. ?> <? if ($pagina == 1) { echo " EERSTE VORIGE"; } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagina=1'>EERSTE</a> "; $prevpage = $pagina-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagina=$prevpage'>VORIGE</a> "; } echo " ( pagina $pagina / $lastpage ) "; if ($pagina == $lastpage) { echo " VOLGENDE LAATSTE "; } else { $nextpage = $pagina+1; echo " <a href='{$_SERVER['PHP_SELF']}?pagina=$nextpage'>VOLGENDE</a> "; echo " <a href='{$_SERVER['PHP_SELF']}?pagina=$lastpage'>LAATSTE</a> "; } ?> I think the problem is in {$_SERVER['PHP_SELF']}, because the url is: ./index.php?pagina=2 instead of index.php?pagina=klanten&klant=Anwb?pagina=2 but i cannot find the exact problem.. Any idea?
  9. ok am back. I splitted my previous code to two different ones (to keep it a bit more orchanized for me) But still i have this "page" question (in the url..) My code now (for one of the pages (klanten.php ->clients) <? if (!isset($_GET['klant'])) { // kijken of klant is verkregen echo "klant niet gedefineerd"; } else { // category pakken $query = " SELECT id, name, label, tekst, category, klant, DATE_FORMAT(datum, '%d-%m-%Y') AS nl_datum FROM upload WHERE klant = '".mysql_real_escape_string($_GET['klant'])."' ORDER BY datum DESC "; $result = mysql_query($query) or die('Error : ' . mysql_error()); while ($myrow = mysql_fetch_assoc($result)) { ?> <!-- ### SHOW WORK ######--> <div style="width:500px;background-color:#0CF; float:right"> <div > <div> <h3> <? echo $myrow['klant'] ?></h3> <p class="newsdate">Geplaatst op: <? echo $myrow['nl_datum'] ?></p> <p class="newsdate">Middel: <? echo $myrow['category'] ?></p> <p class="newsdate">Opdracht: <? echo $myrow['label'] ?></p> <? echo '<img class=plaatje src="image/' . $myrow['name'] . '" />' ; ?> <p class="newstext"> <? echo ($myrow['tekst']) ?> </p> </div> </div> </div> <?php } // while afsluiten. } // (else..) aflsuiten.. ?> I've tried several examples concerning pagination. But i'm stuck at this part: if(!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } Because i'm already sending a variable (if (!isset($_GET['klant']))... ) in the page before: <a href="index.php?pagina=klanten&klant=<?php echo $klant;?>"><? echo $klant ?> I just don't get (understand) how to rebuilt this for my code.. example: http://blikvoer.com/temp/samtest/index.php?pagina=klanten&klant=Anwb
  10. More detailed, for a complete image. In another page i get the category and client list.: grouped by category: <? <a href="index.php?pagina=portfolio&category=<?php echo $category;?>"><? echo $category ?></a> ?> and grouped by client (id): <? <a href="index.php?pagina=portfolio&id=<?php echo $id;?>"><? echo $klant ?></a> ?> Wich i then get in another php page, with this code: <? $query = " SELECT id, name, label, tekst, category, klant, DATE_FORMAT(datum, '%d-%m-%Y') AS nl_datum FROM upload "; if(isset($_GET['id'])) { $query .= " WHERE id = '".mysql_real_escape_string($_GET['id'])."'"; } elseif(isset($_GET['category'])) { $query .= " WHERE category = '".mysql_real_escape_string($_GET['category'])."'"; } else { echo 'Geen id of categorie opgegeven'; } $result = mysql_query($query) or die('Error : ' . mysql_error()); $myrow = mysql_fetch_assoc($result); ?> <!-- ### SHOW WORK ######--> <div > <div> <h3> <? echo $myrow['klant'] ?></h3> <p class="newsdate">Geplaatst op: <? echo $myrow['nl_datum'] ?></p> <p class="newsdate">Middel: <? echo $myrow['category'] ?></p> <p class="newsdate">Opdracht: <? echo $myrow['label'] ?></p> <? echo '<img class=plaatje src="image/' . $myrow['name'] . '" />' ; ?> <p class="newstext"> <? echo ($myrow['tekst']) ?> </p> </div> </div> ?> And now i want to "skip" within category OR within all "id's". Based on the user choice in the other page (first codes) But i don't understand how i should do this with pagination.. wich is mostly based on one choice. preview: http://blikvoer.com/temp/samtest/index.php?pagina=portfolio
  11. i found this example code: <? if(!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } $max_results = 1; $from = (($page * $max_results) - $max_results); // Perform MySQL query on only the current page number's results $sql = mysql_query("SELECT * FROM pages LIMIT $from, $max_results"); while($row = mysql_fetch_array($sql)){ // Build your formatted results here. echo $row['title']."<br />"; } // Figure out the total number of results in DB: $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM pages"),0); // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); // then the paging links?> but is don't know if i must change the if(!isset($_GET['page'])){ i get ID. (or category)..
  12. Looks compact, but i absolutely don't know how to intergrate this with my code.. Is this code enought for my two querys?
  13. Hi there, I would like to add nex/previous buttons(links) to my current script and also a number showing wich page is displayed of the total (like: page 6/12). Not with a row of numbers like in many examples on internet. I am showing one record per page. My question: Should/could still use the script/structure like in the examples, to eventualy accomplish my goal? Tricky part is the fact that i want to navigate through a selected category (when selected) OR through all records (all assigments (ID)), depending on wich action the user My code: <? $query = " SELECT id, name, label, tekst, category, klant, DATE_FORMAT(datum, '%d-%m-%Y') AS nl_datum FROM upload "; if(isset($_GET['id'])) { $query .= " WHERE id = '".mysql_real_escape_string($_GET['id'])."'"; } elseif(isset($_GET['category'])) { $query .= " WHERE category = '".mysql_real_escape_string($_GET['category'])."'"; } else { echo 'No id given'; } $result = mysql_query($query) or die('Error : ' . mysql_error()); $myrow = mysql_fetch_assoc($result); ?> <!-- ### SHOW WORK ######--> <div > <div> <h3> <? echo $myrow['klant'] ?></h3> <p class="newsdate">Geplaatst op: <? echo $myrow['nl_datum'] ?></p> <p class="newsdate">Middel: <? echo $myrow['category'] ?></p> <p class="newsdate">Opdracht: <? echo $myrow['label'] ?></p> <? echo '<img class=plaatje src="image/' . $myrow['name'] . '" />' ; ?> <p class="newstext"> <? echo ($myrow['tekst']) ?> </p> </div> </div> ?> I have no clue how to realize this within my two different querys.. thnx in advance for any tips/help..!
  14. I get an errror: Parse error: syntax error, unexpected T_VARIABLE in xxxx/subnav01.php on line 5 wich is: $category = $_POST['category'];
×
×
  • 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.