
3raser
Members-
Posts
815 -
Joined
-
Last visited
Everything posted by 3raser
-
SOLVED Ok, so I by-passed by other problem by building a whole new system. But now, on the viewing part, I'm trying to including a link to a file in <img src>. But how do I know if it's .png, .jpg, .jpeg, .gif, etc? <?php require("mysql.php"); //connecting to the database $connect = mysql_connect("$h","$u","$password") or die("Connection failed!"); mysql_select_db("$db") or die("Database fail!"); if(!$image) { $image = 1; } //extract $extract = mysql_query("SELECT * FROM photos WHERE photoid='$image'"); $numrows = mysql_num_rows($extract); while ($row = mysql_fetch_assoc($extract)) { $status = $row[status]; } if ($status==1) { echo "<br><img src='images/". $image ."'.><br>"; } else { echo "Picture doesn't exist or hasn't been approved."; } ?>
-
Hold on, I think I might have found a "way around". Not sure. It takes like a whole back end.
-
I'm making an image viewing site. And I'm wondering, how do I make it so on one file (images.php) there is a PHP code that allows people to view all images in /images, like < Prev Next >
-
http://domination.comyr.com/ How do I make the boxes side by side? <style> body { font-family:arial; } div.lefthand { width:400px; height:70px; background-color:#000099; color:#0066FF; } div.righthand { width:100%; height:50px; background-color:#0066FF; color:white; } </style>
-
No, about 3/4 of them were 2005 or so, and they mainly supported Internet Explorer 5 or same crap like that. And that was the same with the 2009 one, it was mainly supporting Internet Explorer (said it only shows in Internet Explorer) but I don't know why. But it's not that big of a deal.
-
Sorry, those are way outdated and don't support most browsers.
-
Just like at the very top of the forum. I want to make a circular box, like how they store their text in circular boxes @ http://waroflegends.com/. I don't want square boxes.
-
Understandable. But how would I compare them?
-
Hey! I've always wondered about this, and I've always thought this would become handy if I ever wanted to create a big website. How do I make it so after 24 hours, their be a change in the database? Example of what I mean: You vote for something, and you must wait 24 hours before voting again. You visit the next day, 24 hours+, and it lets you vote. How would I make something like this?
-
THANK YOU, IT WORKED! WOOO-HOO! Thank you! And thank you everyone else.
-
I did. I gave an example like 3-4 posts up.
-
I'm just trying to get it to search a servername LIKE their keywords put in. But it's making it to were you have to make it EXACT.
-
Here is my code: //display data $get = mysql_query("SELECT * FROM tables WHERE category='$type' AND servername LIKE '$search' ORDER BY likes DESC LIMIT $start, $per_page"); while ($row = mysql_fetch_assoc($get)) It works, but you have to type in the EXACT name of the server for it to show. :/
-
Insert it into your query in the right place. A better question is why on earth are you querying the same database table twice in the same script? What do you mean? They are both used for different things? And, what you said doesn't help me.......at all. :/
-
(Like is the hardest MySQL syntax/code/whatever...XD) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>RuneScape Servers - Search</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div id="container"> <div id="header"><h1>RuneScape Servers - Search</h1></div> <div id="wrapper"> <div id="content"> <p><strong>Search</strong></p> <p><?php $connect = mysql_connect("$mhost","$muser","$mpassword") or die("Connection failed!"); mysql_select_db("$mdatabase") or die("Database fail!"); $search = $_GET['keywords']; $type = $_GET['category']; $search = mysql_real_escape_string($search); $type = mysql_real_escape_string($type); if (!$search || !$type) { echo "<b>(Note: enter in all information that has a * by it)</b><br>*Enter in some keywords: <form action='search.php' method='GET'><input type='text' name='keywords'><br><input type='radio' name='category' value='Non-project server' />*Non-project<br><input type='radio' name='category' value='Project server'>*Project<br><input type='submit'></form>"; } else { echo "Viewing results for <b>".$search ."</b> for a <b>". $type ."</b> server<br>"; //max displayed per page $per_page = 10; //get start variable $start = $_GET['start']; //count records $record_count = mysql_num_rows(mysql_query("SELECT * FROM tables")); //count max pages $max_pages = $record_count / $per_page; //may come out as decimal if (!$start) $start = 0; //display data $get = mysql_query("SELECT * FROM tables WHERE category='$type' ORDER BY likes DESC LIMIT $start, $per_page"); while ($row = mysql_fetch_assoc($get)) { echo "<br><b>". $row['servername'] ." (". $row['category'] .") created by ". $row['serverowner'] ." (". $row[views] ." views & ". $row[likes] ." likes!)</b><br>"; } //setup prev and next variables $prev = $start - $per_page; $next = $start + $per_page; //show prev button if (!($start<=0)) echo "<a href='index.php?start=$prev'>Prev</a> "; //show page numbers //set variable for first page $i=1; for ($x=0;$x<$record_count;$x=$x+$per_page) { if ($start!=$x) echo " <a href='index.php?start=$x'>$i</a> "; else echo " <a href='index.php?start=$x'><b>$i</b></a> "; $i++; } //show next button if (!($start>=$record_count-$per_page)) echo " <a href='index.php?start=$next'>Next</a>"; } ?></p> </div> </div> <div id="navigation"> <p><strong>Menu</strong></p> <ul> <li><a href="search.php">Search</a></li> <li><a href="add.php">Add a project</a></li> </ul> </div> <div id="extra"> <p><strong>Read me!</strong></p> <p>The search page only shows 10 results per page!</p> </div> <div id="footer"> <p>Happy searching</p> </div> </div> </body> </html> In my code, how would I make it so $search could be used as keywords to search a name of a server LIKE his inputed keywords?
-
Simple code error, can't find out why it echo's out two times
3raser replied to 3raser's topic in PHP Coding Help
ANYONE? -
Simple code error, can't find out why it echo's out two times
3raser replied to 3raser's topic in PHP Coding Help
Uhm....didn't understand that. And they are already in my if statement? And why do quotes matter? o.O -
if ($comments==1) { //display data $get = mysql_query("SELECT * FROM users WHERE username='$output'"); while ($row = mysql_fetch_assoc($get)) { // get data $id = $row[id]; } //max displayed per page $per_page = 8; //get start variable $start = $_GET['start']; //count records $record_count = mysql_num_rows(mysql_query("SELECT * FROM profilecomments WHERE touser='$username'")); //count max pages $max_pages = $record_count / $per_page; //may come out as decimal if (!$start) $start = 0; //display data $get = mysql_query("SELECT * FROM profilecomments WHERE touser='$output' ORDER BY id DESC LIMIT $start, $per_page"); while ($row = mysql_fetch_assoc($get)) { if ($row[reported]==1) { $reporttext = "[Report]"; } else { $reporttext = "Message Reported"; } if ($row[hidden]==1) { $row['message']="<span style='color:blue'><i>This post has been hidden by the profile owner.</i></span>"; } echo "<b><span style='color:black'>Posted by <a href='profiles.php?search=". $row[fromuser] ."'>". $row[fromuser] ."</a> on ". $row[date] . ($userrank==1 ? "<a href='profiles.php?delcomment=1&commentid=" . $row[id] . "'>[Delete Comment]</a>":"" ) . "<div align='right'>". $reportext ."</div><br></span><span style='color:orange'>". $row[message] ."</span></b><hr><br>"; } //setup prev and next variables $prev = $start - $per_page; $next = $start + $per_page; //show prev button if (!($start<=0)) echo "<a href='index.php?start=$prev'>Prev</a> "; //show page numbers //set variable for first page $i=1; for ($x=0;$x<$record_count;$x=$x+$per_page) { if ($start!=$x) echo " <a href='index.php?start=$x'>$i</a> "; else echo " <a href='index.php?start=$x'><b>$i</b></a> "; $i++; } //show next button if (!($start>=$record_count-$per_page)) echo " <a href='index.php?start=$next'>Next</a>"; echo "<br><br><a href='profiles.php?addcomment=". $id ."' onclick='document.getElementById(\"commentarea\").style.visibility=\"visible\"; return false;'>Add a comment</a> <div id='commentarea' style='visibility: hidden;'> <form action='profiles.php' method='POST'><input type='hidden' name='hiddenid' value='". $id ."'><textarea name='comment' maxlength='300' cols='65' rows='15'></textarea><br><br><input type='submit' value='Add comment'> or <a href='#' onclick='document.getElementById(\"commentarea\").style.visibility=\"hidden\"; this.form.hiddenid.value=\"\";'>Discard comment</a></form> </div>"; } else { //display data $get = mysql_query("SELECT * FROM users WHERE username='$username'"); while ($row = mysql_fetch_assoc($get)) { // get data $id = $row[id]; } //max displayed per page $per_page = 8; //get start variable $start = $_GET['start']; //count records $record_count = mysql_num_rows(mysql_query("SELECT * FROM profilecomments WHERE touser='$username'")); //count max pages $max_pages = $record_count / $per_page; //may come out as decimal if (!$start) $start = 0; //display data $get = mysql_query("SELECT * FROM profilecomments WHERE touser='$username' ORDER BY id DESC LIMIT $start, $per_page"); while ($row = mysql_fetch_assoc($get)) { if ($row[reported]==1) { $reporttext = "[Report]"; } else { $reporttext = "Message Reported"; } if ($row[hidden]==1) { $row['message']="<span style='color:blue'><i>This post has been hidden by the profile owner.</i></span>"; } $name = $_SESSION['loggedin']; $check_first = md5($name); if ($row[hidden]==0) { echo "<b><a href='profiles.php?hide=". $check_first ."&idhide=". $row[id] ."'>[Hide message]</a></b> "; } else { echo "<b><a href='profiles.php?unhide=". $check_first ."&idshow=". $row[id] ."'>[show message]</a></b> "; } echo "<b><span style='color:black'>Posted by <a href='profiles.php?search=". $row[fromuser] ."'>". $row[fromuser] ."</a> on ". $row[date] . ($userrank==1 ? "<a href='profiles.php?delcomment=1&commentid=" . $row[id] . "'>[Delete Comment]</a>":"" ) ."<div align='right'>". $reportext ."</div><br></span><span style='color:orange'>". $row[message] ."</span></b><hr><br>"; } } //setup prev and next variables $prev = $start - $per_page; $next = $start + $per_page; //show prev button if (!($start<=0)) echo "<a href='index.php?start=$prev'>Prev</a> "; //show page numbers //set variable for first page $i=1; for ($x=0;$x<$record_count;$x=$x+$per_page) { if ($start!=$x) echo " <a href='index.php?start=$x'>$i</a> "; else echo " <a href='index.php?start=$x'><b>$i</b></a> "; $i++; } //show next button if (!($start>=$record_count-$per_page)) echo " <a href='index.php?start=$next'>Next</a>"; echo "<br><br><a href='profiles.php?addcomment=". $id ."' onclick='document.getElementById(\"commentarea\").style.visibility=\"visible\"; return false;'>Add a comment</a> <div id='commentarea' style='visibility: hidden;'> <form action='profiles.php' method='POST'><input type='hidden' name='hiddenid' value='". $id ."'><textarea name='comment' maxlength='300' cols='65' rows='15'></textarea><br><br><input type='submit' value='Add comment'> or <a href='#' onclick='document.getElementById(\"commentarea\").style.visibility=\"hidden\"; this.form.hiddenid.value=\"\";'>Discard comment</a></form> </div>"; Why does it echo out if (!($start>=$record_count-$per_page)) echo " <a href='index.php?start=$next'>Next</a>"; echo "<br><br><a href='profiles.php?addcomment=". $id ."' onclick='document.getElementById(\"commentarea\").style.visibility=\"visible\"; return false;'>Add a comment</a> <div id='commentarea' style='visibility: hidden;'> <form action='profiles.php' method='POST'><input type='hidden' name='hiddenid' value='". $id ."'><textarea name='comment' maxlength='300' cols='65' rows='15'></textarea><br><br><input type='submit' value='Add comment'> or <a href='#' onclick='document.getElementById(\"commentarea\").style.visibility=\"hidden\"; this.form.hiddenid.value=\"\";'>Discard comment</a></form> </div>"; Two times when $comment is equal to 1? I can't find it anywhere.
-
Why do I get Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home6/clubzobb/public_html/Homepage/profiles.php on line 95 for $22output = (strtolower($get_username));
-
I have a profile system, and when people type their name in ALL caps, it seems to act like it's not their profile when it is. Can anyone give me a simple code so the code does something like this: Before: THIS After: this
-
Why doesn't it work? Trying to execute a MySQL command - Trying to echo
3raser replied to 3raser's topic in PHP Coding Help
I found it. -
Why wont $info or $info2 echo out? if ($comments==1) { mysql_query("SELECT * FROM profilecomments WHERE touser='$output'"); while ($row = mysql_fetch_assoc($get)) { if ($row[reported]==1) { $reporttext = "[Report]"; } else { $reporttext = "Message Reported"; } $info = "Posted by ". $row[fromuser] ." on ". $row[date] ."<div align='right'>". $reportext ."</div><br><br>". $row[message] ."<hr><br>"; $info2 = "<a href='profiles.php?addcomment=1'>Add a comment!</a>"; } } else { mysql_query("SELECT * FROM profilecomments WHERE touser='$username'"); while ($row = mysql_fetch_assoc($get)) { if ($row[reported]==1) { $reporttext = "[Report]"; } else { $reporttext = "Message Reported"; } $info = "Posted by ". $row[fromuser] ." on ". $row[date] ."<div align='right'>". $reportext ."</div><br><br>". $row[message] ."<hr><br>"; $info2 = "<a href='profiles.php?addcomment=1'>Add a coment!</a>"; } } if ($viewcount==1) { mysql_query("UPDATE users SET profileviews = profileviews + 1 WHERE username='$output'"); } echo "$message57"; echo "$info"; echo "$info2";
-
My first while doesn't have an extra }, I double checked. I also didn't see anything with " or ' that as causing the error. And what are you talking about with the die's?
-
PHP error code: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home6/clubzobb/public_html/Homepage/profiles.php on line 215 The code that makes the error: if ($comments==1) { mysql_query("SELECT * FROM profilecomments WHERE touser='$output'"); while ($row = mysql_fetch_assoc($get)) { if ($row[reported]==1) { $reporttext = "[Report]"; } else { $reporttext = "Message Reported"; } $info = "Posted by ". $row[fromuser] ." on ". $row[date] ."<div align='right'>". $reportext ."</div><br><br>". $row[message] ."<hr><br>"; $info2 "<a href='profiles.php?addcomment=". $id55 ."'></a>Add a comment to ". $output ."'s profile!"; } } else { mysql_query("SELECT * FROM profilecomments WHERE touser='$username'"); while ($row = mysql_fetch_assoc($get)) { if ($row[reported]==1) { $reporttext = "[Report]"; } else { $reporttext = "Message Reported"; } $info = "Posted by ". $row[fromuser] ." on ". $row[date] ."<div align='right'>". $reportext ."</div><br><br>". $row[message] ."<hr><br>"; $info2 "<a href='profiles.php?addcomment=". $id55 ."'></a>Add a comment to ". $username ."'s profile!"; } } if ($viewcount==1) { mysql_query("UPDATE users SET profileviews = profileviews + 1 WHERE username='$output'"); } echo "$message57"; echo $info; echo $info2;
-
Please! My site is being abused, and I can't get this code to work!
3raser replied to 3raser's topic in PHP Coding Help
Do you know a script that does?