Jump to content

winder

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

winder's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. OK. I sorted it out. I didn't have a clear view of how php manages arrays. I didn't have the correct orientation it seems shuffle() is more than enough Thanks guys for all you help!
  2. this is what i get from print_r... Array ( [0] => Array ( [0] => 14 [1] => 14 [2] => 14 [3] => 14 [4] => 14 [5] => 14 [6] => 14 ) [1] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 ) [2] => Array ( [0] => 1 [1] => 2 [2] => 1 [3] => 1 [4] => 1 [5] => 2 [6] => 3 ) [3] => Array ( [0] => -1 [1] => -1 [2] => -1 [3] => -1 [4] => -1 [5] => -1 [6] => -1 ) ) this is the same as the following right? 14141414141414 1234567 1211123 -1-1-1-1-1-1-1 This is the first thing i looked at... but i can't see how this generic shuffle() function can help with this column restriction....
  3. hello all! i'm trying to write a php function that shuffles array's columns. Let me give you an example to clear things out... if we have a table like this.... a b c 1 2 3 after the shuffle, a must be in same column as 1, b in same as 2 etc.... like this maybe... c a b 3 1 2 i think you get the point... I found out about built-in php function shuffle()... if i could somehow make this function to "remember" the exact same shuffle that did in one row...then it would be easy. I would apply the same shuffle in all the other rows...so columns are intact. But i'm afraid this isn't possible. So is there any built-in function that i can use? Or i have to write it all by myself? I would really be thankful for any advice, tip... thanks in advance!
  4. thanks guys for your help! You both solved my problem
  5. hmm... let me explain more.... in a movie details page i have some links that contain some image thumbnails that reloads the same page and places a bigger image in an image placeholder (with javascript). In the same time i pass a variable value with php to show which image is currently shown. The problem is that when the page is long and you need to scroll down to see the thumbnails and the main image (they are always located at the bottom of the movie details page for each movie), then when you click a thumbnail, the image is shown in the placeholder (main bigger image) but the browser scrolls again up. And you need to scroll again down to see the image you clicked... i hope i made my self clear...
  6. hello. i see that in both firefox and ie, when a link is clicked the default behavior is to scroll back to the top of the page. This is fine in some cases but, in some other cases is disturbing. I'm wandering is it possible (with php, javascript or whatever), to specify not to scroll back to the top of the page for a specific link? To overide this behavior... thanks a lot
  7. oh finally solved it!! thank you guys for your tips and effort!! teng84 that's what i was looking for!! thanks It's so obvious that i don't know how i couldn't think of it. now i'm using this little code... and everything works ok!! if (isset($_GET['id'])){ $_SESSION['newsid'] = $_GET['id']; } $id = $_SESSION['newsid'];
  8. i don't understand what you instruct me to do i'll read your post again and again till i'll understand anywat... here is the code for the login. Maybe you can add some code in the one i provided, to understand what you mean. checklogin.php <?php session_start(); include("database.php"); $username = $_POST['username']; $password = $_POST['pass']; $q=mysql_query("SELECT * FROM reg_cust WHERE reg_cust.USERNAME='$username' and reg_cust.PASSWORD='$password'"); $count=mysql_num_rows($q); if($count==1){ $_SESSION['username'] = $_POST['username']; $_SESSION['password'] = $_POST['pass']; $_SESSION['loged_in'] = TRUE; header("Location: ".$_SESSION['pageuri']); } else { $_SESSION['loged_in'] = FALSE; header("Location: ".$_SESSION['pageuri']); } ?> and the login form inside news.php... (some words are in greek but you get the general idea) <?php $_SESSION['pageuri']= "news.php"; if(isset($_SESSION['loged_in'])){ if($_SESSION['loged_in']){ $uname = $_SESSION['username']; ?> <h4>Είσοδος Μελών</h4> <div id=succes><p><img src="../images/tick.png" />Καλώς ήρθες<span><?php print $uname; ?></span></p></div> <p><a href="logout.php">Έξοδος</a> | <a href="register.php">Εγγραφή</a></p> <?php }//end if else{ unset($_SESSION['loged_in']); ?> <h4>Είσοδος Μελών</h4> <div id=error><p><img src="../images/attention.png" />Λανθασμένα Στοιχεία Χρήστη</p></div> <form name="loginform" id="login" method="post" action="checklogin.php"> <fieldset> <label for="username"><span>Όνομα Χρήστη</span><input type="text" name="username" id="username" maxlength="20"></label> <label for="pass"><span>Κωδικός Πρόσβασης</span><input type="password" name="pass" id="pass" maxlength="12"> </label> </fieldset> </form> <p><a href="javascript:login()">Είσοδος</a> | <a href="register.php">Εγγραφή</a></p> <?php }//end else }//end if else{ ?> <h4>Είσοδος Μελών</h4> <form name="loginform" id="login" method="post" action="checklogin.php"> <fieldset> <label for="username"><span>Όνομα Χρήστη</span><input type="text" name="username" id="username" maxlength="20"></label> <label for="pass"><span>Κωδικός Πρόσβασης</span><input type="password" name="pass" id="pass" maxlength="12"> </label> </fieldset> </form> <p><a href="javascript:login()">Είσοδος</a> | <a href="register.php">Εγγραφή</a></p> <?php }//end else ?>
  9. i just can't get you but thank you for your effort! this is the code that generates each news block, in index.php. <?php include("gr/database.php"); mysql_query("SET NAMES 'utf8'"); $result = mysql_query ("SELECT * FROM news"); while($row = mysql_fetch_object($result)) { ?> <dt><a href="gr/news.php?id=<?php print "$row->ID"; ?>"><?php print "$row->STITLE" ?></a></dt> <dd><a href="gr/news.php?id=<?php print "$row->ID"; ?>"><img id="mainimg" src="images/news/<?php print "$row->IMAGE" ?>" /></a><?php print "$row->SDES" ?></dd> <?php } mysql_free_result($result); $c=mysql_close(); ?> and this is what news.php page does... <?php include("database.php"); $id = $_GET['id']; mysql_query("SET NAMES 'utf8'"); $result = mysql_query ("SELECT * FROM news WHERE news.ID='$id'"); $row = mysql_fetch_object($result); ?> <div class="item"><p><img src="../images/news/<?php print "$row->IMAGE"; ?>" /><span class="title"><?php print "$row->TITLE";?> </span><?php print "$row->DESCRIPTION"; ?></p></div> <?php mysql_free_result($result); $c=mysql_close(); ?>
  10. i understand your point. BUT the problem is that the value of the session variable must be set/changed when a link is pressed. if i can do this..then problem solved.
  11. i'm not quite sure that this is the case... i'll try to explain bettter... the thing is that the $id is used in a query to find the news id and show only the 3 latest news. after that each of the 3 links i have in index.php for different news, set the id value to the news page and again $id is used by the news page in a query in order to show only the description of the news with the id which was passed from index.php. this works perfectly except when hitting the login button, in the form placed in the news page, cause login goes to checklogin.php, and redirects back, and that's why news page doesn't know what news id to show.
  12. haha there has to be sth magical with this forum ;D. Even though the answers don't solve my problems (till now only 5 posts, i'm sure here i can get help, one of the best forums i have ever visited ), a mystical power makes me look in the right direction.. ok i solved the problem. The problem is that... for all the coding, i use dreamweaver. The code seamed clean BUT in modify->page properties -> title/encoding... except from the encoding (utf8), there is a checkbox that says include Unicode Signature (BOM). I had this ticked by mistake. But it's very odd. The code is exactly the same with this turned on and off. p.s Anyone knows what this BOM is?
  13. what do you mean the end of it? it ends like this.... </html>(no whitespace. nothing after that) actualy i tried removing all the other html code leaving only this simple php, and again the same problem...so it had to be sth else...??
  14. <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> etc ???
  15. ok.. but i only know that in links you can set variables like this...?id=3 how can i set session variables when a link is pressed? sth like ?session['id']=3; ?
×
×
  • 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.