PHP - Wont Md5?
Why isn't this working?
elseif($db_password==md5($password)) Similar Tutorialsi need help trying to get this delete feature to work its not deleting from the database (by the way i took out my database names and passwords at the top of the file) is it possible someone could help me, ive been working on this for like a week and cant figure out the problem. thanks! you can email me at spr_spng@yahoo.com picture 2.png is showing what it looks like Code: [Select] <?php $host="localhost"; // Host name $username="username"; // Mysql username $password="password"; // Mysql password $db_name="database_name"; // Database name $tbl_name="table_name"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); $count=mysql_num_rows($result); ?> <style> /*table affects look of the whole table look */ table { margin-left: auto; margin-right: auto; border: 1px solid #330000; border-collapse:collapse; width:70%; border-width: 5px 5px 5px 5px; border-spacing: 1px; border-style: outset outset outset outset; border-color: #330000 #330000 #330000 #330000; border-collapse: separate; background-color: #330000; #800517 f535aa #330000 school color #9A0000 school color2 #991B1E school color3 #CCCC99 school color4 #9A0000 } /*th is table header */ th { text-align: left; height: 2.5em; background-color: #330000; color: #FC0; font-size:1.5em; } /*td is table data or the cells below the header*/ td { text-align: left; height:1.0em; font-size:1.0em; vertical-align:bottom; padding:10px; border-width: 5px 5px 5px 5px; padding: 8px 8px 8px 8px; border-style: outset outset outset outset; border-color: #9A0000 #9A0000 #9A0000 #9A0000; background-color: #CCCC99; -moz-border-radius: 0px 0px 0px 0px; } </style> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td><form name="form1" method="post" action=""> <table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td bgcolor="#FFFFFF"> </td> <td colspan="4" bgcolor="#FFFFFF"><strong>Pick Which Rows you want to delete, Then press delete.</strong> </td> </tr> <tr> <td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Name</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Lastname</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Email</strong></td> <td align="center" bgcolor="#FFFFFF">delete</td></tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td> <td bgcolor="#FFFFFF"><? echo $rows['name']; ?></td> <td bgcolor="#FFFFFF"><? echo $rows['lastname']; ?></td> <td bgcolor="#FFFFFF"><? echo $rows['email']; ?></td> <td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td> </tr> <?php } ?> <tr> <td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr> <? // Check if delete button active, start this // edited if($delete){ for($i=0;$i<$count;$i++){ $del_id = $checkbox[$i]; $sql = "DELETE FROM $tbl_name WHERE id='$del_id'"; $result = mysql_query($sql); } // if successful redirect to delete_multiple.php if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;URL=delete_multiple.php\">"; } } mysql_close(); ?> </table> </form> </td> </tr> </table> $last = mysql_query("SELECT MAX('id') FROM comments WHERE submittedby='$username'"); can any1 help me? Ok, I am a complete noob when it comes to php. I am slowly learning it but I turned to youtube for a tutorial on a registration/login page. I found a good tutorial http://www.youtube.com/watch?v=ngqeWUIDlnk&feature=channel but for some reason my php is NOT working. I have it exactly the way he does but it wont echo anything or work at all. The login page worked great in his tutorial. What do I have wrong? I cant figure it out. Please help! echo "<h1>Register</h1>"; $submit = $_POST['submit']; $fullname = strip_tags($_POST['name']); $username = strip_tags($_POST['user']); $password = strip_tags($_POST['password']); $verifypassword = strip_tags($_POST['verifypassword']); $date = date("Y-m-d"); if ($submit) { if($fullname&&$username&&$password&&$verifypassword) { password = md5($password); verifypassword= = md5($verifypassword); } else echo "Please fill in all fields!"; } Code: [Select] <html> <form action='register.php' method='POST'> <table> <tr> <td>Full Name:</td> <td><input type='text' name='name'></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='user'></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='password'></td> </tr> <tr> <td>Verify Password:</td> <td><input type='password' name='verifypassword'></td> </tr> </table> <p><input type='submit' name='submit' value='Submit'></p> </form> </html> For some reason i cannot for the life of me find, from the below code, <? echo $price ?> is returning nothing, could someone please take a look at this and explain to me where I'm going wrong, Would appreciate it tonnes, Thanks Freddy. Code: [Select] <?php //get item information $AttributeID = mysql_real_escape_string($_GET['AttributeID']); $sql = "SELECT * FROM attributes as a WHERE a.id = $AttributeID"; $query = mysql_query($sql) or die(mysql_error()); $attribute = mysql_fetch_array($query); $price = $attribute['SkillPoints']; //check for attribute $sql = "SELECT * FROM player_attributes WHERE player_id = $playerID AND attribute_id = $AttributeID"; $query = mysql_query($sql) or die(mysql_error()); $att = mysql_fetch_array($query); $quan = $att['quantity']; if ($quan == 0){ $quan = 0; }else{ $quan = ($quan); } if($quan == 0) { $price = ($price); }else{ } if ($quan >='1'){ $price = ($quan + $price); } ?> Hey all, I have an odd problem that I hope someone here has had and knows how to fix. I recently installed Apache, PHP, and MySQL on a new server we have at work. Everything works fine, oddly enough, except for PHP parsing. You see the following code: Code: [Select] <? echo "test"; ?> Will display the PHP code, while Code: [Select] <?php echo "test"; ?> Will echo "test". The problem seems to be that PHP isnt parsing the <? directive as a start command. Does anyone have any idea why this might be? Thanks for any help. hi guys hope some1 can help. im creating a system that will allow stock to be added to a database and modifed. However on the add section, nothing adds it only inputs a new id row in the database and the other fields are blank. Can anyone have a look for me This sections is the form handler once the user has input a stockname and stock qty Code: [Select] <?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" /> <title>stock</title> </head> <body> <?php $stockname = &$_POST['stockname']; $stockqty = &$_POST['stockqty']; $connect = mysql_connect("localhost","root", "") or die ("Couldn't Connect!"); mysql_select_db("stock", $connect) or die("Couldn't find db"); // select database $query = mysql_query("SELECT * FROM stocks WHERE stockname=$stockname, stockqty=$stockqty"); $numrows = mysql_num_rows($query); if ($numrows!=0) { echo("Item already exists! Try Updating the items instead!"); } else { $queryreg = mysql_query("INSERT INTO `stock` . `stocks` (`id`, `stockname`, `stockqty`) VALUES (NULL,'$stockname','$stockqty')"); echo("stock added!"); } ?> <center><table> <tr> <td> Stock_id </td> <td> Stock_name </td> <td> Stock_Qty </td> </tr> </table></center> </body> </html> Thanks Lance HI im having a problem displaying an image in an iframe or img tag on my php page if i set the source to google it displays fine in the iframe! but if i set the source to a page on my server it doesnt display. It displays in both fire fox and chrome!???? Any help would be greatly appreciated Thanks Sean hi guys. i am trying this code: <?php count('Comedy'); ?> which is supposed to call this function: function count($cat){ $dbc = mysqli_connect('localhost', '60517', '59725972', '60517') or die ('Could connect to the sql db'); if(isset($cat)) { $query = "SELECT * FROM `movies` WHERE genre='$cat'"; } if(!isset($cat)) { $query = "SELECT * FROM movies"; } $result = mysqli_query($dbc, $query) or die('something went wrong with the query'); $movies = mysqli_num_rows($result); mysqli_close($dbc) ; echo $movies however nothing would be echoed. what am i doing wrong? i literally cant figure out whats going wrong in 6 lines of code. i am new to php so any help would be appreciated. sorry for bothering you. Hi i am trying to display image using 'CAT_BIO' => (isset($_GET['c'])) ? '<br />' '<img src="images/' . $row['image'] . ' " width="150" height="200" />' '', but i get the error Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in i think a comma or something missing can anyone spot where i am going wrong?? the other way i tried is <img src=\"images/{$row['image']}\" width=\"150\" height=\"200\" />" this one give no error bt doesnt display the anything it might be cz wrong path how do i make to go out one folder the get inside images folder?? not sure if its the solution help Any idea why I cant get the order by to work? $res = mysql_query ("SELECT COUNT(*), LEFT(`comment`, 3) AS truncated from comments where navn='$rows[navn]' AND adresse='$rows[adresse]' ORDER BY time desc" ) or die(mysql_error()); any help with this please? it works fine with deleting database results but the unlink wont unlink file from dir? Code: [Select] else if($action=="del") { $id = $_GET["id"]; $cls = $_GET["cls"]; $dir = "gallery/$cls"; echo "<p align=\"center\">"; $owner = mysql_fetch_array(mysql_query("SELECT uid FROM gallery WHERE id='".$id."'")); if(mod(getuid_id($id))||getuid_id($id)==$owner[0]) { $res = mysql_query("DELETE FROM gallery WHERE id='".$id."'"); $res2 = mysql_query("DELETE FROM comments WHERE pid='".$id."'"); $res3 = mysql_query("DELETE FROM rate WHERE pid='".$id."'"); if($res||res2||res3 || unlink($dir)) { echo "Photo Deleted From Gallery<br/>"; }else{ echo "Database Error!<br/>"; } }else{ echo "You can't delete this Photo"; } hello i have this code here to delete people form a call list but it is not deleting form it could I get a some help? the form Code: [Select] <?php include '../config.php'; $query="SELECT * FROM call_list WHERE ecs = 'Jam' order by date desc"; $result=mysql_query($query); echo mysql_error(); //////////////// Now we will display the returned records in side the rows of the table///////// while($row = mysql_fetch_array($result)) { echo " <table id='call_list'> <form name='Call_delet' action='del.php' method='get'> <tr> <td class='call_names'> $row[Fname] $row[Lname] </td> <td class='call_numbers'> $row[phone] </td> <td class='call_email'> $row[email] </td> <td class='call_email'> $row[calltime] </td> <td> <a href='del.php?del=$row[id]'>Del</a> </td> </tr> </form> </table> "; } ?> del.php page Code: [Select] <?php include '../config.php'; if (isset($_GET['id']) && is_numeric($_GET['id'])) { $id = $_GET['id']; $result = mysql_query("DELETE FROM call_list WHERE id=$id") or die(mysql_error()); header("Location: view.php"); } else { echo"dident work"; } ?> I have the code echoing into the next page where it says your mail was sent successfully but it wont email me all the variables here is the code: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Submitted Form</title> </head> <body> <?php session_start(); echo "<html> <head><title>Posted Variables</title></head> <body>"; $to = "artdept@calmktg.com"; $subject = "SCE SONGS ORDER FORM"; $email = $_REQUEST['email']; foreach ($_POST as $field => $value) { echo "$field = $value<br>"; } $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> </body> </html> please help me out if you need anything else just ask....my email is artdept@calmktg.com why cant I get this to echo? something so simple i dont understand what im doing wrong. can i simply not beable to display a sql timestamp with out converting 2011-12-19 14:57:45 Code: [Select] <?php $ban3 = "SELECT date FROM banned WHERE id = '".mysql_real_escape_string($_SESSION['user_id'])."'"; $ban2 = mysql_query($ban3) or die(mysql_error()); $ban1 = mysql_fetch_array($ban2); $pop = $ban1['date']; echo $pop; ?> For some reason this wont work.. Index is jsut returned blank ... Hmm Index.php : <?php include("http://www.website.com/cookie.php"); ?> Cookie.php: <?php if (isset($_COOKIE["background"])) $background = $_COOKIE['background']; else $background = " bgcolor='#FFFFFF'"; ?> It works perfectly if I just enter the code without using a include ... whats wrong in here for i get query failed everytime i submit the form? Code: [Select] //Create INSERT query $qry = "INSERT INTO class_members (user_name, passwrd, f_name, l_name, email, gender, date) VALUES('$user_name','".md5($_POST['password'])."','$f_name','$l_name','$email', '$gender','gmdate($date)',)"; $result = @mysql_query($qry); //Check whether the query was successful or not if($result) { header("location: register-success.php"); exit(); }else { die("Query failed"); } Hey all Hope ya can help. its almost done just having problems with the new data getting inserted into the current table. Code: [Select] foreach($_SESSION as $key => $value) { $key = $value; } echo $item_number . "<br>" . $po_number . "<br>" . $lot_number . "<br>" . $amount ; $query = "SELECT * FROM invintory WHERE item_number ='$item_number'"; $result = mysql_query($query) or die ("couldnt execute query." . mysql_error()); while ($row = mysql_fetch_array($result)) { $onhand = $row['onhand']; } echo $onhand ; $newamount=$onhand+$amount; echo $newamount; [color=red]mysql_query("INSERT INTO invintory WHERE item_number ='$item_number'(onhand) values ('$newamount')");[/color] mysql_query("INSERT INTO recvied(item_number,po_number,lot_number,amount) values ('$item_number','$po_number','$lot_number','$amount')"); ?>The part in red seems to be the problem |