Jump to content

DJTim666

Members
  • Posts

    212
  • Joined

  • Last visited

    Never

Everything posted by DJTim666

  1. uhh i didn't notice you couldn't see the tags, but they are [ b ] and [ /b ] And how would I counnt all occurances of a tag?
  2. I created a function that allows me to filter words, add tags and some other stuff. But I realized that if someone messes up a tag and forget to add then everything after their post becomes bolded. Is there anyway to stop this from happening?
  3. Once again, posting the field will count all the letters in the field. I only want to count a continuous word.
  4. Doesn't work sorry. Never has worked. If you read through that function, it only wraps WORDS in a string .
  5. On my website, I am using basic tables and everyone knows if you type something like the following it will stretch the table to unbelievable lengths. Word: wert23rtw2tergwergwr83dty5754c7n53yv59t7vn358935yhmc5t735ytn75mcn73v5tv78935hym357tvm9357yhc3579thc4tgciwhomhegmvy2893589t3yvn59357y635nic9n5y I want to know if there is an existing function in PHP to break the word when it gets to a certain length. -- DJ
  6. All you have to do it use the filename. The persons browser should know what URL to go to depending on what is in the users address bar. So code like this. <?php echo "<a href='somefile.php'>somelink</a>"; ?> This will go to either domain depending on the URL in the users address bar. So if the user is at .com it will go to "example.com/somefile.php". If the user is at .net, it will go to "example.net/somefile.php". Hope that helps. -- DJ
  7. I was wondering if there was a way to display a message while a script loads. I have a safety deposit box script, and if people have alot of items, it takes a while to load the script. So some people are sitting at a dead page for a couple seconds. So to inform them that their page is being processed, I would like to display a message while the script loads up everything from the database. I am not aware of a function that does this, but maybe someone else does. If someone could point me in the right direction that would be great. Thanks. -- DJ
  8. Apparently the forth variable counts the number of replacements. Topic solved.
  9. I am just wondering if it is possible to use str_replace(); to replace 2 variables before updating a database. e.g; <?php $post = $_POST['something']; $post2 = $_POST['something_else']; $string = array("hello"); $replace_string = array("hi"); str_replace($string, $replace_string, $post, $post2); ?> Will this work? -- DJ
  10. When you are posting a topic, ALWAYS post code to go along with it. Posting topics without code are useless.
  11. Yeah I'm aware of that. But I've made it so that if the item isn't in their shop the script dies before the do statement is executed. EDIT: Anyways, thanks for your opinion. I am pretty sure it's gunna do what I need it to do. Topic Solved !
  12. Replace this; $query = "SELECT username, firstname, lastname FROM users WHERE id = '.$_SESSION['id'].'"; With this; $query = "SELECT username, firstname, lastname FROM users WHERE id = ".$_SESSION['id'].""; That should work. Whenever you are using ' . . ', don't use single quotes( ' ), use double quotes( " ). Hope that works/helps. -- DJ
  13. I want to know if the way I have done my code is correct or not. <?php if ($act == 'prices') { echo "<table border='1' width='100%' bordercolor='blue'> <tr> <td><b>Item</b></td> <td><b>Price</b></td> <td><b>Remove</b></td> </tr>"; if (!mysql_num_rows($query)) { showerror("<tr><td colspan='3'>You don't have any items in your shop.</td></tr></table>"); } echo "<form action='$PHP_SELF?act=doprices' method='post'>"; $pr = 1; while ($row_shop = mysql_fetch_array($query)) { echo "<tr> <td><img src='" . $row_shop['image'] . "'><br />" . $row_shop['name'] . "</td> <td><input type='text' size='10' name='price" . $pr . "' value='" . $row_shop['shop_price'] . "' /><br />Low. Price: ....</td> <td>[Remove 1]<br />[Remove All]</td> </tr>"; $pr++; } echo "<tr><td colspan='3'><input type='submit' value='Change Prices' /></td></tr>"; echo "</from></table>"; } if ($act == 'doprices') { $f = 1; do { $newprice = mysql_fetch_array($query); $price = $_POST['price' . $f . '']; $arrayit = array($price); foreach ($arrayit as $new) { if ($new == '') { showerror("You can't update an item with no price."); } if (!is_numeric($new)) { showerror("You have entered a non-numeric value."); } mysql_query("UPDATE user_items SET shop_price=" . $new . " WHERE ID=" . $newprice['ID'] . ""); } $f++; } while ($f <= mysql_num_rows($query)); } require_once("footer.php"); ?> This code does exactly what I want it to do. It's just that I haven't seen to many people using do {} while (); statements. -- DJ
  14. Ok, now I have my foreach statement. How would I store 20 new prices into an array?
  15. I've been looking at that page for the past 3 hours, and nothing is helping me o_O!
  16. I am asking before I start coding so maybe I can get an idea as to what I need to do. An example would be nice.
  17. But, they would be updating all 20 items with different prices. Here is the code I have so far; <?php require_once("core.php"); loggedin(); $shopID = $_GET['shopID']; $shopID2 = mysql_query("SELECT * FROM usershops WHERE owner='" . $Yourname . "'"); $shopID3 = mysql_fetch_array($shopID2); echo "<h3>Your Shop</h3>"; echo "<a href='$PHP_SELF?act=prices'>Edit Prices</a> | <a href='viewshops.php?shopID=" . $shopID3['id'] . "'>View Your Shop</a>"; if (!$act) { if (!mysql_num_rows($shopID2)) { echo "You don't have a Shop yet. Click <a href='$PHP_SELF?act=create'>here</a> to create one. Creating a shop costs 1,500 RBC."; die(); } else { echo "Welcome to user shops. Please navigate around using the links above."; } } if ($act == 'create') { $description = $_POST['descrip']; $shop_name = $_POST['shop_name']; $safe_shop_name = mysql_real_escape_string(striptags($shop_name)); $safe_description = mysql_real_escape_string(striptags($description)); if (!isset($shop_name)) { echo "<form action='$PHP_SELF?act=create' method='post'> Shop Name: <input type='text' name='shop_name' /><br /> Description: <input type='text' name='descrip' size='30' /><br /> <input type='submit' value='Create Shop' /> </form>"; } if (isset($description)) { if (mysql_num_rows($shopID2)) { showerror("You already have a shop. Why do you need another?"); } if (empty($description) || empty($shop_name)) { showerror("You left one of the required fields blank."); } if ($userinfo['point'] < 1500) { showerror("You don't have enough RBC to create a shop."); } } else { mysql_query("INSERT INTO usershops(owner, description, shope_name) VALUES ('" . $Yourname . "', '" . $safe_description . "', '" . $safe_shop_name . "')"); echo "You have just created a shop. You may now sell all the items you like."; } } if ($act == 'prices') { $query = mysql_query("SELECT * FROM user_items WHERE location=3 AND owner='" . $Yourname . "'"); echo "<table border='1' width='100%' bordercolor='blue'> <tr> <td><b>Item</b></td> <td><b>Price</b></td> <td><b>Remove</b></td> </tr>"; while ($row_shop = mysql_fetch_array($query)) { echo "<tr> <td><img src='" . $row_shop['image'] . "'><br />" . $row_shop['name'] . "</td> <td>lalala</td> </tr>"; } } require_once("footer.php"); ?> EDIT: Noticed a couple errors. Fixed them !
  18. I am currently coding usershops for my website where users will be able to sell their items. I need help making it so that users can price multiple items all at once. I am thinking maybe a foreach statement or something but I am not 100% sure. What I want to happen is this; The user has 20 items in their shop, they price all 20 items, and hit submit, and it prices all of those items. Sorry if this doesn't make to much sense. MSN: djtim2005@gmail.com AIM: Freudian666 Feel free to add me so I can explain further ! -- DJ
  19. Nevermind, I figured it out. Thnx for the help !
  20. err, you confused me there. Am I still using the while statement, or do I just need a mysql_fetch_array?
  21. I need to add a bunch of results coming from a DB. I tried doing a simple while statement with a plus sign, but that failed because all it's doing is echoing all the numbers =O! Code: <?php while ($rowpageviews = mysql_fetch_array($pageviews)) { $additup = ++$rowpageviews['pageviews']; echo $additup; } ?> All thats dfoing is echoing all the number's in the DB. Any suggestion on how to add them together? -- DJ
  22. Yes, I see nl2br(); is a much easier way to ouput linebreaks. Thank you very much for that information! -- DJ
  23. I got it to work when I display the data from the database. But when I use str_replace() to insert data into the DB it should be putting a < br / > on every linbreak. Any idea why that's not working?
  24. This code is for a forum that I coded. RIght now the database holds; hello hello testing! I want it to be holding; hello < br / > < br / > hello < br / > < br / > testing! My string holds the content for the textarea. It's for replies to a topic.
×
×
  • 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.