Jump to content

spiderwell

Members
  • Posts

    1,008
  • Joined

  • Last visited

Everything posted by spiderwell

  1. check the users in your phpmyadmin, the error is saying bad password? also the echoed error is missing the e off the end of the username?
  2. how often does a menu change on a website? , is it really necessary to keep it in the database?, thats one extra db call on every page you dont really need i use this as a common included file for a navigation on many sites i write/have written, obviously you would adapt the output to your needs: $navarray['Logout'] = 'login.php?action=logout'; $navarray['View Exhibitions'] = 'exhibitions.php'; $navarray['My Sales'] = 'mysales.php'; $navarray['View Images'] = 'images.php'; $navarray['Consigned Images'] = 'consigned.php'; $navstring = "<div class=\"shadetabs\"><ul>"; foreach ($navarray as $key => $value) { $navstring .= "<li"; if (strpos($_SERVER['PHP_SELF'], $value)) $navstring .= " class='selected'"; $navstring .= ">\r"; $navstring .= "<a href='" . $value . "'>"; $navstring .= $key; $navstring .= "</a>\r"; $navstring .= "</li>\r"; } $navstring .= $outputstr; $navstring .= "</ul></div>"; echo $navstring; this out the menu into a <ul> list and those have so many css interpretations they can look like anything
  3. if you want to use the id from a row that you just inserted, you can call it back using mysql_insert_id() <?php session_start(); if (isset($_SESSION['id'])) { $userid = $_SESSION['id']; $username = $_SESSION['username']; $fname = $_POST['firstname']; $lname = $_POST['lastname']; $telephone = $_POST['telephone']; $city = $_POST['city']; $state = $_POST['state']; $itemname = $_POST['product_name']; $price = $_POST['price']; $details = $_POST['details']; $category = $_POST['category']; $subcategory = $_POST['subcategory']; $product_id = $_POST['product_id']; $customer_id = $_POST['customer_id']; $date_sold = $_POST['date_sold']; $sqlinsert = "INSERT INTO customers (id,firstname,lastname,telephone,city,state,product_name,price,details) VALUES('','$fname','$lname', '$telephone','$city','$state','$itemname','$price','$details')"; $enterquery = mysql_query($sqlinsert) or die(mysql_error()); $customer_id= mysql_insert_id(); $sqlinsert2 = "INSERT INTO products (id,product_name,price,details,category,subcategory) VALUES('','$itemname','$price','$details','$category','$subcategory')"; $enterquery2 = mysql_query($sqlinsert2) or die(mysql_error()); $product_id = mysql_insert_id(); $sqlinsert3 = "INSERT INTO sales (id,product_id, customer_id, date_sold) VALUES('','$product_id','$customer_id','$date_sold')"; $enterquery3 = mysql_query($sqlinsert3) or die(mysql_error()); } ?>
  4. dont you need to have .php extension though or the php wont execute?
  5. you dont need the $i counter, it will automatically set the key value when omitted, unless you want to explicitly set it of course
  6. query2 = "SELECT * FROM psychofarm_gen WHERE `id`!=".$randomNumber LIMIT 3;"; is that what you are after?
  7. Heh, no problem. Happens a lot actually. i've seen it twice and only joined last week lol. welcome to the forum too jj
  8. really i guess its down to personal preference, if you do a redirect, I am guessing you will need to send variables to that redirect, I can't see the point in that personally. you could make a function for the payment method or use an include file to keep the code seperate. I guess it boils down to if that payment process is a code you need to use on other pages or not? if not used anywhere else why not keep it all in the same page. if its used multiple times by different pages, i would put it in its own page in a function/ or in a class.
  9. the first line is what i mean by outside i.e. its not inside quotes, as you can out put variables inline "something $variable ". echo " alot of text here and then treasure holdings: ".round($row['team_treasure'],2)." and some more text here"; //works echo " alot of text here and then treasure holdings:round($row['team_treasure'],2) and some more text here"; //wont work
  10. i made a cms system which stores title,meta keywords & page content all in a db, but its much the same result really. if i really wanted to be clever, i should build a publish button to 'write' the final page in html, so the db isnt hit on every page request, but most the sites i make arent as popular as facebook so its not really an issue
  11. then do it outside of them this should work, he says without checking it echo round($row[team_treasure],2);
  12. yeah i once had to write a website using file scripting as my method of storing everything that was updateable/editable, it was a pain in the backside.
  13. is there a performance difference with doing it this way? i always use the . concatenate method , just because i find it easier to read in notepad++, lol
  14. do you want this to be able to send each member the same amount of different amounts? a form with a dropdown box with members listed with a text input next to it should get you started, however that means you would only be able to send to one member at a time. a multiselect box would bring issues of only being able to send the same amount to all members. a form a bit like this would work for one member at a time: <?php if($_POST) { $amount = $_POST['amount']; $sendtomember = $_POST['memberlist']; //i going to skip some obvious stuff like DB connecting,error trapping etc $balance = $row['field']; // execute query to get amount in DB if($amount <= $balance) { //do querys to send amount to member, and subtract from balance of sender, using $amount and $sendtomember variables } else { echo " you cannot send more than you have"; } } ?> <form method="POST"> <select name="memberlist"> <option>Choose a member</option> <option value="1">johnny</option> <!-- value is ID of user in db --> <option value="2">peter</option> </select> <input type="text" name="amount"> <input type="submit" value="send amount"> </form> obviously this code wont work, but like you said, it might point you in the right direction you could be clever and use ajax to add extra rows in the form, if user desired to send to another member, but of course that will involve having more error trapping and multiple querys to DB etc
  15. CKEDitor is also a great tool for this, it has many more functions but you can set the toolbar to do just the things you mentioned you
  16. damn i keep missing those single quote errors lol
  17. yeah I have always used server side validation for exactly this reason!
  18. you need to use the $_SESSION object to store the usrname and/or password then check for that session existing on each protected page. I would give an example but i have to go out now, sorry buddy !
  19. so no ghosts in the machine after all, shame
  20. that script is going to work, but the issue is that the loginreferingtoken.html page isnt protected by a login check, being a plain html document. what could be done is that you could set a session variable once a user is logged in, and on each page (change extenstions to .php) to check if that session is set, and if not redirect away.
  21. <tr><td>First Name:</td><td><input type="text" name="first" value="<?php echo $row['first'] ?>"> try replacing the table row entries with something like above where $row is your recordset and ['first'] is the appropriate column name from db
  22. you would use reg exp to do it, but I am not very good at them. someone will be along in a minute.
  23. you could use a JOIN query in SQL but that would give you multiple entries for profile id, personally i would do it it with 2 loops so loop through all profiles, and inside that loop, loop through all interests against the profile id function get_profile($id) { $connection = mysql_open(); $query = "SELECT * "; $query .= "FROM profiles"; $result = @ mysql_query($query, $connection); // Transform the result set to an array (for Smarty) $entries = array(); while ($row = mysql_fetch_array($result)) { $sql2 = "SELECT * FROM interests WHERE profile_id = " . $row['id'] . ";"; } mysql_close($connection) or show_error();; return $entries; } *DISCLAIMER* i havent checked this code but its just to show you what I meant
×
×
  • 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.