Jump to content

webtuto

Members
  • Posts

    117
  • Joined

  • Last visited

    Never

Everything posted by webtuto

  1. hi what is the problem in this code ---> <?php include("config.php"); $get=$_GET['cat']; $sql="SELECT * FROM `tuto` where group='$get' "; $res = mysql_query($sql) or die('Database error: ' . mysql_error()); while($row=mysql_fetch_array($res)) { echo "The title is ".$row[title]."<br>"; echo "The resume is ".$row[resume]."<br>"; echo "Written on ".$row[date]."<br><br><br><br>"; } ?> the error ---> Database error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group='Photoshop'' at line 1
  2. thanks it works thanks a lot
  3. no it didnt work and how to do that loop it tried but i failed
  4. hi here im trying to post the outputs from the database in a <select> here is the code ---> <?php $query="select * from groups order by id"; $result=mysql_query($query); $row=mysql_fetch_array($result); $cat=$row[group]; ?> <option name="<?php echo $cat; ?>"><?php echo $cat; ?></option> <tr><td><input type="submit" value="Send" name="send"></tr> </select></tr> but it gives just 1 output from the table , i want it to list me all the results !!!! *!*
  5. hi , well im trying to do a search form for my database here is the code => <?php if(!empty($_POST['search']) ) { $con = mysql_connect("localhost","root","") ; $db = mysql_select_db("test") ; $sql = "select * from webt where name='%$_POST[search]%' "; $res = mysql_query($sql) ; if (mysql_num_rows($res) == 0 ) { echo "No result"; }else{ while ($row = mysql_fetch_array($res) ) { echo $row[name]."<br><br>" ; } } }else{ echo"full the form"; } ?> <form method="post" action="search.php" > <b>Search</b><input type="text" name="search" > <input type="submit" value="Search" > </form> and in the database there is name='aa' name is the name of the column anyway when i delete "%" the code works great but when i add them it douesnt work
  6. Warning: Cannot modify header information - headers already sent by (output started at /home/www/webtutotest.freehostia.com/news/login.php:1) in /home/www/webtutotest.freehostia.com/news/login.php on line 13 Warning: Cannot modify header information - headers already sent by (output started at /home/www/webtutotest.freehostia.com/news/login.php:1) in /home/www/webtutotest.freehostia.com/news/login.php on line 14
  7. I have two login forms, one for admin, the other for members, I am using the same code for both with alternative SQL queries. The admin login works, whilst the member login doesn't. <?php include("config.php") ; if (isset($_POST['user']) && isset($_POST['password'])){ $user = $_POST['user']; $pass = $_POST['password']; $query = "select * from members where user='$user' and pass='$pass'" ; $result = mysql_query($query) ; $count = mysql_num_rows($result) ; if ($count == 1) { $timestamp_expire = time() + 365*24*3600; // Le cookie expirera dans un an setcookie('user', ($_POST['user']), $timestamp_expire); // On crit un cookie setcookie('pass', md5($_POST['password']), $timestamp_expire); // On crit un cookie echo '<meta http-equiv="refresh" content="0;url=user_p.php" />'; } else echo 'le pass ke vs aves etres est faux'; } else{ ?> <table border=0 ><caption>member login</caption> <form action="" method="post"> <tr><td><b>pseado</b><td><input type="text" name="user" ></tr> <tr><td><b>mot de passe</b><td><input type="password" name="password" ></tr> <tr><td><input type="submit" value="Entrer" ></tr> </table> <?php } ?> The errors returned are header errors, I've read the sticky too. I am not focused on security as of this moment.
×
×
  • 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.