Jump to content

-Karl-

Members
  • Posts

    421
  • Joined

  • Last visited

Everything posted by -Karl-

  1. Not sure, the md5 looks fine to me.
  2. On your first post, where is $_POST['agree'] defined? Also, change: mysql_query("UPDATE users SET password='"$password"' WHERE id='".mysql_real_escape_string($_SESSION['user_id'])."'") To: mysql_query("UPDATE users SET password='".$password."' WHERE id='".mysql_real_escape_string($_SESSION['user_id'])."'")
  3. You'll have to show a bit more code than that tbh.
  4. ' ', is correct, it must be the ID that it's not locating. Have you tried echo'ing $_SESSION['user_id']? Or perhaps try printing the query. $query = "UPDATE users SET name = '".mysql_real_escape_string ."' WHERE id = '".mysql_real_escape_string($_SESSION['user_id']))."'"; $run = mysql_query($query); EDIT: Actually, I've just noticed there's a few errors in your line of code, try this: mysql_query("UPDATE users SET name = '' WHERE id = '".mysql_real_escape_string($_SESSION['user_id'])."'");
  5. You're very welcome silverglade, glad I could help. I remember starting out knowing nothing, coding a little bit and being happy, and then breaking it, getting annoyed because I couldn't fix it again. Then eventually fixing it and being over the moon
  6. Had a bit of a cleanup with your code so try this: <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); $host = "";//edited out $database = ""; $username = ""; $password = ""; $tbl_name = "users"; $link = mysqli_connect($host, $username, $password); $conn = mysql_connect($host, $username, $password) or die("Could not connect: " . mysql_error()); mysql_select_db($database); session_start(); if (isset($_SESSION['userid'])){ $userid=$_SESSION['userid']; echo $userid; } //$currentUser = $_SESSION['myusername']; //do some cleanup// if (isset($_POST['submit'])){ $first = $_POST['first']; $last = $_POST['last']; $dob = $_POST['dob']; $gender = $_POST['gender']; $country = $_POST['country']; $state = $_POST['state']; $town = $_POST['town']; $zip = $_POST['zip']; $email = $_POST['email']; //Clean them $first = mysql_real_escape_string($first); $last = mysql_real_escape_string($last); $dob = mysql_real_escape_string($dob); $gender = mysql_real_escape_string($gender); $country = mysql_real_escape_string($country); $state = mysql_real_escape_string($state); $town = mysql_real_escape_string($town); $zip = mysql_real_escape_string($zip); $email = mysql_real_escape_string($email); mysql_query ( "UPDATE users SET firstname='{$first}', lastname='{$last}', dob = '{$dob}', gender='{$gender}', country='{$country}', state='{$state}', town='{$town}', zip='{$zip}', email='{$email}' WHERE id={$userid}") or die(mysql_error()); } if (isset($_SESSION['userid'])){ $userid=$_SESSION['userid']; } else { $getuserid=mysql_query ("SELECT id FROM users ORDER BY id DESC limit 1") or die(mysql_error()); while ($gtuserid = mysql_fetch_array($getuserid)) { $theuserid=$gtuserid['id']; $userid=$theuserid; $_SESSION['userid']=$theuserid; $userid=$_SESSION['userid']; }//$getuserid }// IF ELSE (isset($_SESSION['userid'])) ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Connection</title> <style type="text/css"> body { font-family:Calibri; font-size:1em; } .title { font-size:1.6em; font-weight:strong; } .links a{ font-size:1.2em; text-decoration:none; } .links a:hover{ font-size:1.2em; color:#0066FF; text-decoration:none; } </style> </head> <body> <p><span class="title">Add your personal information/span></p> <form action="thebeast.php" method="post"> <p> <input type="text" name="first" size="20" id="first" /> First name<br /> <input type="text" name="last" size="20" id="name" /> Last name<br /> <input name="dob" type="text" size="20" id="dob" ; } ?> Date of Birth<br /> <input type="text" name="gender" size="20" id="gender" /> Gender <br /> <input type="text" name="country" size="20" id="country" /> Country<br /> <input type="text" name="state" size="20" id="state" /> State<br /> <input type="text" name="town" size="20" id="town" /> Town<br /> <input type="text" name="zip" size="20" id="zip" /> Zip Code<br /> <input type="text" name="email" size="40" id="email" /> Email<br /> <br /> <input type="submit" name="submit" value="Add your information" /> </form> </body> </html>
  7. Hmm, try this instead: mysql_query ( "UPDATE users SET firstname='{$first}', lastname='{$last}', dob = '{$dob}', gender='{$gender}', country='{$country}', state='{$state}', town='{$town}', zip='{$zip}', email='{$email}' WHERE id={$userid}) or die(mysql_error());
  8. Change the update line to: mysql_query ( "UPDATE users SET firstname='".$first."', lastname='".$last."', dob = '".$dob."', gender='".$gender."', country='".$country."', state='".$state."', town='".$town."', zip='".$zip."', email='".$email."' WHERE id=".$userid."") or die(mysql_error()); If that doesn't work let me know.
  9. Try: echo '<td width="230px"><li class="directory-store-name"><a href="directory/name.php?id='.$id.'" title="'.$name.'" />'. $info['name']."</li></td>\n";
  10. Think you mean print_r($qty);
  11. Something like this, perhaps? $string = "1s1,12s2,16s3,28s1"; $sep = explode(',', $string); $i = -1; while($i < count($sep)) { $exp = explode('s', $sep[$i]); echo $exp[0] . ' ' . $exp[1] . '<br />'; $i++; }
  12. <?php $string = "12s1"; $sep = explode('s', $string); $id = $sep[0]; $size = $sep[1]; echo $id . ' ' . $size; ?> That's a very simple example of how explode works, you'd have to tweak it to your liking though.
×
×
  • 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.