Jump to content

MrGarcia

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Everything posted by MrGarcia

  1. Hello there.. my webhost doesn't have Cron Jobs feature.. is there any alternative php script in able to run my php script every minute ?? i have a website containing mafia game.. it's coded in php.. i tried to use <META HTTP-EQUIV="Refresh" CONTENT="60; URL=http://test.com/run_minute.php"> but this will work only if the user is in the existing page where this code placed.. i want it something like, the http://test.com/run_minute.php will refresh every minute.. even thou the user is not on the page.. Thank you. More power..
  2. i did every you said.. but why is it.. the first time i try the editing.. its updating my database.. and display the new and edited news in my news.php but now.. i dunno why i got this problem... btw.. here's my example screenshot.. here's my latest news.. http://www.mrgarcia.co.cc/filphotos/pictures/f0c32d18043f2b782c76b61da16c07c0.png i would like to edit it.. http://www.mrgarcia.co.cc/filphotos/pictures/060448aef6d46eb5fe60dfa7f1997305.png after editing it.. i submit it.. http://www.mrgarcia.co.cc/filphotos/pictures/129ff82c9939bcee3366c33978bc5855.png and the results still the same.. http://www.mrgarcia.co.cc/filphotos/pictures/f0c32d18043f2b782c76b61da16c07c0.png [attachment deleted by admin]
  3. hi.. i have here the "edit_news.php" to edit my news in my site.. it is connected to database.. the first time i try editing.. its working.. but now.. if i edit the news, the text didn't change.. here's my code inside edit_news.phpp <?php include("config.php"); if(isset($_POST['submit'])) { // Set global variables to easier names // and prevent sql injection and apostrophe to break the db. $title = mysql_escape_string($_POST['title']); $text1 = mysql_escape_string($_POST['text1']); $text2 = mysql_escape_string($_POST['text2']); $result = mysql_query("UPDATE news SET title='$title', text1='$text1', text2='$text2' WHERE newsid='$newsid' ",$connect); echo "<b>Thank you! News UPDATED Successfully!"; echo "<meta http-equiv=Refresh content=2;url=admin.php>"; } elseif(isset($_GET['newsid'])) { $result = mysql_query("SELECT * FROM news WHERE newsid='$_GET[newsid]' ",$connect); while($myrow = mysql_fetch_assoc($result)) { $title = $myrow["title"]; $text1 = $myrow["text1"]; $text2= $myrow["text2"]; ?> <br> <form method="post" action="<?php echo $PHP_SELF ?>"> <input type="hidden" name="newsid" value="<? echo $myrow['newsid']?>"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="17%">Title : </td> <td width="83%"><input name="title" type="text" size="30" value="<? echo $title; ?>"></td> </tr> <tr> <td>Message : </td> <td><textarea name="text1" cols="35" rows="10"><? echo $text1; ?></textarea></td> </tr> <tr> <td>Message2 : </td> <td><textarea name="text2" cols="35" rows="10"><? echo $text2; ?></textarea></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="Update News"></td> </tr> </table> </form> <? }//end of while loop }//end else ?>
  4. thank you guys.. i did it.. thank you.
  5. i dont know where to put the right code..
  6. hi there guys.. thank you for your reply.. btw. here's the my code when adding news.. <?php include("config.php"); if(isset($_POST['submit'])) {//begin of if($submit). // Set global variables to easier names // and pervent sql injection and apostrophe to break the db. $title = mysql_escape_string($_POST['title']); $text1 = mysql_escape_string($_POST['text1']); $text2 = mysql_escape_string($_POST['text2']); //check if (title) field is empty then print error message. if(!$title){ //this means If the title is really empty. echo "Error: News title is a required field. Please fill it."; exit(); //exit the script and don't do anything else. }// end of if //run the query which adds the data gathered from the form into the database $result = mysql_query("INSERT INTO news (title, dtime, text1, text2) VALUES ('$title',NOW(),'$text1','$text2')",$connect); //print success message. echo "<b>Thank you! News added Successfully!<br>"; echo "<meta http-equiv=Refresh content=2;url=admin.php>"; }//end of if($submit). // If the form has not been submitted, display it! else {//begin of else ?> <br> <form method="post" action="<?php echo $PHP_SELF ?>"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="17%">Title : </td> <td width="83%"><input name="title" type="text" size="30" maxlength="255"></td> </tr> <tr> <td>Brief Message : </td> <td><textarea name="text1" cols="35" rows="10"></textarea></td> </tr> <tr> <td>Message : </td> <td><textarea name="text2" cols="35" rows="10"></textarea></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="Add News"></td> </tr> </table> </form> <? }//end of else ?> and this is my code in showing the list of news @ news.php <?php include("config.php"); $result = mysql_query("SELECT * FROM news ORDER BY newsid DESC",$connect); //lets make a loop and get all news from the database while($myrow = mysql_fetch_assoc($result)) {//begin of loop //now print the results: echo "<font color='#0099CC' size='2'><strong>"; echo $myrow['title']; echo "</strong></font><br>"; echo "<font color='#0066CC' size='1'>On: <i>"; echo $myrow['dtime']; echo "</font>"; echo "</i><br>"; echo "<font color='#000066'>"; echo $myrow['text2']; echo "</font>"; // If Admin logged in (Edit & Delete the news) if (session_is_registered('myusername')) { echo "<br><a href=\"edit_news.php?newsid=$myrow[newsid]\">Edit</a> | <a href=\"delete_news.php?newsid=$myrow[newsid]\">Delete</a>"; } else { echo ""; } echo "<br><br><div class='dots'> </div>"; }//end of loop ?> guys.. if you know where to put code.. please repost the code here together with the code i gave.. thank you..
  7. that's not what i mean.. This is what i mean...look @ my screenshot.. unfortunately, after submitting the news.. this is the result.. anyone ??
  8. i have a new problem now.. when im posting a news.. and submit it.. the text has no LINE BREAK or <BR> example.. i submit this news: ------------ Welcome to my site. i hope you like it.. thank you. admin ------------ after submitting it.. this is the result: Welcome to my site. i hope you like it.. thank you. admin
  9. i got it.. thanks so much thorpe & ken2k7.. i have a new problem now.. when im posting a news.. and submit it.. the text has no LINE BREAK or <BR> example.. i submit this news: ------------ Welcome to my site. i hope you like it.. thank you. admin ------------ after submitting it.. this is the result: Welcome to my site. i hope you like it.. thank you. admin
  10. oh i see.. so what will i do in able to define it and make it work ??
  11. what do you mean?? i dont get what you mean.. can you do a sample from a code above.. thank you..
  12. i have this code.. <?php include("config.php"); $result = mysql_query("SELECT * FROM news ORDER BY newsid DESC",$connect); while($myrow = mysql_fetch_assoc($result)) {//begin of loop //now print the results: echo "<strong>"; echo $myrow['title']; echo "</strong><br>On: <i>"; echo $myrow['dtime']; echo "</i><br><br>"; echo $myrow['text1']; echo "<br>"; break; }//end of loop ?> and i see this code in other site.. <? $position=14; // Define how many character you want to display. $message="You are now joining over 2000 current"; $post = substr($message, 0, $position); echo $post; echo "..."; ?> now, i tried to assign my variable $myrow['text1] to $message. here's now my new code.. <?php include("config.php"); $result = mysql_query("SELECT * FROM news ORDER BY newsid DESC",$connect); $position=14; $message=$myrow['text1']; $post = substr($message, 0, $position); while($myrow = mysql_fetch_assoc($result)) {//begin of loop //now print the results: echo "<strong>"; echo $myrow['title']; echo "</strong><br>On: <i>"; echo $myrow['dtime']; echo "</i><br><br>"; echo $post; echo "..."; echo "<br>"; break; }//end of loop ?> it only shows the item inside $myrow['title'] and $myrow['dtime'].. but the $post doesn't display anything.. or even shorten the text.. can anyone here have alternative way to do this or to get this work.. thank you..
×
×
  • 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.