Jump to content

Shadow Hatake

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Everything posted by Shadow Hatake

  1. okay I tried that and it add's yen signs where the breaks should be... http://www.infected-designs.com/chatbox/chatbox.php
  2. Oh okay. So how would I do this with an image?
  3. Alright I tried that and it didn't work so I decided to try a test. [code]<?php $test = "this is a test string"; $test2 = wordwrap( $test, 4 ); echo $test2; ?>[/code] and it won't wrap. http://www.infected-designs.com/chatbox/test.php
  4. Olay, so I'm making a chat box in an iamge and I want the line to stop at a certain point and make a new line. How would I do this? Here's my code. It's currently untested due to my hosting being down. [code]<?php include('dbconnect.php'); $height = 150; $width = 400; $background = 'http://www.infected-designs.com/chatbox/chatbox.png'; $im = imagecreatefrompng($background); $white = imagecolorallocate( $im, 255, 255, 255 ); $x = 32; $query = "SELECT * FROM chatbox ORDER BY id ASC"; $result = mysql_query( $query ); while( $row = @mysql_fetch_array( $result, MYSQL_ASSOC ) ) { imagestring( $im, 2, 7, $x, $row['name'].': '.$row['message'], $white ); $x = $x + 15; } header('Content-Type: image/png'); imagepng($im); ?>[/code]
  5. Odd. Would it make a difference if I was using more letters? This is the whole code I'm using. [code] <?php $test = "a"; $letters = array( 'a',   'b',   'c',   'd',   'e',   'f',   'g',   'h',   'i',   'j',   'k',   'l',   'm',   'n',   'o',   'p',   'q',   'r',   's',   't',   'u',   'v',   'w',   'x',   'y',   'z');   $replace = array( 'b5fc',   'c8hd',       'd8re',       'ej9f',       'f8jg',       'g8ph',       'hd7i',       'iokj',       'ji8k',       'kh0l',       'lbhm',       'm87n',       'nuvo',       'ohvp',       'p7yq',       'qjhr',       'ribs',       'soit',       't9nu',       'ud6v',       'v89w',       'w9sx',       'x8sy',       'y9dz',       'z8ha',       'a9jb'); echo str_replace($letters, $replace, $test); ?>[/code] http://www.infected-designs.com/replace.php
  6. Daniel0: If you read my post I tried that. It sent it into an infinite loops. hackerkts: I'll try that.
  7. Okay I have a problem. I want to echo the results of a str_replace() but when I put echo infront of it it goes into a huge loop. Here's my code: [code]<?php $test = "a b"; $letters = array('a', 'b'); $replace = array('t455', '5gr4'); str_replace($letters, $replace, $test); ?>[/code] So how should I go about doing this?
  8. I recently started a programming job and started on a tutorial to learn from. In the tutorial it talked about how the program I would be making would have a few layers. Well I got the idea for doing that for my site with php. But I'm still not great with php. What i want to do is basically have a code layer where all my php code resides, and then the interface layer where the code is displayed. Does anyone have any links suggestions, or pieces of code I can learn from?
  9. How would go about doing this? I'm putting in 7 variables, but how would I make a loop where each variable was only used once and made every possible comination?
  10. I got bored and decided to code a random ad script. And this si what I've got... [code]<?php include('dbconnect.php'); $query_link = 'SELECT link FROM ads'; $result_link = mysql_query( $query_link ); $row_link = @mysql_fetch_array( $result_link, MYSQL_ASSOC ); shuffle( $row_link ); echo '<a href="'.$row_link.'">'; $query_img = 'SELECT img FROM ads WHERE link = "'.$row_link.'"'; $result_img = mysql_query( $query_img ); $row_img = @mysql_fetch_array( $result_img, MYSQL_ASSOC ); echo'<img src="'.$row_img.'"></a>'; ?>[/code] Now when I go to test it it doesn't work. Help?
  11. [code] <?php include('dbconnect.php'); $id = $_GET['jid']; $question = $_GET['q']; if( isset( $_GET['jid'] ) ) {      if( isset( $_GET['q'] ) ) {          $query = 'SELECT '.$question.' FROM boards WHERE id = "'.$id.'"';         $result = mysql_query( $query );                              if( $result ) {             echo $result;         } else {             echo 'Error';         }     } else {         echo 'Page accessed incorrectly...';     } } else {     echo 'Page accessed incorrectly...'; } ?>[/code] All I'm getting is resource id #3 when it should be showing the query. Help?
  12. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''boardname' , 'retrievalname' , 'cat1_name' , 'cat1_q1' , 'cat1_a1' , 'cat1_q2' ' at line 1[/quote]
  13. Okay, so for a spanish extra credit project our spanish teacher asked us to create a jeaprody game. Well I decided to make mine web based and allow it to store multiple games and reuse them. Now here's my problem. I've got a query but it doesn't work. Can anyone tell what wrong with it? Due tot he size of the query I'm posting the code on another page: [a href=\"http://www.infected-designs.com/jeoprody/query.htm\" target=\"_blank\"]http://www.infected-designs.com/jeoprody/query.htm[/a]
  14. Huh? I don't get how that's stop it from adding 2 news entries to the databse.
  15. [!--quoteo(post=351746:date=Mar 4 2006, 08:59 PM:name=php_b34st)--][div class=\'quotetop\']QUOTE(php_b34st @ Mar 4 2006, 08:59 PM) [snapback]351746[/snapback][/div][div class=\'quotemain\'][!--quotec--] I recently bought PHP and MySQL Web Development by Luke Welling and Laura Thomson, it has good working examples and has been very usefull for me but that doesnt mean it will work for you. I suggest you go to your local bookstore and browse through a few before you buy one because they are not cheap. [/quote] Yeah, I'd suggest that one as well. It's extremely useful for it's secure coding section as well.
  16. Okay so I made this news system and it worked fine for a while, but now it's acting up and adding a blank entry to the databse when I post a piece of news. Code from confirm.php: [code]    } elseif( $_GET['p'] == 'news' ) {         $stat_chk_query = 'SELECT status FROM users WHERE name = "'.$_SESSION['valid_user'].'"';         $result = mysql_query( $stat_chk_query );         $row = @mysql_fetch_array( $result, MYSQL_ASSOC );                  if( $row['status'] == 2 ) {             $news_add_query = 'INSERT INTO news( title, news, date, user )';             $news_add_query .= 'VALUES( "'.$news_title.'", "'.$news_content.'", NOW(), "'.$_SESSION['valid_user'].'" )';             $result = mysql_query( $news_add_query );                          if( $result ) {                 content_box( $news_pos_title, $news_pos_content );             } else {                 content_box( $news_neg_title, $news_neg_content);             }         } else {             content_box( $news_err_title, $news_err_msg);         }[/code]
  17. well i tested it by replacing the 10's with 3's and it won't show the next/prev page at bottom, and it seems to be adding them above the last news box. EDIT: Well after palying with a little, it shows the next/prev page thing. but now how do I get it to show after last piece of news? :/ ANOTHER EDIT: I created 2 footer functions. And that fixed the placement problem. Thanks for the code. ^^;
  18. Yea it makes all the html easier to manage...well for me at least.
  19. Okay so my news script is set to view only 10 pieces of news. But I want it so that it starts a new page once I have more than 10 pieces of news. [code]<?php require("functions.php"); include("dbconnect.php"); session_start(); head1(); body1(); new_temp(); sotw(); navbar();      $start = 0; $display = 10; $query = "SELECT * FROM news ORDER BY id DESC LIMIT $start, $display"; $result = mysql_query( $query ); if ($result) {     while( $row = @mysql_fetch_array( $result, MYSQL_ASSOC ) ) {         news_box( $row['news'], $row['title'], $row['user'], $row['date'], $row['id'] );     }     mysql_free_result($result); } else {     news_box( 'Could not retrieve news entries!', 'Error', 'Error', 'Error'); }                    footer(); mysql_close($link); ?>[/code] I tried a few things but they failed....miserably.
×
×
  • 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.