Unseeeen
Members-
Posts
18 -
Joined
-
Last visited
Never
Everything posted by Unseeeen
-
That's awesome. Thanks for all the help
-
I get an error with that... Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' I don't really understand what that's trying to do anyways. But what I mean by it annoys me, the result is in an array. I don't want it in an array.
-
There can only be one match per person, but there will be multiple people. My code works exactly how I'd like it. The result just annoys me though.
-
Thanks guys, that helps a lot. Here's my code... <form action="" method="post"> <textarea name="first"></textarea><br> <textarea name="second"></textarea> <input value="Submit" type="submit"> </form> <? $first = $_POST['first']; $second = $_POST['second']; $blah = explode(" ", $first); $blahtwo = explode(" ", $second); $result = array_intersect($blah, $blahtwo); print_r($result); ?> It's simple, the way I like it. Anyways, how would I echo the info without having that "Array ( [0] => joe )" thing at the end?
-
So basically I have 2 lists of information. ex: list 1- bob, joe, dan, billy list 2- paul, joe, jim, mike After putting both of those lists into 2 text boxes, how would I make it so only the common ones show up? In this case joe would be the only name that should show up. Thanks.
-
read up on mod_rewrite in .htaccess files.
-
Haha wow, I would of never saw that. Thanks! That's what fixed it. :)
-
v3x: That didn't fix the error. phpstuck: the reason why I have that if there is because that's not all of it...I made it so if there's a post, basically send it to the database, else post the form. I didn't bother posting the form because I didn't feel it was needed and would just make my post longer.
-
I honestly cant find anything wrong with this script, other than it's extremely insecure (and I'll fix that later [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]) [code]<?php $dbconnect = mysql_connect ("localhost", "***", "***") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("***"); $title = $_POST['title']; $author = $_POST['author']; $news = $_POST['news']; $submit = $_POST['submit']; $time = date('D M j'); if(isset($submit)) $sql = "INSERT INTO news ( id, title, newsbody, username, time ) values ( 'NULL', '$title', '$news', '$author', '$time' )"; mysql_query ($sql) or die(mysql_error(); echo "News successfully submitted!"; } else { ?>[/code] I get a unexpected ';' error on line 12, and thats [code]if(isset($submit))[/code] I'm pretty sure I used isset() correctly? I was thinking there could be an error on the next line...but I've been trying everything I can think of and it just won't work Can anyone see what's wrong with it? Thanks.
-
Bingo! Thanks a lot. Also, how common is it for php short tags to NOT be useable? Just seems like all the hosts I've been on have had short tags enabled.
-
Can anyone see what's possibly wrong? I've been stuck for a while now.
-
Yeah I can show you, but only after I finish it up.
-
Yes and yes. The part where the query result should be showing up is empty.
-
Maybe try putting the [code] $a = '1234.txt';[/code] before the first if? I think this is what you're trying to do...if id == 1, then display a link with a in it.
-
Thanks, but I don't think I quite understand. I tried: [code]$query = "SELECT * FROM news ORDER BY id DESC LIMIT $frontpagelimit"; $result = mysql_query($query); $row = mysql_fetch_object($result); while ($row = mysql_fetch_assoc($result)) { ?> <center><table class="news"> <tr><td><b>Title</b>:<i><? echo $row->title; ?></i></td></tr> <tr><td><? echo $row->newsbody;?></td></tr> <tr><td><b>Posted by:</b> <i><? echo $row->username; ?></i> <b>on</b> <i>Jan 1st, 2006</i> <b>at</b> <i><? echo $row->time; ?></i></td></tr> </table> <? } ?>[/code] But nothing shows up? What's wrong?
-
I have another question... My code, will only display one result from the database, but I'm trying to get it to display 5. Here's my code...once again, I dont see what's wrong with it. [code]<? include 'functions.php'; $query = "SELECT * FROM news ORDER BY id DESC LIMIT $frontpagelimit"; $result = mysql_query($query); $row = mysql_fetch_object($result); ?> <center><table class="news"> <tr><td><b>Title</b>:<i><? echo $row->title; ?></i></td></tr> <tr><td><? echo $row->newsbody;?></td></tr> <tr><td><b>Posted by:</b> <i><? echo $row->username; ?></i> <b>on</b> <i><? echo $row->date; ?></i> <b>at</b> <i><? echo $row->time; ?></i></td></tr> </table>[/code]
-
Hey thanks man, I appreciate it.
-
Well, I haven't done anything with php or sql in a while and I just had a simple question... I'm making a very simple news script and right now all I want to do is insert & display results to the database. Here's my code so far. [code] <? $frontpagelimit = "5"; $dbconnect = mysql_connect ("localhost", "user", "pass") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("db"); $query = "SELECT * FROM news ORDER BY id DESC LIMIT $frontpagelimit"; mysql_query($query); $row = mysql_fetch_object($query); echo $row->newsbody; ?>[/code] What I'm trying to do at this stage is get the newsbody that has already been inserted. I get a [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource[/quote] on line 7 error. From what I remember...this should be right. What's my problem? And how, once I've grabbed everything, display more than one news insert at a time? I'm thinking with maybe an array, but how would I do that? Thanks.