Jump to content

drisate

Members
  • Posts

    805
  • Joined

  • Last visited

Everything posted by drisate

  1. I really don't understand what your trying to do ... Post your code as it is now ... and ask your question cause that UPDATE as a SELECT is confusing me ... it's wrong in so many ways ! Anybody else understand?
  2. First of all, you can loop the alphabet with out creating an array like that ... <?php for ($i=ord("A");$i<ord("Z");$i++){ echo "<a href=\"?letter=" . chr($i) . "\">" . chr($i) . "</a> ¦ "; } ?> I made a script that looks like it a week ago It goes like this: <?php $table = "contacts"; $mypage = "index.php?letter=$_GET[letter]&gender=$_GET[gender]"; $nb_per_page = 25; if ($_GET[letter]){$where = "fname LIKE '$letter%'";} if ($_GET == "") { $num_page = 1; } else { $num_page = $_GET['page']; } $offset = ($num_page - 1) * $nb_per_page; $total_results = @current(@mysql_fetch_assoc(@mysql_query("SELECT count(id) FROM $table $where"))); $re_page = $num_page * $nb_per_page; $ree_page = $re_page - $nb_per_page; $i = 0; $maxPage = ceil($total_results / $nb_per_page); $nav = ''; for ($page = 1; $page <= $maxPage; $page++) { if ($page == $num_page) { $nav .= " $page "; } else { $nav .= " <a href=\"$mypage&page=$page\">$page</a> "; } } if ($num_page > 1) { $page = $num_page - 1; $prev = " <a href=\"$mypage&page=$page\">[back]</a> "; $first = " <a href=\"$mypage&page=1\">[First page]</a> "; } else { $prev = ' '; $first = ' '; } if ($num_page < $maxPage) { $page = $num_page + 1; $next = " <a href=\"$mypage&page=$page\">[Next]</a> "; $last = " <a href=\"$mypage&page=$maxPage\">[Last page]</a> "; } else { $next = ' '; $last = ' '; } if ($re_page >= "$total_results") { $re_page = "$total_results"; } echo '<center>'; for ($i=ord("A");$i<ord("Z");$i++){ echo "<a href=\"?letter=" . chr($i) . "\">" . chr($i) . "</a> ¦ "; } echo '</center><br><br>'; print ('<table border="0" cellpadding="3" cellspacing="3" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1"> <tr> <td width="100%" align="center"><b>F Name</b></td> </tr>'); $select = mysql_query("SELECT * FROM $table $where order by fname asc limit $offset, $nb_per_page") or die(mysql_error()); while ($list = mysql_fetch_array($select)) { $i++; print ('<tr> <td width="100%" style="border-top-style: solid; border-top-width: 1; border-bottom-style: none; border-bottom-width: medium" bgcolor="#E8E8E8"> <b>' . $list[fname] . '</b></td> </tr>'); } // Empty if ($i == "0") { print (' <tr> <td width="100%" colspan="5" align="center" style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bgcolor="#E8E8E8">No result</td> </tr>'); } echo '</table>'; // Navigation print ("<br>($ree_page to $re_page de $total_results) Page:<b>$first $prev $nav $next $last"); ?> I did not adapte all my code to yours but it's a good start ... All you need is to finish the gender integration and probably a few other things of your code. Upload it and see what left that needs to be done :-)
  3. use nl2br() mail($to, $subject, nl2br($message), $headers); or Use <br> to line break
  4. How in the world are we supose to be able to help you if you don't show us your code haha
  5. It means that your Querry:SELECT id, date, name FROM events WHERE id>200 Is returning nothing ... Try SELECT * FROM events If that works it meand that your id>200 is returning nothing. If it does not work it means your events table is empty. If you wana me sure you don't get that error in the future you can test it with isset()
  6. It would look like this <?php while($row = mysql_fetch_array($result)){ $html_center .= $row['id']."<br>".$row['name']."<br>".$row['date']."<br>\n<hr>\n"; } $html = "<html> $html_center <i>This is a test calendar.</i>"; ?>
  7. You can remove parts of string with str_replace() Ex: $url = str_replace('http://', '', $url); EDIT: lol Maq you beated me hehe
  8. Something like this <?php function checkSite($www){ $ch = curl_init('http://www.google.pl/search?hl=pl&q=site%3A'.trim($www).'&btnG=Szukaj&source=hp'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $sHtml = curl_exec($ch); preg_match('#\<div id=resultStats\>.*([0-9,]+) wynik#Ui', $sHtml, $aMatches); curl_close($ch); return (int)str_replace(',', '', $aMatches[1]); } if ($_POST['www']){ echo checkSite($_POST['www']); }else{ print ('<form method="POST"><p>Check this site: http://www.<input type="text" name="www" size="20"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p></form>'); } ?>
  9. something like this? <?php $date = explode ('/', $data[2]); $mm = $date[0]; $dd = $date[1]; $yy = $date[2]; if ($yy<=11){ $yyyy = "20$yy"; }else{ $yyyy = "19$yy"; } $new_date = "$yyyy-$mm-$dd"; ?>
  10. We need more of your code because we can't see where your title is printed ... <a href=\"journal.php?id=" . $id . "\">$title</a>
  11. I would recomend you to do something like this <?php echo '<a href="index.php?page=1">Page 1</a> | <a href="index.php?page=2">Page 2</a><br><br>'; if ($_GET['page']=="1"){ include("Content/page1.php"); }elseif ($_GET['page']=="2"){ include("Content/page2.php"); }else{ include("Content/home.php"); } ?> The way you did it a hacker could change teh value of your $_GET['page'] and include anything Make sure your "Content" directory really has a capital C. It's case sensetive.
  12. try this if(isset($_GET['like']) and isset($fetch['id']) and $_GET['like']==$fetch['id']){
  13. Just a guess like that ... if $_GET['like'] and $fetch['id'] are both empty it might also count as a like. try testing with isset()
  14. explain what exacly you need to know on while loops ... it's vast ... theres so much ways in using it lol The basic would be while (condition) { code to be executed; } Ex: <?php $i=1; while($i<=5) // Loop 5 times { echo "The number is " . $i . "<br />"; $i++; // Will add +1 to the $i var } ?>
  15. <?php $check = @current(@mysql_fetch_assoc(@mysql_query("SELECT AccountName FROM page WHERE AccountName = '$Accn'"))); if ($check){ echo "Sorry $Accn already exist!"; }else{ $query = "INSERT INTO Accounts(AccountName, Password)VALUES ('".$Accn."','".$Pwwd."')"; $insert = mysql_query($query); echo "Account created!"; } ?> the @current(@mysql_fetch_assoc(@mysql_query( part is bad code but i use i use it when i wana test only 1 column name. if $check is equal to nothing there will be warnings so the @ will delete them
  16. do it like this foreach($options['exc_cat'] as $cat) { if ($cat!=""){$string .= $cat.",";} } $string = substr($string, 0, -1); // Delete the last character echo $string;
  17. If i got it right ... you wana do something like this? foreach ($array[key] as $key => $value){ $string .= $value.", "; } $string = substr($string, 0, -2); // Delete the last 2 characters echo $string; I would require more of your code in order to show you exacly how it's done but the above is an exemple.
  18. It means concatenating assignment operator http://us2.php.net/manual/en/language.operators.string.php In english, the "dot" glues 2 strings into 1 $var .="Hello "; $var .="How are you."; echo $var; will print out "Hello How are you."
  19. i would go for a custome CMS. It's gona be A LOT less complicated for the client to take care of his website.
  20. Cool :-) You can see the comment systeme in action at www.dramis.info Let me know if you wana see what the comment stats code looks like
  21. np you can also use that inside a loop like this $select = mysql_query("SELECT * FROM newsletter_settings'") or die(mysql_error()); while ($newsletter_settings = mysql_fetch_array($select)) { $header_image = $newsletter_settings['sHeaderImage']; $header_name = $newsletter_settings['sHeaderName']; $header_text = $newsletter_settings['sHeaderText']; }
  22. For those vars to work you need to add mysql_fetch_assoc $newsletter_settings_query = "SELECT * FROM newsletter_settings"; $result = mysql_query($newsletter_settings_query) or die("There was a problem with the SQL query: " . mysql_error()); $newsletter_settings = mysql_fetch_assoc($result); $header_image = $newsletter_settings['sHeaderImage']; $header_name = $newsletter_settings['sHeaderName']; $header_text = $newsletter_settings['sHeaderText'];
  23. I am not spiderwell but you welcome :-) BTW, im my rush of posting i got those to vars mixed up $placeid = "news"; $catid = "23"; Oh and the script may sound unsecure but i have a array_map('escape_deep', $value) adding slashes and other counter mesures on _GET and _POST to protect my self aganst SQL injections so you might wana protect your self as well...
  24. $date = date("Y-m-d");
×
×
  • 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.