Jump to content

RussellReal

Members
  • Posts

    1,773
  • Joined

  • Last visited

Everything posted by RussellReal

  1. can you give us your mysql table of the click counter.. or, atleast describe your method for counting the clicks either way the method of returning the "Most Viewed" image.. would be simple if in mysql SELECT `image_src`,`image_id` FROM `images` ORDER BY `image_clicks` DESC LIMIT 1
  2. ask in the opensource forums this is for PHP help
  3. show me the code of home/danmake/public_html/outscape.org/test/index.php
  4. Hello, even with the file given and your explanation I don't understand what exactly you want to do, and where exactly this replacement should take place.. lets play a little game: pretend I'm someone not very intelligent.. tell me step by step where and what you're doing and tell me where you hit the problem.. and the current reaction/errors.. and the desired outcome of success thanks, Russell
  5. php has xml functions, you could possibly read the content of the document into xml and then read the src of the links as attributes
  6. base_convert and to "flip" the numbers you could simply use array_walk on your exploded string for example <?php function flipele(&$ele) { $z = ''; for ($i = 0; ($a = $ele{$}) !== false; $i++) { $z = $a.$z; } $ele = $z; } $string = "0110 1011"; $arr = explode(" ",$string); array_walk($arr,"flipele"); print_r($arr); ?>
  7. $username = mysql_real_escape_string($_POST['username']); EDIT! mysql_real_escape_string(md5($_POST['password'])). if you use md5() on $_POST['password'] then there is no need to use mysql_real_escape_string as md5() returns a hash which is alphanumeric and will never contain a ' or . or % or ` or any other mysql specific characters
  8. lol ginger beat me tro the punch.. $username is coming in from a $_POST so it could have some code that would mess with your query if the user is malicious and since username would be a string you could use mysql_real_escape_string
  9. you never connect to your database, OR select a database also, you wouldn't want to search for WHERE `avatar` = '$avatar' Youw ant to find the username WHERE `username` = '$_SESSION['username']' or however you handle your data
  10. use imagecolorallocatealpha and imagefill or imagecolorallocate and imagetransparent and imagefill
  11. woooooooooooooooo thats alotta babbling lol. 1. I think you don't need to do ANYTHING to the character encoding 2. It is probably a database connection problem.
  12. $i==3; you're using the comparison operator, not to set it $i = 3; is correct
  13. echo "<tr><td>" .$row["eventId"]."</td><td>" .$row["eventName"]."</td><td>" .$row["eventLocation"]."</td><td>" .$row["eventDate"]."</td></td>" ."<td>" I know this method works with javascript.. but I am not quite sure if it works with php >.> you could do something like $a = sprintf('<tr><td>%1$s</td><td>%2$s</td><td>%3$s</td><td>%4$s</td><td><a href="edit_event.php?action=edit&eventId=%1$s'>Edit Event</a><a href="%5$s?action=delete&eventId=%1$s">Delete Event</a></td></tr>', $row['eventId'], $row['eventName'], $row['eventLocation'], $row['eventDate'], $_SERVER['PHP_SELF'] ); echo $a; OR!! $arr = array('Id','Name','Location','Date'); echo "<tr>"; foreach ($arr as $value) { echo "<td>{$row['event'.$value]}</td>"; } $id = $row['eventId']; echo "<td><a href='edit_event.php?action=edit^eventId={$id}'>Edit Event</a>"; echo "<a href='{$_SERVER['PHP_SELF']}?action=delete&eventId={$id}'>Delete Event</a></td>"; echo "</tr>"; oh and your errors.. are probably do to you trying to attach an echo to a string.. actually that IS your error.. href="edit_event.php?action=edit&eventId='.echo $row['eventId'];.'">Edit Event</a>' .'<a href="'.$_SERVER['PHP_SELF'];.'?action=delete&eventId='.echo $row['eventId'];.'">Delete ^^ errorous code
  14. $_SESSION['$_POST['$title']]= $title; ok.. idk you obviously don't see whats wrong with this picture, however I'll risk losing first post in order to FULLY explain it to you lol ofcourse you'd use the superglobal $_SESSION but you started a single quote which would denote a literal text value would follow, then terminated by another single quote.. E.G. $_SESSION['literalTextValue'] however you are doing 2 things wrong here literal strings do not evaluate variables for starters secondly you forgot a terminating quote (') My advice for you here, is to always when you're expecting to write a string, automatically write two quotes, instead of just 1 before, and 1 after.. this way you can never make this mistake again. for the variable, you need to know that that will never work and would probably not be the best option for you! plain and simple $_SESSION['title'] = $_POST['title']; would do just fine.. please don't just copy/paste the aboev.. try and know exactly why your script wasn't working, and never make the mistake again.. Happy Coding - Russell
  15. ejab, if you want add me on MSN::displayMyUserName("RussellonMSN [AT] HotMail.com") o sry RussellonMSN [AT] HotMail.com add me if you want, I have alot of people who ask for help and I give them tasks to complete to help build good coding habbits and to understand various things that they quite don't understand.. and I do it all for free, no catches. I just enjoy helping people. So anybody is welcome to my msn
  16. an array? <?php $day = date('M-d'); $holidays = array( '01-01', '01-04', '12-25' ); if (in_array($day,$holidays)) // its a holiday!! else // awww :'( ?>
  17. I personally overuse double quotes its so simple.. but a very bad practice.. and SO SLOW double quotes are evaluating quotes, single quotes are literal quotes "hello" is a literal string, but PHP does not know that and will continue through the string looking for special characters and variables.. which requires a LOOP to loop through letters, and alot of processing (much like regex would) |...+... |....+.. |.....+. |......+ NO MATCH and starts at square one.. sometimes eval quotes are good to use.. but for the most part your script will run quicker (in longer scripts) with single quotes.. just my 2 cents
  18. and don't use dreamweaverrrrr ... USE notepad!!
  19. would be nice if you came back on msn lol
  20. w3schools.com look in php for uploads EDIT:: I did it for you http://w3schools.com/php/php_file_upload.asp
  21. 1. I don't understand why you're initializing a mySQL database connection within a function.. 2. I don't see mysqli_real_escape_string, inside that function 3. If you do use it within that function, you're probably using it on the WHOLE query, not the individual values you're trying to test on.. GOOD: $var1 = mysqli_real_escape_string("omg`'%omg!"); $result = mysqli_query("SELECT * FROM `tabname` WHERE `field` = '$var1'"); BAD: $result = mysqli_query(mysqli_real_escape_string("SELECT * FROM `tabname` WHERE `field` = 'omg`'%omg!'"));
×
×
  • 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.