Jump to content

gsencan

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gsencan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yes missed that , it echo nothing. So that solves this problem but opens another 1 ... thx .
  2. when i enter aaa to first name and leave all fields blank it still gives the error ---->The First Name you entered does not appear to be valid. For example
  3. Iwant to make a contact us script and here is done so far. I am almost sure its about preg match filters but cant find a solution why it doesnt work. Appreciate any help. Here is my code: $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $email_from = $_POST['email']; $comments = $_POST['comments']; $emailtrue = '/^([A-Za-z0-9-_]+@[A-Za-z0-9-_]+\.[A-Za-z]{2,4})$/'; $nametrue = "/^[A-Za-z]+$/D"; if(!preg_match($nametrue,$first_name)) { echo "The First Name you entered does not appear to be valid."; die (); } if(!preg_match($nametrue,$last_name)) { echo "The Last Name you entered does not appear to be valid."; die (); } if(!preg_match($emailtrue,$email_from)) { echo "The Email Address you entered does not appear to be valid."; die (); } if(strlen($comments) < 4) { echo "The Comments you entered do not appear to be valid. Min. 4 letters." ; die (); } $to = xxxxxxxxxx.com'; $subject = 'User Email'; $headers = 'From: '.$email_from. "\r\n" . 'Reply-To: '.$email_from. "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $comments, $headers);
  4. I used this code it works for me. So it shows most recent 20 to 40 data(20 data per page). <?php mysql_connect("AAA", "BBB", "CCC") or die(mysql_error()); mysql_select_db("DDD") or die(mysql_error()); $result = mysql_query("SELECT * FROM mytable WHERE CATEGORY='SPORTS' ORDER BY DATE DESC LIMIT 20, 40") or die(mysql_error()); while($row = mysql_fetch_assoc($result)){ echo 'blablabla'; } ?>
  5. <?php mysql_connect("AAA", "BBB"CCC") or die(mysql_error()); mysql_select_db("DDD") or die(mysql_error()); $result = mysql_query("SELECT * FROM image WHERE CATEGORY='SPORTS' ORDER BY DATE DESC") or die(mysql_error()); $row = mysql_fetch_array( $result ); echo 'blablabla'; ?> Here i want to show 20 data from my database by newest time. DATE is a timestamp (current time )field in my database. so i think i have to use foreach statement but, what should i use when i want to show again 20 data in another page but now: newest from 20 to 40 or 40 to 60? I hope i put it out clear .
  6. Last code is a bit advanced for me but ty i will try both.
  7. Yes true i want to show 20 results in a page but with using $date as a key so i can choose it between => 20 and 40 or 40 and 60
  8. Well yes i should name it as $ID <?php $file = file_get_contents('TEXT.txt'); $lines = explode("\n",$file); $myArray = array(); foreach($lines as $line){ $fields = explode(",",$line); $date = array_pop($fields); $myArray[$date] = $fields;} ksort($myArray); for ($count = 0; $count >= 20;) ; <= Something like this? foreach($myArray as $date => $values){ if($count >= 20) break; echo 'blablabla'; $count++;} ?>
  9. $count = 0; foreach($myArray as $date => $values){ if($count >= 20) break; echo 'blablabla' ; $count++;} i am using $date as a key, and i want to start counter if $date is bigger then 20 php operates in order so i guess i have to put something before $count command so it must be something like this : if ($date >=20) {$count = 0;} foreach($myArray as $date => $values){ if($count >= 20) break; echo 'blablabla' ; $count++;} all suggestions are welcome.
  10. i put it inside <div> it worked ty. Actually it is a part of your php code which you gave me in a help topic about flatfile database
  11. echo '<div class="gamename">'.$values[0].'</div>'; echo '<div class="gameimage"><a href="'.$values[3].'"><img src="'.$values[1].'"></a></div>'; NOW i want 2nd echo under 1st echo. I tried every single <br> combination but no luck Also my 2nd question is: my image and link is a variable, it displays the image but there is something wrong with link. Variable is just like this www.mydomain.com\image\blabla.php but it shows link as==> www.mydomain.com\ instead of what i wrote above.
  12. I see... so : id INT NOT NULL AUTO_INCREMENT, category VARCHAR(20) NOT NULL, imagename VARCHAR(30) NOT NULL, date datetime NOT NULL, PRIMARY KEY(id) i was thinking something like adding time manually in 20110814100102 format (because every date-time has a unique number) but its ridiculous i guess.
  13. Ok 1 last question about structure it will be like this: CATEGORY / IMAGENAME / IMAGEPATH / IMAGEURL / DATE(added) I will only show image name and image by date on site so as i know so far : id INT NOT NULL AUTO_INCREMENT, category VARCHAR(20) NOT NULL, imagename VARCHAR(30) NOT NULL, imagepath VARCHAR(60) NOT NULL, imageurl VARCHAR(60) NOT NULL, date INT NOT NULL, ==> like : 20110914124005 PRIMARY KEY(id) is it ok?
×
×
  • 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.