Jump to content

pocobueno1388

Members
  • Posts

    3,369
  • Joined

  • Last visited

    Never

Everything posted by pocobueno1388

  1. Do you have a field in one of your tables called "session_pkey" that is a primary key?
  2. Go Robyn! -cheers- (everyone can just ignore that but her )
  3. <?php $result = $_SESSION['var'] * 3.50; echo $result; ?> That will multiply whatever value is in the session with 3.50.
  4. When they log in, register the session the way I showed you. Are you doing it the old way?
  5. I just typed this up for you <?php function queryForm($field_array, $action){ echo "<form action='$action' method='post'>"; echo '<table>'; foreach ($field_array as $field){ echo '<tr>'; echo "<td>$field:</td>"; echo "<td><input type='text' name='$field'></td>"; echo '</tr>'; } echo '<td><input type="submit" name="submit" value="Submit"></td>'; echo '</table>'; echo '</form>'; } ?> Then to use it, just do this <?php $fields = array("Name", "Email", "Query"); //<--You can put as many as you want. queryForm($fields, 'script.php'); ?> You can put as many fields as you want in it, and it will automatically generate them all.
  6. <table cellspacing=0 cellpadding=3 border=0 width=70%> <tr><td align=center><h3>Welcome, <u><b><?php= $_SESSION['full_name'] ?></b> </td> </tr> </table> This part is just a guess. <?php function _SessionCreate($SessionName) { $Db=new sql; global $_SESSION_DATA; $_SESSION["$SessionName"]=md5 (microtime() . $_SERVER['REMOTE_ADDR']); $Db->exec("insert into session (sid) values ('" . $_SESSION["$SessionName"] . "')"); $_SESSION_DATA["$SessionName"]=array(); SetCookie ("$SessionName", $_SESSION["$SessionName"],0,"/"); return; } ?> I'm not really sure where your getting this from $_SESSION_DATA So I can't really help you with that one
  7. In PHP 5, to set a session, you would do this $_SESSION['name'] = "blah"; Then to echo it out, you would just do this echo $_SESSION['name']; So your definitely using some old methods.
  8. It looks like you have it working...
  9. Well, you can't really do that without AJAX. I'm not sure if thats what your looking to do though. If you want to just use PHP to display that information, just select the info from the db, and use a while loop to display them. Is that what your needing help with?
  10. Do you know exactly what that part of the script is doing? To me, it looks like they are just selecting information from the database, and possibly displaying it?
  11. No...you put them at the end of all your mysql_query()'s. Do you see this line? $result=mysql_query($sql); Change it to $result=mysql_query($sql)or die(mysql_error()); Now change this line $result2=mysql_query($sql2); To $result2=mysql_query($sql2)or die(mysql_error());
  12. You had quite a few errors in your code. See if this works for you. <?php session_start(); include("dbconnect.php"); if (!isset($_POST['UserName'])) { echo "You Must enter a username<br>"; $problem = "error"; } else { $username = $_POST['UserName']; $query = "SELECT * from TABLENAME WHERE username ='$username'"; $result = mysql_query($query)or die(mysql_error()); if (mysql_num_rows($result) > 0) { echo "Sorry that username is not available, please go back and try again.<br>"; $problem = "error"; } else { if (!isset($_POST['UserPassword'])) { echo "You Must enter a password<br>"; $problem = "error"; } if (!isset($_POST['UserDob'])) { echo "You Must enter Your date of birth<br>"; $problem = "error"; } if (!isset($_POST['UserMobile'])) { echo "You Must enter your mobile number<br>"; $problem = "error"; } if ($problem=="error") { echo "<br><b>Your registration was not sucessful</b><br>"; } else { $dob = $_POST['UserDob']; $password = $_POST['UserPassword']; $email = $_POST['UserEmail']; $mobile = $_POST['UserMobile']; mysql_query("INSERT INTO registration (username, password, age, mobile, email) VALUES ('$username', '$password', '$dob', '$mobile', '$email')") or die(mysql_error()); echo "<p>Registration sucessful, welcome to our site $username!"; } } } ?>
  13. Change this line $row = mysql_fetch_array($query) or die(mysql_error()); To $row = mysql_fetch_array($result)or die(mysql_error());
  14. Your performing a mysql_query() twice. Change this $query = mysql_query("SELECT * from TABLENAME WHERE username ='$username'") or die(mysql_error()); $result = mysql_query($query); To this $query = "SELECT * from TABLENAME WHERE username ='$username'"; $result = mysql_query($query)or die(mysql_error());
  15. Try this <?php for ($i=1; $i <= $num_cart_items; $i++) { $test1 = "". $keyarray["item_name".$i] . ".pdf"; if ($i == 1){ $test2 = "". $keyarray["quantity".$i] . ""; } if ($test2 > 0) { echo("<td><font face = \"Verdana\" size = \"2\"><a href=\"testfile.php?arg1=$test1\">click to download.[/url]</font></td>"); } else { echo("<td>No downloads left</td>"); } $test2 --; } ?>
  16. I didn't do that regular expression myself, I found it on a site and tested it. I'm pretty sure the "s" is for white spaces though. Ah, your right about it returning "Bath___Body". I didn't take into account this part of the post: "regardless of how many characters i remove i want to replace with just 1 '_'".
  17. <?php $string = "Home Accents"; $new_string = preg_replace("/[^a-zA-Z0-9s]/", "_", $string); echo $new_string ?> I was beat to it, but if that one doesn't work, here is another example.
  18. You need to put a die() at the end of all your queries. $result=mysql_query($sql)or die(mysql_error()); Do that to all of them. Then post what error you get.
  19. What is the error? Quickly looking at it, I caught this error. $sqlmas="UPDATE $tbl_name2 SET lastpost='$datetime', lastpostname='$a_name'; Change that to $sqlmas="UPDATE $tbl_name2 SET lastpost='$datetime', lastpostname='$a_name'";
  20. Do this and post what you get echo "SELECT * FROM user_comics LEFT JOIN comics ON user_comics.comic_id = comics.comic_id WHERE user_comics.user_id = '".mysql_real_escape_string($_GET['title'])."' AND type='Comic Book' $filter ORDER by comics.title, comics.issue_number $limit";
  21. It means there is something wrong with your query. Put an or die(mysql_error()) at the end of your query.
  22. No, it's not bad. Just make sure you don't put important information through the URL, such as passwords. Otherwise, it's a great method in a lot of cases.
  23. Just put it right under print "Data Written<p>"; Or if you don't want that message to show anymore, just put it right were that is.
×
×
  • 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.