Jump to content

phingoc

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by phingoc

  1. Hi. When i fill out my form and press "send", i get a email, so that is working.. But the email only contains "name" and "subject".. The senders email adress and message is missing from the mail i reciev. Form <form name="contact" method="POST" action="send_contact.php"> <br><br> <img src="img/name.png"><br> <input type="text" name="name" id="name" size="25"><br><br> <img src="img/email.png"><br> <input type="text" name="email" id="email" size="25"><br><br> <img src="img/subject.png"><br> <input type="text" name="subject" id="subject" size="25"><br><br> </td> <td width="55%" valign="top"> <br><br> <img src="img/message.png"><br> <textarea rows="8" cols="35" type="text" name="message" id="message"></textarea><br><br> <div align="right"><input type="image" src="img/submit.png" value="submit"></div> </form> And "send_contact.php" <?php $name = $_POST['name']; $subject = $_POST['subject']; $email = $_POST['email']; $message = $_POST['message']; $to = "xxx@xxx.xx"; mail("$to","$subject","$message","from:$name<$email>") or die("Something went wrong, please go back and try again."); echo "Thank you for contacting me."; ?> What to do?
  2. Warning: mysql_num_rows() expects parameter 1 to be resource what am i doing wrong? i have checked, double checked and tripple checked everything. include("mysql_connect.php"); $query = "SELECT * FROM prod2011 WHERE dato BETWEEN '$nyfra' AND '$nytil'"; $antall = mysql_num_rows($query); // I get error on this line. echo "Antall linjer i listen: " . $antall;
  3. found out a way to sort it out. $endredato = strtotime($dato); $nydato = date('d-m-Y', $endredato); easy, but had to change about 15 php files. Thank you guys for answers.
  4. <input type="text" size="12" maxlength="10" name="dato" value="<?php echo date('d.m.Y'); ?>"> user has the ability to remove the php generated date, and input his own date.
  5. yeah... in norway, we use dd.mm.yyyy, but mysql date uses yyyy.mm.dd.. Is there any php lines i can use to rearrange the input dates? And also, rearrange the date when i query the mysql for the dates?
  6. thank you. that sorted it out, but that brings a new problem that i will make a new tread for under php help.. becouse in norway, we use dd.mm.yyyy, so all my inputs will be in that format, and then the dates dont get stored right in the db.
  7. if i change it to date, mysql will automaticly sett the current server date when the row is created? since in the add form, i need to add another date, than the current server date..
  8. Hi. i want to sort out mysql rows and display them only between dates. The date is stored inn dd.mm.yyyy... i have now 3 entries in the DB (just for testing); 04.12.2011 02.12.2011 04.12.2011 when i try to fetch rows between dates: 01.12.2011 and 03.12.2011, i get 1 return witch is correct.. 01.12.2011 and 05.12.2011, i get 3 returns witch is correct.. 03.12.2011 and 05.12.2011, i get 2 returns witch is correct.. But.... when i try between 01.01.2000 and 01.01.2020, i get 0 returns.. why? I works when between 01.01.2000 and 31.12.2020... form <form method="POST" action="listebetween.php" target="_BLANK"> <table width="600" border="0"> <tr> <td width="50%" align="center">Fra dato:<input type="text" name="fra" maxlength="10" size="12"></td> <td width="50%" align="center" rowspan="2"><INPUT TYPE="submit" VALUE="Utfør"></td> </tr> <tr> <td width="50%" align="center">Til dato:<input type="text" name="til" maxlength="10" size="12"></td> </tr> </table></form> script <?php include("mysqlconnect.php"); $fra = $_POST['fra']; $til = $_POST['til']; $query = "SELECT * FROM prod2011 WHERE dato BETWEEN '$fra' AND '$til'"; $result = mysql_query($query) or die(mysql_error()); echo "<center><table border='1'>"; echo "<tr> <th width='90'>Dato</th> <th width='90'>Ordre</th> <th width='50'>Solgt</th> <th width='50'>Brukt</th> <th width='100'>Kommentar</th> </tr>"; while($row = mysql_fetch_array( $result )) { echo "<tr><td>"; echo $row['dato']; echo "</td><td>"; echo $row['ordre']; echo "</td><td>"; echo $row['solgt']; echo "</td><td>"; echo $row['brukt']; echo "</td><td>"; echo $row['kommentar']; echo "</td></tr>"; } echo "</table>"; ?>
  9. thanks.. changed this line "SELECT id, title, author, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM news_posts ORDER BY DATE DESC";
  10. Hi. How can i order the news that gets viewed by date? newest first. <?php include ('mysql_connect.php'); $query = "SELECT id, title, author, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM news_posts"; $result = @mysql_query($query); if ($result) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $url = 'comments.php?id='.$row['id']; echo '<p><b>'.$row['title'].'</b><br /> '.$row['sd'].'<br /> Skrevet av : <b>'.$row['author'].'</b><br /><br /> '.$row['post'].'<br /><br /> <a href="javascript:openComments(\''.$url.'\')">Legg til eller les komentarer.</a></p><br /><hr>'; } } else { echo 'Det er for tiden ingen nyheter'; } ?>
  11. Hi. i get this error msg when trying to run this script: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\reg.php on line 14 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\reg.php on line 20 reg.php <?php $connect = mysql_connect("localhost","xx","xx") or die("Kunne ikke koble til database."); mysql_select_db("xxx") or die("Kunne ikke finne database"); $username = $_POST['brukernavn']; $password = $_POST['passord']; $confirm_password = $_POST['confirm_password']; $email = $_POST['epost']; $name = $_POST['navn']; $place = $_POST['bosted']; $queryuser=mysql_query("SELECT * FROM brukere WHERE brukernavn='$username' "); $checkuser=mysql_num_rows($queryuser); if($checkuser != 0) { echo "Beklager, ".$username." er allerede i bruk. Venligst velg ett annet brukernavn."; } else { $querymail=mysql_query("SELECT * FROM brukere WHERE epost='$email' "); $checkmail=mysql_num_rows($querymail); if($checkmail != 0) { echo "Beklager, ".$email." er allerede i bruk."; } else { if($password != $confirm_password) { echo "Passordene du tastet matcher ikke."; } else { $insert_user=mysql_query("INSERT INTO brukere (brukernavn, passord, epost, navn, bosted) VALUES ('$username', '$password', '$email', '$name', '$place')"); if($insert_user) { echo "Gratulerer, du er nå registrert. Du kan nå logge inn på venstre side."; } else { echo "Noe galt skjedde under registreringen, venligst gå tilbake og prøv på nytt."; } }}} ?> Someone know why? i have check, double checkd and tripple checkd the variables in the script, form and database.
  12. Thank you. Removed all empty lines before session_start(); and additional moved "session_start();" from the script to line 2. Thank you so much!
  13. loginform.php login.php (where session is created)
  14. Hi. Link to project: www.smarttreff.moo.no Login user: admin login pw: 123 When i login the login form wont disapear. If i return to the index(Hjem) page without logging out, the loginform disapear. I am ussing session for the login So the basicly, i want the loginform do disapear at once when the user has pushed login button(Logg in) (dont laught at my "cut and past" for the include meny.. i just made the design and chopped it to bits and put it into includes) Index.php <?php session_start(); include("css.php"); include("header.php"); include("meny.php"); ?> <td width="596" valign="top"><table width="100%" border="0" cellpadding="15"> <tr> <td class="tabell" valign="top" align="left"> Main </td> </tr> </table></td> </tr> </table> <?php include("footer.php"); ?> meny.php <table width="800" border="0"> <tr> <td width="198" valign="top"><table width="100%" border="0" cellpadding="15"> <tr> <td align="left" valign="top" class="tabell"> <a href="index.php">Hjem</a> <br /> Når og hvor <br /> For hvem <br /> Spørsmål og svar<br /> Forum <br /> <br /> <br /> Samarbeidspartnere </td> </tr> </table> <br /> <table width="100%" border="0" cellpadding="15"> <tr> <td class="tabell" valign="top" align="left"> <?php if(isset($_SESSION['username'])) echo "Velkommen, " .$_SESSION['username']. "!<a href='innlogget.php'>Medlemsnyheter</a><br><a href='logout.php'>Log ut</a>"; else { include("loginform.php"); } ?> </td> </tr> </table></td> <td width="15"> </td>
×
×
  • 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.