
DJTim666
Members-
Posts
212 -
Joined
-
Last visited
Never
Everything posted by DJTim666
-
that's not working =O! Still the same problem. It doesn't even insert < br / > into the DB.
-
I need to know why the following code isn't working for me. It is supposed to take enter's and insert them into the DB as < br / > Code: <?php <tr><td width='80%'><textarea cols='40' rows='4' name='p_message'></textarea></td></tr> $p_message = $_POST['p_message']; $replaceit = array(BAD WORDS =O!); $replaceit2 = array("*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****", "*****","*****", "*****"); $donereplace = str_ireplace($replaceit, $replaceit2, $p_message); $safe_p_message = mysql_real_escape_string(strip_tags($donereplace)); $safe_p_message2 = str_ireplace("\n", "<br />", $safe_p_message); mysql_query("INSERT INTO forum_posts (post_name, post_msg, time_posted, top_id) VALUES('" . $Yourname . "', '" . $safe_p_message2 . "', '" . $currentime . "', '" . $topic_id . "')"); ?> The variables that you don't see defined here, are defined in my core file. -- DJ!
-
[SOLVED] Undefined Function: mysql_num_rows()!!!
DJTim666 replied to DJTim666's topic in PHP Coding Help
I'm an idiot. Please delete this topic. -
Please tell me how this makes any sense w.s.e! Fatal error: Call to undefined function msyql_num_rows() in /home/trukki4/public_html/evodragon/profiles.php on line 85 Line 85: if (!msyql_num_rows($pfft_2)){ ///more code here/// -- DJ
-
Ok, I just coded a mail system for my members on my site. But I want to give my users the option to block another user. The problem is I haven't got an idea of how to do this. Please offer some help. If you prefer MSN or AIM I have both. MSN: [email protected] AIM: Freudian666
-
I have fixed the problem. Thanks for all the the help. I do have another question though;; I want the users of my site to be able to enter comments with a ' in the word (e.g. don't) but at the same time I want to use mysql_real_escape_string(); to prevent hacking. How would I go about letting my users use words like don't without having it look like this --> don\'t. Please help me ! -- DJ
-
Any suggestions, I really need this fixed !
-
Ermm, I have used $row[w.e] and it has worked fine in the past, now all of a sudden it won't work ??? EDIT: I changed it and it is still not working...
-
@AndyB They are predefined in the core.php file. @GuiltyGear You can use either one of the formats. I could use $row["w.e"] if I really wanted !
-
The following code won't display the results from the DB <?php require_once("core.php"); loggedin(); echo "<h3>Mail</h3>"; echo "MENU WILL GO HERE...<br /><br />"; if (!$act){ $sql = "SELECT * FROM messages WHERE to_name='$Yourname'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); //determine backround colour if ($row[state] == 'read'){ $color = "white"; } else { $color = "orange"; } echo "<table border='1'> <tr><td><b>From</b></td> <td><b>Subject</b></td> <td><b>Time Sent</b></td> <td><b>Delete?</b></td></tr>"; if (mysql_num_rows($result) == 0){ showerror("<tr><td colspan='4'>No new messages.</td></tr></table>"); } else { echo "<form action='mail.php' method='post'>"; while ($row2 = mysql_fetch_array($result)){ echo "<tr><td bgcolor='$color'><a href='profiles.php?user=" . $row2[from_name] . "'>$row2[from_name]</a></td> <td bgcolor='$color'><a href='$PHP_SELF?act=read'>$row2[subject]</a></td> <td bgcolor='$color'>$row2[time_sent]</td> <td bgcolor='$color'><input type='checkbox' name='delete' value='yes' /></td>"; } echo "</form></table>"; } } require_once("footer.php"); ?> It doesn't print out an error, and there is a result in the DB. -- DJ
-
Still looking for a solution...
-
Well, I don't see why it wouldn't work, unless your hosting provider has disabled it ???
-
not OBSTART(); ob_start(); it is called output buffering.
-
hoolllaaa any help?
-
If you use the ob_start(); function at the top of your page you can output headers even if information has been sent to the browser !
-
I'm not getting an error, it just won't show the results from the database.
-
GAHH . Lol. Thnx for that fix, now read further down. It won't display the results from rows statement.
-
It says that I have an error in my syntax near " at line one, check manuel blahblahblah ???
-
<?php $s=localtime(); $h=$s[2]; $m=$s[1]; $s=$s[0]; if ($h<10)$h="0".$h; if ($m<10)$m="0".$m; if ($s<10)$s="0".$s; $gmtdiff=(int)date('O'); $time=(int)$time; $timegmt=$time+$gmtdiff; $timegmt.=$timegmt.$s; ?> Try that code. -- DJ
-
When I try to run the following code, I either get MySQL errors, or nothing shows... <?php if($act == 'view') { if (!$topic_id){ echo "<b><i><a href='$PHP_SELF?act=view&forum=$id&topic=create'>Create Topic</a></i></b><br><br>"; echo "<table border=1><tr> <td><b><center>Topic Name:</center></b></td> <td><b><center>Posted By:</center></b></td> <td><b><center>Quick Desc:</center></b></td> <td><b><center>Posted On:</center></b></td> <td><b><center>Last Poster:</center></b></td> </tr>"; $topic_sql = mysql_query("SELECT * FROM forum_topics WHERE f_id=$id"); while($row2=mysql_fetch_array($topic_sql)) { echo "<tr><td><font size=2><b><a href='$PHP_SELF?act=view&forums=$id&topic=$row2[iD]'>$row2[t_name]</font></b></font></td> <td><font size=2><u>$row2[posted_by]</u></font></td> <td><font size=1><i>$row2[t_desc]</i></font></td> <td><font size=2>$row2[time_posted]</font></td> <td><font size=2>last poster</font></td> </tr>"; } echo"</table>"; } if (isset($topic_id)){ if ($topic_id == 'create'){ $topic_name = $_POST['topic_name']; $message = $_POST['message']; if (!isset($topic_name)){ echo "<form action='$PHP_SELF?act=view&forum=$id&topic=create' method='post'> Topic Name:<br /><input type='text' name='topic_name' /><br /> Message:<br /><textarea rows='4' cols='40' name='message'></textarea><br /> <input type='submit' value='Create Topic' /> </form>"; } if (isset($topic_name)){ if (empty($topic_name) || empty($message)){ showerror("You left one of the fields blank."); } else { //this mysql query wont run V mysql_query("INSERT INTO forum_topics (f_id, t_name, t_desc, t_msg, time_posted, posted_by, last_poster) VALUES('$id', '$topic_name', 'eee', '$message', 'time()', '$Yourname', 'IDK'") or die(mysql_error()); echo "You have created the topic <b>$topic_name</b>"; } } } else { global $id, $row2; $p_message = $_POST['p_message']; $sql = "SELECT * FROM forum_posts WHERE top_id=$topic_id"; $result10 = mysql_query($sql); if (!isset($p_message)){ global $id, $row2; echo "<table border='1'>//This code won't show results V <tr><td><a href='profiles.php?user=$row2[posted_by] f'>$row2[posted_by] f</a></td><td>$row2[t_name] c</td></tr> <tr><td>Avatar</td><td>$row2[t_msg] asdfgsdfgfdgsfgfgfs</td></tr></table><br /><br />"; if (mysql_num_rows($result10) == 0){ echo "This topic has no reply's yet."; } while ($row4 = mysql_fetch_array($result10)){ echo "<table border='1' width=70%> <tr><td width='20%'><a href='profiles.php?user=$row4[post_name]'>$row4[post_name]</a></td><td>RE: HAVE TO FIX THIS...$row4[t_name]</td></tr> <tr><td>Avatar</td><td>$row4[post_msg]</td></tr></table><br /><br />"; } echo "<form action='$PHP_SELF?act=view&forum=$id&topic=$topic_id' method='post'> <br /><br />Message: <textarea cols='40' rows='4' name='p_message'></textarea><br /> <input type='submit' value='Post Message' /> </form>"; } if (isset($p_message)){ if (strlen($p_message) > 5000){ showerror("<br />Your post was more then 5000 characters."); } if (empty($p_message)){ showerror("<br />You left the message field blank."); } else { mysql_query("INSERT INTO forum_posts (post_name, post_msg, time_posted, top_id) VALUES('$Yourname', '$p_message', 'time()', '$topic_id')"); echo "You have just posted a reply. Go back and refresh to see it."; } } } } } ?> Help is appreciated. -- DJ
-
When I use the following code to replace user_input, it outputs "br" instead of "< br >". <?php $profile = $_POST[newprofile]; $user_input = array("[br]", "[u]", "[/u]", "[b]", "[/b]", "[img=", "]", "[url]", "[/url]", "[hr]", "<", "/>", ">"); $replace_with = array("<br>", "<u>", "</u>", "<b>", "</b>", "<img src='", "'>", "<a href='", "'></a>", "<hr>", "", "", ""); $new_pro = str_replace($user_input, $replace_with, $profile); ?> -- DJ
-
I need to know how to carry a variable from one action to the next. <?php require_once("database.php"); require_once("layout.php"); echo "<h3>Profiles</h3>"; if (!isset($_POST['username'])){ echo "<form action='profile.php' method='post'> <input type='text' name='username' /><br> <input type='submit' value='Search' /> </form>"; } if (isset($_POST['username'])){ $username = mysql_real_escape_string($_POST['username']); $sql = "SELECT * FROM users WHERE username='$username'"; $result= mysql_query($sql) or die(mysql_error()); $id = mysql_fetch_array($result) or die(mysql_error()); if (empty($username)){ echo "You left the search field blank."; die(); } if (mysql_num_rows($result) == 0){ echo "That username does not exist in our database."; die(); } else { echo "You are searching for the username " . $username . "<br /><br />"; echo "<a href='$PHP_SELF?profile=" . $id['id'] . "'>" . $username . "</a>"; } } if ($_GET['profile']){ global $id, $username, $sql, $result; $sql2 = "SELECT * FROM users WHERE id='$id'"; $result2 = mysql_query($sql2); $fetch = mysql_fetch_array($result2); echo "Username: " . $username . "<br> ID: " . $fetch['id'] . "<br> RP: " . $fetch['rp'] . "<br> you can put more stuff "; } ?> When I click the link of the name i am searching it displays the profile but not the values. So it displays; Username: ID: RP: you can put more stuff I want it to display; Username: Test ID: 4 RP: 245256 you can put more stuff Help is greatly appreciated. -- DJ
-
I didn't ask for smartass comments. I haven't been on here for the past couple days . @ Everyone else Thanks for the help !
-
Ok, I am using a while statement to pull results from my database. Now if I have like 40 results how would I make it break into rows. So instead of; result result result result result result result result result result result result result result result result result result I want; result result result result result result result result result result result result result result result result result result result result Help appreciated. -- DJ
-
Woot. Thank's for your help.